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 @@
which accompanies this distribution, and is available at
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"/>
<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">
<fileset dir="${ECLIPSE_HOME}/plugins">
<include name="*.jar"/>
......@@ -64,6 +55,75 @@
<echo message="${current.time} @{message}" />
</sequential>
</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>
......@@ -7,7 +7,7 @@
which accompanies this distribution, and is available at
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"/>
......@@ -84,6 +84,7 @@
<attribute name="updatesite.name"/>
<attribute name="updatesite.url"/>
<sequential>
<timestamp.echo message="-> build.feature( @{dir}, @{name}, @{updatesite.name}, @{updatesite.url} )" />
<record name="${log.dir}/feature_@{name}.txt" action="start"/>
<!--
<cvs cvsRoot="${cvsRoot}"
......@@ -138,6 +139,7 @@
<attribute name="updatesite.name"/>
<attribute name="updatesite.url"/>
<sequential>
<log message="-> build.features( @{updatesite.name}, @{updatesite.url} )" />
<build.feature dir="TITAN_Designer_feature"
name="TITAN_Designer"
......@@ -165,16 +167,32 @@
<attribute name="url"/>
<sequential>
<log message="-> build.updatesite( @{site.name}, @{location}, @{url} )" />
<!-- Create the directories for the update site. -->
<mkdir dir="@{location}/features"/>
<mkdir dir="@{location}/plugins"/>
<!-- Replace the whitespaces with underscores -->
<ac:propertyregex property="tmp.dir.name"
input="@{site.name}"
regexp=" "
replace="_"
global="true"/>
<!-- result will be written in ${tmp.dir.name}, the input @{site.name} is left untouched -->
<exec executable="sed" inputstring="@{site.name}" outputproperty="tmp.dir.name">
<arg value="s/ /_/g"/>
</exec>
<!-- 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"/>
<!-- build every feature -->
......@@ -294,30 +312,33 @@
<attribute name="url"/>
<attribute name="tmp.location"/>
<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.
If the build fails, the real update site will not be affected.
-->
<timestamp.echo message="Starting to copy the original update site" />
<ac:if>
<condition property="site.xml.exists">
<available file="@{location}/site.xml"/>
<then>
<echo message="@{location}/site.xml exists.(updatesite already exists)"/>
<sync todir="@{tmp.location}"
</condition>
<!-- 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"
failonerror="true"
overwrite="false"
includeEmptyDirs="true">
<fileset dir="@{location}" />
</sync>
</then>
<else>
<!-- Here we have to create a new updatesite from the scrach
Create the initial site.xml file -->
<mkdir dir="@{tmp.location}/plugins" />
<mkdir dir="@{tmp.location}/features" />
<echo file="@{tmp.location}/site.xml"
message=
<fileset dir="@{location}" />
</sync>
<!-- ELSE -->
<!-- Here we have to create a new updatesite from the scrach
Create the initial site.xml file -->
<mkdir unless:set="site.xml.exists" dir="@{tmp.location}/plugins" />
<mkdir unless:set="site.xml.exists" dir="@{tmp.location}/features" />
<echo unless:set="site.xml.exists" file="@{tmp.location}/site.xml"
message=
"&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;site&gt;
&lt;description url=&quot;@{url}&quot;&gt;
......@@ -325,8 +346,6 @@
&lt;/description&gt;/&gt;
&lt;category-def name=&quot;TITAN_on_Eclipse&quot; label=&quot;TITAN_on_Eclipse&quot;/&gt;
&lt;/site&gt;"/>
</else>
</ac:if>
</sequential>
</macrodef>
......@@ -403,19 +422,18 @@
<macrodef name="clean.plugin">
<attribute name="name"/>
<sequential>
<ac:if>
<condition property="plugin.exists">
<available file="${build.dir}/@{name}"/>
<then>
<echo message="Calling ant: dir:'${build.dir}/@{name}'${line.separator}
antfile:'${base.dir}/build_@{name}.xml'${line.separator}
target: clean"/>
<ant dir="${build.dir}/@{name}"
antfile="${base.dir}/build_@{name}.xml"
target="clean">
<property name="build.config" value="${build.config}"/>
</ant>
</then>
</ac:if>
</condition>
<echo if:set="plugin.exists" message="Calling ant: dir:'${build.dir}/@{name}'${line.separator}
antfile:'${base.dir}/build_@{name}.xml'${line.separator}
target: clean"/>
<ant if:set="plugin.exists" dir="${build.dir}/@{name}"
antfile="${base.dir}/build_@{name}.xml"
target="clean">
<property name="build.config" value="${build.config}"/>
</ant>
</sequential>
</macrodef>
</project>
......
......@@ -7,7 +7,7 @@
which accompanies this distribution, and is available at
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" />
......@@ -32,13 +32,13 @@
</target>
<target name="clean">
<delete dir="bin"/>
<delete>
<fileset dir="${antlr.src.dir}" includes="*.java">
<present targetdir="${antlr.src.dir}">
<mapper type="glob" from="*.g" to="*.java" />
</present>
</fileset>
</delete>
<delete>
<fileset dir="${antlr.src.dir}" includes="*.java">
<present targetdir="${antlr.src.dir}">
<mapper type="glob" from="*.g" to="*.java" />
</present>
</fileset>
</delete>
</target>
<target depends="clean" name="cleanall"/>
......
......@@ -8,7 +8,7 @@
http://www.eclipse.org/legal/epl-v10.html
-->
<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"/>
......@@ -25,6 +25,7 @@
<target name="check.doc2pdf.jar">
<available file="${doc2pdf.jar}" property="doc2pdf.jar.present"/>
<echo message="${doc2pdf.jar} file present? ${doc2pdf.jar.present}" />
</target>
<target name="build.pdf" depends="check.doc2pdf.jar" if="doc2pdf.jar.present">
......@@ -65,47 +66,80 @@
<macrodef name="build.usrguide">
<attribute name="usrguide.dir"/>
<sequential>
<ac:if>
<equals arg1="${build.help}" arg2="true"/>
<then>
<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"/>
<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>
<log message="-> build.usrguide( @{usrguide.dir} )"/>
<condition property="build.help.true">
<istrue value="${build.help}" />
</condition>
<log message="build.help = ${build.help}"/>
<log message="build.help.true = ${build.help.true}"/>
<build.usrguide.if.build.help
if:set="build.help.true"
usrguide.dir="@{usrguide.dir}" />
</sequential>
</macrodef>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<macrodef name="build.usrguide.if.build.help">
<attribute name="usrguide.dir"/>
<sequential>
<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>
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