123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592 |
- <?xml version="1.0" encoding="UTF-8"?>
- <project default="generate.all"
- basedir="."
- name="org.yakindu.sct.doc.user"
- xmlns:if="ant:if"
- xmlns:unless="ant:unless"
- xmlns:artifact="antlib:org.eclipse.aether.ant">
- <!-- Runtime properties:
- website.local.files: Generates website as local files
- -->
- <!-- Include platform-specific or machine-specific properties, if any. -->
- <property file="local.properties" />
- <!-- The documentation source files located beneath this directory.
- They may be structured into folders of arbitrary depth. -->
- <property name="src.dir" value="src" />
- <!-- CSS files are located here. -->
- <property name="css.dir" value="css" />
- <!-- Root CSS file to be referenced by the generated HTML files. -->
- <property name="css.root.file" value="style.css" />
- <!-- Javascript files are located here. -->
- <property name="js.dir" value="js" />
- <!-- Image files reside in subdirectories with the following name: -->
- <property name="img.dir" value="images" />
- <!-- Target directories for various output formats: -->
- <property name="help.dir" value="help" />
- <property name="website.dir" value="website" />
- <property name="pdf.dir" value="pdf" />
- <property name="epub.dir" value="epub" />
- <!-- Libraries used by various Ant tasks are located here: -->
- <property name="lib.dir" location="${basedir}/lib" />
- <!-- Aether Ant Tasks configuration -->
- <property name="aether.jar.version" value="1.0.1.v20141111" />
- <property name="aether.jar.checksum"
- value="195ea2e75242b2a4919463e8e95f57bd3cfcfeb3920879fca5b680255dba4a22b9ec0d53138e608d3be94d80a444aa9b7b8522e5bf01660f0dfb4688dae998dd" />
- <property name="aether.jar.src"
- value="http://search.maven.org/remotecontent?filepath=org/eclipse/aether/aether-ant-tasks/${aether.jar.version}/aether-ant-tasks-${aether.jar.version}-uber.jar" />
- <property name="aether.jar.file" value="${lib.dir}/aether-ant-tasks-uber.jar" />
- <!-- MyLyn Wikitext version: -->
- <property name="wikitext.version" value="3.0.20" />
- <!-- Remove generated stuff. The "lib" directory will not be deleted. Remove it manually, if you have to. -->
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false">
- <fileset dir="${basedir}" defaultexcludes="false">
- <include name="${help.dir}/**" />
- <include name="${website.dir}/**" />
- <include name="${pdf.dir}/**" />
- <include name="${epub.dir}/**" />
- </fileset>
- <fileset dir="${src-merged.dir}" />
- </delete>
- </target>
- <!-- Aether Ant Tasks are used to access Maven dependencies from an Ant build. It is initialized by downloading
- the Aether Ant Tasks JAR to the library folder, if needed. The downloaded JAR will not be removed by the
- "clean" target. If the JAR is present, a typedef will make Aether Ant Tasks' elements available in the Ant
- build file. -->
- <target name="init.aether"
- description="Initializes Aether Ant Tasks JAR by downloading the JAR and defining a type.">
- <condition property="target.exists">
- <available file="${aether.jar.file}" />
- </condition>
- <sequential unless:set="target.exists">
- <mkdir dir="${lib.dir}" />
- <get src="${aether.jar.src}"
- dest="${aether.jar.file}"
- skipexisting="true"
- usetimestamp="true"
- verbose="true" />
- <fail message="Checksum mismatch for ${aether.jar.file}. Please delete it and rerun ant to redownload.">
- <condition>
- <not>
- <checksum file="${aether.jar.file}"
- algorithm="SHA-512"
- property="${aether.jar.checksum}"
- verifyproperty="checksum.matches" />
- </not>
- </condition>
- </fail>
- </sequential>
- <path id="aether-ant-tasks.classpath" path="${aether.jar.file}" />
- <typedef resource="org/eclipse/aether/ant/antlib.xml"
- uri="antlib:org.eclipse.aether.ant"
- classpathref="aether-ant-tasks.classpath" />
- </target>
- <!-- Resolves the Wikitext dependencies: -->
- <target name="init.wikitext" description="Resolves the Wikitext dependencies." depends="init.aether">
- <!-- Classpath for MyLyn Wikitext: -->
- <artifact:resolve>
- <artifact:dependencies>
- <dependency groupId="org.eclipse.mylyn.docs"
- artifactId="org.eclipse.mylyn.wikitext"
- version="${wikitext.version}"
- scope="compile" />
- </artifact:dependencies>
- <path refid="wikitext.classpath" />
- <files dir="${lib.dir}/bin" layout="{groupId}/{artifactId}-{baseVersion}.{extension}" />
- </artifact:resolve>
- <!-- Sources of MyLyn Wikitext: -->
- <artifact:resolve>
- <artifact:dependencies>
- <dependency groupId="org.eclipse.mylyn.docs"
- artifactId="org.eclipse.mylyn.wikitext"
- version="${wikitext.version}"
- scope="compile"
- classifier="sources" />
- </artifact:dependencies>
- <files dir="${lib.dir}/src" layout="{groupId}/{artifactId}-{baseVersion}-{classifier}.{extension}" />
- </artifact:resolve>
- <!-- Classpath for MyLyn Wikitext's Textile support: -->
- <artifact:resolve>
- <artifact:dependencies>
- <dependency groupId="org.eclipse.mylyn.docs"
- artifactId="org.eclipse.mylyn.wikitext.textile"
- version="${wikitext.version}"
- scope="compile" />
- </artifact:dependencies>
- <path refid="wikitext.textile.classpath" />
- <files dir="${lib.dir}/bin" layout="{groupId}/{artifactId}-{baseVersion}.{extension}" />
- </artifact:resolve>
- <!-- Sources of MyLyn Wikitext's Textile support: -->
- <artifact:resolve>
- <artifact:dependencies>
- <dependency groupId="org.eclipse.mylyn.docs"
- artifactId="org.eclipse.mylyn.wikitext.textile"
- version="${wikitext.version}"
- scope="compile"
- classifier="sources" />
- </artifact:dependencies>
- <files dir="${lib.dir}/src" layout="{groupId}/{artifactId}-{baseVersion}-{classifier}.{extension}" />
- </artifact:resolve>
- <!-- Classpath for MyLyn Wikitext's Ant support: -->
- <artifact:resolve>
- <artifact:dependencies>
- <dependency groupId="org.eclipse.mylyn.docs"
- artifactId="org.eclipse.mylyn.wikitext.ant"
- version="${wikitext.version}"
- scope="compile" />
- </artifact:dependencies>
- <path refid="wikitext.ant.classpath" />
- </artifact:resolve>
- <!-- Classpath for Wikitext: -->
- <path id="wikitext.all.classpath">
- <path refid="wikitext.classpath" />
- <path refid="wikitext.textile.classpath" />
- <path refid="wikitext.ant.classpath" />
- </path>
- <!-- Classpath for YAKINDU Docs: -->
- <artifact:resolve>
- <artifact:dependencies>
- <dependency groupId="org.yakindu.docs"
- artifactId="yakindu-docs-maven-plugin"
- version="0.0.1-SNAPSHOT"
- scope="compile" />
- </artifact:dependencies>
- <path refid="org.yakindu.docs.classpath" />
- </artifact:resolve>
- </target>
- <!-- Generates the documentation in all supported formats. -->
- <target name="generate.all"
- description="Generates the documentation in all supported formats."
- depends="generate.eclipsehelp, generate.website" />
- <!-- Generates the documentation as Eclipse help. -->
- <target name="generate.eclipsehelp"
- description="Generates the documentation as separate Eclipse help (HTML) files from their respective textile (wikitext) sources."
- depends="init.wikitext">
- <sequential>
- <taskdef classpathref="wikitext.all.classpath" resource="org/eclipse/mylyn/wikitext/ant/tasks.properties" />
- <!-- Textile source files to turn into HTML: -->
- <fileset id="fileset.eclipsehelp" dir="${src.dir}">
- <include name="tutorials/tutorials.textile" />
- <include name="user-guide/overview.textile" />
- <include name="user-guide/installation.textile" />
- <include name="user-guide/editing_statecharts.textile" />
- <include name="user-guide/simulating_statecharts.textile" />
- <include name="user-guide/c-domain.textile" />
- <!-- include name="user-guide/typescript-domain.textile" / -->
- <include name="user-guide/statechart_language.textile" />
- <include name="user-guide/code_generation_intro.textile" />
- <include name="user-guide/code_generation_c.textile" />
- <include name="user-guide/code_generation_cpp.textile" />
- <include name="user-guide/code_generation_java.textile" />
- <include name="user-guide/code_generation_statechart_image.textile" />
- <include name="user-guide/code_generation_custom.textile" />
- <include name="user-guide/generating_code_headless.textile" />
- <include name="user-guide/sctunit.textile" />
- <include name="user-guide/search_and_navigate.textile" />
- <!-- <include name="user-guide/glossary.textile" /> -->
- </fileset>
- <!-- Check whether we have all the expected textile source files – no more, no less: -->
- <fail message="Number of textile source file(s) doesn't match.">
- <condition>
- <resourcecount refid="fileset.eclipsehelp" when="ne" count="16" />
- </condition>
- </fail>
- <!-- Convert textile source files to HTML: -->
- <wikitext-to-eclipse-help markupLanguage="Textile"
- multipleOutputFiles="false"
- navigationImages="true"
- formatoutput="true"
- validate="true"
- failOnValidationError="true"
- failOnValidationWarning="true"
- sourceEncoding="UTF-8"
- title="YAKINDU Statechart Tools"
- helpPrefix="${help.dir}">
- <fileset refid="fileset.eclipsehelp" />
- <stylesheet url="../${css.dir}/${css.root.file}" />
- </wikitext-to-eclipse-help>
- <!-- Files have been generated in the source directory, which is bad practice. Move them to the destination
- directory: -->
- <move todir="${help.dir}" flatten="no" verbose="no">
- <fileset dir="${src.dir}">
- <include name="**/*.html" />
- <include name="**/*-toc.xml" />
- </fileset>
- </move>
- <!-- Add HTML META element for Internet Explorer :-( -->
- <replaceregexp byline="false"
- match='(\s*)(<title>)'
- replace='\1<meta http-equiv="X-UA-Compatible" content="IE=edge"/>\1\2'>
- <fileset dir="${help.dir}">
- <include name="**/*.html" />
- </fileset>
- </replaceregexp>
- <!-- Add HTML META element to support viewport scaling -->
- <replaceregexp byline="false"
- match='(\s*)(<title>)'
- replace='\1<meta name="viewport" content="width=device-width, initial-scale=1.0"/>\1\2'>
- <fileset dir="${help.dir}">
- <include name="**/*.html" />
- </fileset>
- </replaceregexp>
- <!-- Add CSS classes "eclipsehelp" and "body-container" to BODY element and
- nest a DIV child with CSS class "primary" into the BODY element. -->
- <replaceregexp byline="true"
- match='<body>'
- replace='<body class="eclipsehelp body-container"><div class="primary">'>
- <fileset dir="${help.dir}">
- <include name="**/*.html" />
- </fileset>
- </replaceregexp>
- <replaceregexp byline="true" match='</body>' replace='</div></body>'>
- <fileset dir="${help.dir}">
- <include name="**/*.html" />
- </fileset>
- </replaceregexp>
- <!-- Remove H1 headings produced by "early separators" -->
- <replaceregexp byline="false"
- flags="g"
- match='<h1 id=".+" style="%EARLY_SEPARATOR%">.*</h1>'
- replace=''>
- <fileset dir="${help.dir}">
- <include name="**/*.html" />
- </fileset>
- </replaceregexp>
- <!-- Fix DIV elements -->
- <replaceregexp byline="false" flags="g" match='<p><div(.*)></p>' replace='<div\1>'>
- <fileset dir="${help.dir}">
- <include name="**/*.html" />
- </fileset>
- </replaceregexp>
- <replaceregexp byline="false" flags="g" match='<p></div></p>' replace='</div>'>
- <fileset dir="${help.dir}">
- <include name="**/*.html" />
- </fileset>
- </replaceregexp>
- <!-- Validate the generated and modified HTML: -->
- <xmlvalidate failonerror="yes" lenient="yes" warn="no">
- <fileset dir="${help.dir}" includes="**/*.html" />
- <attribute name="http://xml.org/sax/features/validation" value="false" />
- <attribute name="http://apache.org/xml/features/validation/schema" value="false" />
- <attribute name="http://apache.org/xml/features/validation/schema-full-checking" value="false" />
- <attribute name="http://apache.org/xml/features/validation/warn-on-undeclared-elemdef" value="false" />
- <attribute name="http://apache.org/xml/features/validation/dynamic" value="false" />
- <attribute name="http://apache.org/xml/features/nonvalidating/load-dtd-grammar" value="false" />
- <attribute name="http://apache.org/xml/features/nonvalidating/load-external-dtd" value="false" />
- <attribute name="http://xml.org/sax/features/namespaces" value="false" />
- <attribute name="http://xml.org/sax/features/external-general-entities" value="false" />
- <attribute name="http://xml.org/sax/features/external-parameter-entities" value="false" />
- <attribute name="http://xml.org/sax/features/resolve-dtd-uris" value="false" />
- <attribute name="http://xml.org/sax/features/use-entity-resolver2" value="false" />
- <attribute name="http://xml.org/sax/features/namespace-prefixes" value="false" />
- <attribute name="http://xml.org/sax/features/namespaces" value="false" />
- </xmlvalidate>
- <!-- Copy the CSS files to the destination directory: -->
- <copy todir="${help.dir}/${css.dir}">
- <fileset dir="${css.dir}">
- <include name="*" />
- </fileset>
- </copy>
- <!-- Copy the Javascript files to the destination directory: -->
- <copy todir="${help.dir}/${js.dir}">
- <fileset dir="${js.dir}">
- <include name="*" />
- </fileset>
- </copy>
- <!-- Copy the image files to the destination directory: -->
- <copy todir="${help.dir}">
- <fileset dir="src">
- <include name="**/${img.dir}/*" />
- <exclude name="**/${img.dir}/*.xcf" />
- </fileset>
- </copy>
- </sequential>
- </target>
- <!-- Generates the documentation as various HTML files, each being composed of selected sections. Each part has a
- name and a title, and consists of a set of source files. The generated documentation structure looks like this:
- website
- YSCT-installation.html
- YSCT-user-guide.html
- YSCT-tutorials.html
- css/yakindu.css
- css/ysct.css
- js/yakindu.js
- …
- images/…
- -->
- <target name="generate.website"
- description="Generates the documentation as various HTML files for the website, each being composed of selected sections. Use -Dwebsite.local.files=true to generate the website as local files for preview."
- depends="init.wikitext">
- <sequential>
- <taskdef classpathref="wikitext.all.classpath" resource="org/eclipse/mylyn/wikitext/ant/tasks.properties" />
- <!-- Tutorials -->
- <create-website-part name="YSCT-tutorials" title="Tutorials">
- <textile-files>
- <filelist dir="${src.dir}">
- <file name="tutorials/tutorials.textile" />
- </filelist>
- </textile-files>
- <image-files>
- <fileset dir="${src.dir}">
- <include name="tutorials/images/**/*" />
- </fileset>
- </image-files>
- </create-website-part>
- <!-- User Guide -->
- <create-website-part name="YSCT-user-guide" title="User Guide">
- <textile-files>
- <filelist dir="${src.dir}">
- <file name="user-guide/overview.textile" />
- <file name="user-guide/installation.textile" />
- <file name="user-guide/editing_statecharts.textile" />
- <file name="user-guide/simulating_statecharts.textile" />
- <file name="user-guide/c-domain.textile" />
- <!-- file name="user-guide/typescript-domain.textile" /-->
- <file name="user-guide/statechart_language.textile" />
- <file name="user-guide/code_generation_intro.textile" />
- <file name="user-guide/code_generation_c.textile" />
- <file name="user-guide/code_generation_cpp.textile" />
- <file name="user-guide/code_generation_java.textile" />
- <file name="user-guide/code_generation_statechart_image.textile" />
- <file name="user-guide/code_generation_custom.textile" />
- <file name="user-guide/generating_code_headless.textile" />
- <file name="user-guide/sctunit.textile" />
- <file name="user-guide/search_and_navigate.textile" />
- <!-- file name="user-guide/glossary.textile" / -->
- </filelist>
- </textile-files>
- <image-files>
- <fileset dir="${src.dir}">
- <include name="user-guide/images/**/*" />
- </fileset>
- </image-files>
- </create-website-part>
- </sequential>
- </target>
- <!-- Creates a certain part of the HTML documentation for the website. -->
- <macrodef name="create-website-part"
- description="Creates a certain part of the HTML documentation for the website.">
- <attribute name="name" />
- <attribute name="title" />
- <element name="textile-files" />
- <element name="image-files" />
- <sequential>
- <!-- The directory for this particular part of the HTML documentation: -->
- <local name="work.dir" />
- <property name="work.dir" location="${website.dir}" />
- <!-- The names of the concatenated documentation files: -->
- <local name="index.textile" />
- <property name="index.textile" value="@{name}.textile" />
- <local name="index.html" />
- <property name="index.html" value="@{name}.html" />
- <!-- Append those source files that make up the particular piece of documentation: -->
- <mkdir dir="${work.dir}" />
- <concat destfile="${work.dir}/${index.textile}"
- append="false"
- overwrite="true"
- encoding="UTF-8"
- outputencoding="UTF-8"
- fixlastline="true"
- binary="false"
- ignoreempty="true">
- <textile-files />
- </concat>
- <!-- Convert textile source files to Hubspot HTML: -->
- <path id="converter.classpath">
- <path refid="org.yakindu.docs.classpath" />
- <path refid="wikitext.all.classpath" />
- </path>
- <java classname="org.yakindu.docs.wikitext.TextileToHubspotConverter"
- classpathref="converter.classpath"
- fork="true"
- dir="${basedir}"
- failonerror="true">
- <arg value="--p1-file" />
- <arg value="${src.dir}/website/p1.htmlf" />
- <arg value="--contents-template-file" />
- <arg value="${src.dir}/website/contents.htmlf" />
- <arg value="--p2-file" />
- <arg value="${src.dir}/website/p2.htmlf" />
- <arg value="--toc-template-file" />
- <arg value="${src.dir}/website/toc.htmlf" />
- <arg value="--p3-file" />
- <arg value="${src.dir}/website/p3.htmlf" />
- <arg value="--input" />
- <arg value="${work.dir}/${index.textile}" />
- <arg value="--output" />
- <arg value="${work.dir}/${index.html}" />
- <arg value="--property" />
- <arg value="${navigation.title}=@{title}" />
- </java>
- <!-- Replace "<pre><code>" durch "<pre class="prettyprint"><code>": -->
- <replaceregexp byline="false"
- flags="g"
- match='<pre><code>'
- replace='<pre class="prettyprint"><code>'>
- <fileset dir="${work.dir}">
- <include name="${index.html}" />
- </fileset>
- </replaceregexp>
- <!-- Replace relative image links by absolute ones for the website, unless we are generating local files: -->
- <replaceregexp byline="false"
- flags="g"
- match='src="images/'
- replace='src="http://info.itemis.com/hubfs/yakindu/statechart-tools/documentation/images/'
- unless:set="website.local.files">
- <fileset dir="${work.dir}">
- <include name="${index.html}" />
- </fileset>
- </replaceregexp>
- <!-- If the generated code contains a table with the ID "updaterepositories", replace it by a
- "call-to-action" button on the website: -->
- <replaceregexp byline="false" flags="s" replace="${website.calltoaction.download}">
- <regexp pattern='<table id="updaterepositories">.*</table>' />
- <fileset dir="${work.dir}">
- <include name="${index.html}" />
- </fileset>
- </replaceregexp>
- <!-- Fix links: -->
- <adjust-website-document-links document.dir.name="tutorials"
- work.dir="${work.dir}"
- html.file="${index.html}" />
- <adjust-website-document-links document.dir.name="user-guide"
- work.dir="${work.dir}"
- html.file="${index.html}" />
- <!-- Fix "pro-feature" elements -->
- <replaceregexp byline="false"
- flags="g"
- match='<p><div class="pro-feature"></p>'
- replace='<div class="pro-feature">'>
- <fileset dir="${work.dir}">
- <include name="${index.html}" />
- </fileset>
- </replaceregexp>
- <replaceregexp byline="false" flags="g" match='<p></div></p>' replace='</div>'>
- <fileset dir="${work.dir}">
- <include name="${index.html}" />
- </fileset>
- </replaceregexp>
- <!-- Copy the CSS files to the destination directory: -->
- <copy todir="${work.dir}/${css.dir}">
- <fileset dir="${css.dir}">
- <include name="*" />
- </fileset>
- </copy>
- <!-- Copy the Javascript files to the destination directory: -->
- <copy todir="${work.dir}/${js.dir}">
- <fileset dir="${js.dir}">
- <include name="*" />
- </fileset>
- </copy>
- <!-- Copy the image files to the destination directory: -->
- <copy todir="${work.dir}/${img.dir}" flatten="yes">
- <image-files />
- </copy>
- <!-- The textile source file is no longer needed in the website directory. Remove it: -->
- <delete includeemptydirs="true" failonerror="false">
- <fileset dir="${website.dir}" defaultexcludes="false">
- <include name="${index.textile}" />
- </fileset>
- </delete>
- </sequential>
- </macrodef>
- <!-- Adjusts links in the generated HTML document for either the website or a local equivalent. -->
- <macrodef name="adjust-website-document-links"
- description="Adjusts links in the generated HTML document for either the website or a local equivalent.">
- <attribute name="work.dir" />
- <attribute name="html.file" />
- <attribute name="document.dir.name" />
- <sequential>
- <replaceregexp byline="false"
- flags="g"
- match='<a href="(\.\./@{document.dir.name})/.+\.html(.*)">'
- replace='<a href="\1/\2">'
- unless:set="website.local.files">
- <fileset dir="@{work.dir}">
- <include name="@{html.file}" />
- </fileset>
- </replaceregexp>
- <replaceregexp byline="false"
- flags="g"
- match='<a href="\.\.(/@{document.dir.name})/.+\.html(.*)">'
- replace='<a href="YSCT-@{document.dir.name}.html\2">'
- if:set="website.local.files">
- <fileset dir="@{work.dir}">
- <include name="@{html.file}" />
- </fileset>
- </replaceregexp>
- </sequential>
- </macrodef>
- </project>
|