Commit 904ddd52 authored by Árpád Lovassy's avatar Árpád Lovassy Committed by GitHub
Browse files

Merge pull request #96 from alovassy/master

removing ant-contrib.jar dependencies from ant build scripts
parents 43c63144 464d777e
...@@ -7,18 +7,9 @@ ...@@ -7,18 +7,9 @@
which accompanies this distribution, and is available at which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html http://www.eclipse.org/legal/epl-v10.html
--> -->
<project basedir="." name="import" xmlns:ac="antlib:net.sf.antcontrib"> <project basedir="." name="import" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="build_config.xml"/> <import file="build_config.xml"/>
<taskdef
uri="antlib:net.sf.antcontrib"
resource="net/sf/antcontrib/antlib.xml"
classpath="${ant-contrib.location}">
<classpath>
<pathelement location="${ant-contrib.location}"/>
</classpath>
</taskdef>
<path id="PDE.classpath"> <path id="PDE.classpath">
<fileset dir="${ECLIPSE_HOME}/plugins"> <fileset dir="${ECLIPSE_HOME}/plugins">
<include name="*.jar"/> <include name="*.jar"/>
...@@ -64,6 +55,75 @@ ...@@ -64,6 +55,75 @@
<echo message="${current.time} @{message}" /> <echo message="${current.time} @{message}" />
</sequential> </sequential>
</macrodef> </macrodef>
<!--
Logging macro for debug purposes.
-->
<macrodef name="log">
<attribute name="message"/>
<sequential>
<!-- Comment in for logging -->
<!--
<timestamp.echo message="@{message}" />
-->
</sequential>
</macrodef>
<!--
Iterates over a list.
List element can be accessed within the <iterate> tags as ${element}
@param list a string, which represents a list, delimiter is ":"
for example: /home/user1/file1.txt:/home/user1/file2.txt:/home/user1/file3.txt
Example usage:
<fileset id = "a" ...>
...
</fileset>
<pathconvert property="list" refid="a" targetos="unix"/>
<iterate list="${list}" unless:blank="${list}">
<echo message="I see:" />
<echo message="${element}" />
</iterate>
Source:
http://stackoverflow.com/questions/1467991/ant-how-to-execute-a-command-for-each-file-in-directory
-->
<macrodef name="iterate">
<attribute name="list" />
<element name="call" implicit="yes" />
<sequential>
<log message="-> iterate( @{list} )"/>
<local name="element" />
<local name="tail" />
<local name="hasMoreElements" />
<!-- unless to not get a error on empty lists -->
<loadresource property="element" unless:blank="@{list}" >
<concat>@{list}</concat>
<filterchain>
<replaceregex pattern="([^:]*).*" replace="\1" />
</filterchain>
</loadresource>
<!-- call the tasks that handle the element -->
<call />
<!-- recursion -->
<condition property="hasMoreElements">
<contains string="@{list}" substring=":" />
</condition>
<loadresource property="tail" if:true="${hasMoreElements}">
<concat>@{list}</concat>
<filterchain>
<replaceregex pattern="[^:]*:(.*)" replace="\1" />
</filterchain>
</loadresource>
<iterate list="${tail}" if:true="${hasMoreElements}">
<call />
</iterate>
</sequential>
</macrodef>
</project> </project>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
which accompanies this distribution, and is available at which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html http://www.eclipse.org/legal/epl-v10.html
--> -->
<project basedir="." default="updatesite.experimental" name="build_main" xmlns:ac="antlib:net.sf.antcontrib"> <project basedir="." default="updatesite.experimental" name="build_main" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="build_import.xml"/> <import file="build_import.xml"/>
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
<attribute name="updatesite.name"/> <attribute name="updatesite.name"/>
<attribute name="updatesite.url"/> <attribute name="updatesite.url"/>
<sequential> <sequential>
<timestamp.echo message="-> build.feature( @{dir}, @{name}, @{updatesite.name}, @{updatesite.url} )" />
<record name="${log.dir}/feature_@{name}.txt" action="start"/> <record name="${log.dir}/feature_@{name}.txt" action="start"/>
<!-- <!--
<cvs cvsRoot="${cvsRoot}" <cvs cvsRoot="${cvsRoot}"
...@@ -138,6 +139,7 @@ ...@@ -138,6 +139,7 @@
<attribute name="updatesite.name"/> <attribute name="updatesite.name"/>
<attribute name="updatesite.url"/> <attribute name="updatesite.url"/>
<sequential> <sequential>
<log message="-> build.features( @{updatesite.name}, @{updatesite.url} )" />
<build.feature dir="TITAN_Designer_feature" <build.feature dir="TITAN_Designer_feature"
name="TITAN_Designer" name="TITAN_Designer"
...@@ -165,16 +167,32 @@ ...@@ -165,16 +167,32 @@
<attribute name="url"/> <attribute name="url"/>
<sequential> <sequential>
<log message="-> build.updatesite( @{site.name}, @{location}, @{url} )" />
<!-- Create the directories for the update site. --> <!-- Create the directories for the update site. -->
<mkdir dir="@{location}/features"/> <mkdir dir="@{location}/features"/>
<mkdir dir="@{location}/plugins"/> <mkdir dir="@{location}/plugins"/>
<!-- Replace the whitespaces with underscores --> <!-- Replace the whitespaces with underscores -->
<ac:propertyregex property="tmp.dir.name" <!-- result will be written in ${tmp.dir.name}, the input @{site.name} is left untouched -->
input="@{site.name}" <exec executable="sed" inputstring="@{site.name}" outputproperty="tmp.dir.name">
regexp=" " <arg value="s/ /_/g"/>
replace="_" </exec>
global="true"/>
<!-- another solution for the same thing -->
<!--
<echo message="@{site.name}" file="site.name.tmp.txt" />
<loadfile property="tmp.dir.name" srcFile="site.name.tmp.txt">
<filterchain>
<tokenfilter>
<replaceregex pattern=" " replace="_" flags="g"/>
</tokenfilter>
</filterchain>
</loadfile>
<delete file="site.name.tmp.txt">
-->
<log message="site.name = @{site.name}" />
<log message="tmp.dir.name = ${tmp.dir.name}" />
<record name="${log.dir}/updatesite_@{site.name}.txt" action="start"/> <record name="${log.dir}/updatesite_@{site.name}.txt" action="start"/>
<!-- build every feature --> <!-- build every feature -->
...@@ -294,30 +312,33 @@ ...@@ -294,30 +312,33 @@
<attribute name="url"/> <attribute name="url"/>
<attribute name="tmp.location"/> <attribute name="tmp.location"/>
<sequential> <sequential>
<log message="-> create.updatesite.tmp( @{site.name}, @{location}, @{url}, @{tmp.location} )" />
<!-- <!--
The update site will be created in the ${result.dir}/update_site_${logname}_tmp location. The update site will be created in the ${result.dir}/update_site_${logname}_tmp location.
If the build fails, the real update site will not be affected. If the build fails, the real update site will not be affected.
--> -->
<timestamp.echo message="Starting to copy the original update site" /> <timestamp.echo message="Starting to copy the original update site" />
<ac:if> <condition property="site.xml.exists">
<available file="@{location}/site.xml"/> <available file="@{location}/site.xml"/>
<then> </condition>
<echo message="@{location}/site.xml exists.(updatesite already exists)"/>
<sync todir="@{tmp.location}" <!-- IF site.xml exists -->
<echo if:set="site.xml.exists" message="@{location}/site.xml exists.(updatesite already exists)"/>
<sync if:set="site.xml.exists" todir="@{tmp.location}"
verbose="true" verbose="true"
failonerror="true" failonerror="true"
overwrite="false" overwrite="false"
includeEmptyDirs="true"> includeEmptyDirs="true">
<fileset dir="@{location}" /> <fileset dir="@{location}" />
</sync> </sync>
</then>
<else> <!-- ELSE -->
<!-- Here we have to create a new updatesite from the scrach <!-- Here we have to create a new updatesite from the scrach
Create the initial site.xml file --> Create the initial site.xml file -->
<mkdir dir="@{tmp.location}/plugins" /> <mkdir unless:set="site.xml.exists" dir="@{tmp.location}/plugins" />
<mkdir dir="@{tmp.location}/features" /> <mkdir unless:set="site.xml.exists" dir="@{tmp.location}/features" />
<echo file="@{tmp.location}/site.xml" <echo unless:set="site.xml.exists" file="@{tmp.location}/site.xml"
message= message=
"&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; "&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;site&gt; &lt;site&gt;
&lt;description url=&quot;@{url}&quot;&gt; &lt;description url=&quot;@{url}&quot;&gt;
...@@ -325,8 +346,6 @@ ...@@ -325,8 +346,6 @@
&lt;/description&gt;/&gt; &lt;/description&gt;/&gt;
&lt;category-def name=&quot;TITAN_on_Eclipse&quot; label=&quot;TITAN_on_Eclipse&quot;/&gt; &lt;category-def name=&quot;TITAN_on_Eclipse&quot; label=&quot;TITAN_on_Eclipse&quot;/&gt;
&lt;/site&gt;"/> &lt;/site&gt;"/>
</else>
</ac:if>
</sequential> </sequential>
</macrodef> </macrodef>
...@@ -403,19 +422,18 @@ ...@@ -403,19 +422,18 @@
<macrodef name="clean.plugin"> <macrodef name="clean.plugin">
<attribute name="name"/> <attribute name="name"/>
<sequential> <sequential>
<ac:if> <condition property="plugin.exists">
<available file="${build.dir}/@{name}"/> <available file="${build.dir}/@{name}"/>
<then> </condition>
<echo message="Calling ant: dir:'${build.dir}/@{name}'${line.separator}
antfile:'${base.dir}/build_@{name}.xml'${line.separator} <echo if:set="plugin.exists" message="Calling ant: dir:'${build.dir}/@{name}'${line.separator}
target: clean"/> antfile:'${base.dir}/build_@{name}.xml'${line.separator}
<ant dir="${build.dir}/@{name}" target: clean"/>
antfile="${base.dir}/build_@{name}.xml" <ant if:set="plugin.exists" dir="${build.dir}/@{name}"
target="clean"> antfile="${base.dir}/build_@{name}.xml"
<property name="build.config" value="${build.config}"/> target="clean">
</ant> <property name="build.config" value="${build.config}"/>
</then> </ant>
</ac:if>
</sequential> </sequential>
</macrodef> </macrodef>
</project> </project>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
which accompanies this distribution, and is available at which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html http://www.eclipse.org/legal/epl-v10.html
--> -->
<project basedir="." default="build" name="org.eclipse.titan.common" xmlns:ac="antlib:net.sf.antcontrib"> <project basedir="." default="build" name="org.eclipse.titan.common">
<import file="build_import.xml" /> <import file="build_import.xml" />
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
</target> </target>
<target name="clean"> <target name="clean">
<delete dir="bin"/> <delete dir="bin"/>
<delete> <delete>
<fileset dir="${antlr.src.dir}" includes="*.java"> <fileset dir="${antlr.src.dir}" includes="*.java">
<present targetdir="${antlr.src.dir}"> <present targetdir="${antlr.src.dir}">
<mapper type="glob" from="*.g" to="*.java" /> <mapper type="glob" from="*.g" to="*.java" />
</present> </present>
</fileset> </fileset>
</delete> </delete>
</target> </target>
<target depends="clean" name="cleanall"/> <target depends="clean" name="cleanall"/>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
http://www.eclipse.org/legal/epl-v10.html http://www.eclipse.org/legal/epl-v10.html
--> -->
<project basedir="." default="build" name="org.eclipse.titan.help" <project basedir="." default="build" name="org.eclipse.titan.help"
xmlns:ac="antlib:net.sf.antcontrib"> xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="build_import.xml"/> <import file="build_import.xml"/>
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<target name="check.doc2pdf.jar"> <target name="check.doc2pdf.jar">
<available file="${doc2pdf.jar}" property="doc2pdf.jar.present"/> <available file="${doc2pdf.jar}" property="doc2pdf.jar.present"/>
<echo message="${doc2pdf.jar} file present? ${doc2pdf.jar.present}" />
</target> </target>
<target name="build.pdf" depends="check.doc2pdf.jar" if="doc2pdf.jar.present"> <target name="build.pdf" depends="check.doc2pdf.jar" if="doc2pdf.jar.present">
...@@ -65,47 +66,80 @@ ...@@ -65,47 +66,80 @@
<macrodef name="build.usrguide"> <macrodef name="build.usrguide">
<attribute name="usrguide.dir"/> <attribute name="usrguide.dir"/>
<sequential> <sequential>
<ac:if> <log message="-> build.usrguide( @{usrguide.dir} )"/>
<equals arg1="${build.help}" arg2="true"/> <condition property="build.help.true">
<then> <istrue value="${build.help}" />
<echo message="Creating userguide pdfs from dir: @{usrguide.dir}"/> </condition>
<log message="build.help = ${build.help}"/>
<fileset id="@{usrguide.dir}.docFiles" dir="@{usrguide.dir}"> <log message="build.help.true = ${build.help.true}"/>
<include name="*.doc"/> <build.usrguide.if.build.help
</fileset> if:set="build.help.true"
usrguide.dir="@{usrguide.dir}" />
<pathconvert property="@{usrguide.dir}.usrguide.list" refid="@{usrguide.dir}.docFiles" targetos="unix"/>
<ac:for list="${@{usrguide.dir}.usrguide.list}" parallel="false" keepgoing="true" param="docFile" delimiter=":">
<sequential>
<ac:propertyregex property="@{docFile}.pdfFileName"
input="@{docFile}"
regexp="([.]*)(\.doc)"
replace="\1.pdf" />
<!--
Set this option below to mark build as failed, if the doc2pdf comes back with an error message:
jvm="${java6}" failonerror="true">
-->
<java jar="${doc2pdf.jar}" timeout="180000" fork="true"
jvm="${java6}" failonerror="false">
<arg value="@{docFile}"/>
<arg value="${@{docFile}.pdfFileName}"/>
</java>
</sequential>
</ac:for>
<copy todir="${build.dir}/${help.name}/docs">
<fileset dir="@{usrguide.dir}">
<include name="*.pdf"/>
</fileset>
</copy>
</then>
</ac:if>
</sequential> </sequential>
</macrodef> </macrodef>
<target name="clean"> <macrodef name="build.usrguide.if.build.help">
<delete dir="bin"/> <attribute name="usrguide.dir"/>
</target> <sequential>
<target depends="clean" name="cleanall"/> <log message="-> build.usrguide.if.build.help( @{usrguide.dir} )"/>
<echo message="Creating userguide pdfs from dir: @{usrguide.dir}"/>
<fileset id="@{usrguide.dir}.docFiles" dir="@{usrguide.dir}">
<include name="*.doc"/>
</fileset>
<pathconvert property="@{usrguide.dir}.usrguide.list" refid="@{usrguide.dir}.docFiles" targetos="unix"/>
<log message="usrguide.dir.usrguide.list = ${@{usrguide.dir}.usrguide.list}"/>
<iterate list="${@{usrguide.dir}.usrguide.list}" unless:blank="${@{usrguide.dir}.usrguide.list}">
<convert.pdf docFile="${element}" />
</iterate>
<copy todir="${build.dir}/${help.name}/docs">
<fileset dir="@{usrguide.dir}">
<include name="*.pdf"/>
</fileset>
</copy>
</sequential>
</macrodef>
<!--
Converts doc file to pdf, new file is created in the same directory
@param docFile the doc filename with full path
-->
<macrodef name="convert.pdf">
<attribute name="docFile"/>
<sequential>
<log message="-> convert.pdf( @{docFile} )"/>
<!-- Create pdf file name from doc filename -->
<!-- result will be written in ${@{docFile}.pdfFile}, the input @{docFile} is left untouched -->
<exec executable="sed" inputstring="@{docFile}" outputproperty="@{docFile}.pdfFile">
<arg value="s/\.doc$/\.pdf/g"/>
</exec>
<log message="docFile = @{docFile}"/>
<log message="docFile.pdfFile = ${@{docFile}.pdfFile}"/>
<!--
Set this option below to mark build as failed, if the doc2pdf comes back with an error message:
jvm="${java6}" failonerror="true">
-->
<!-- Comment out for debug purposes, it is very slow -->
<java jar="${doc2pdf.jar}" timeout="180000" fork="true"
jvm="${java6}" failonerror="false">
<arg value="@{docFile}"/>
<arg value="${@{docFile}.pdfFile}"/>
</java>
<!-- Keep it for debug purposes,
copying doc to pdf is a simple way to have pdf
if pdf conversion is commented out -->
<!--
<copy file="@{docFile}" tofile="${@{docFile}.pdfFile}"/>
-->
</sequential>
</macrodef>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
</project> </project>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment