Author: nickboldt
Date: 2010-04-23 15:35:07 -0400 (Fri, 23 Apr 2010)
New Revision: 21646
Added:
branches/modular_build/build/
branches/modular_build/build/build.xml
branches/modular_build/build/genpom.xml
Log:
move genpom.xml and build.xml into subdir to make bootstrapping easier
Added: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml (rev 0)
+++ branches/modular_build/build/build.xml 2010-04-23 19:35:07 UTC (rev 21646)
@@ -0,0 +1,581 @@
+<!-- TODO move this script into releng/ folder so that it can be checked out via
Hudson -->
+<!-- TODO write wrapper script (./build.xml) which fetches if not avail then simply
calls ./releng/build.xml -->
+
+<!-- Build a given list of ${COMPONENTS} -->
+<project default="run" basedir="." name="jbosstools
build.xml">
+
+ <!-- Configuration Start -->
+ <!-- must set name of component to build/test, IN ORDER -->
+ <property name="COMPONENTS"
+ value="tests, common,
+ flow, jbpm,
+ jmx, archives, as,
+ drools, bpel, smooks, freemarker, profiler, portlet,
+ xulrunner, jst, vpe, jsf,
+ esb, tptp, ws,
+ cdi, struts, hibernatetools, seam,
+ examples, birt,
+ maven"
+ />
+
+ <!-- svn root, including trunk or branch path -->
+ <property name="svn.root"
value="http://anonsvn.jboss.org/repos/jbosstools/branches/modular_bu... />
+
+ <!-- default maven version -->
+ <property name="maven.version" value="3.0-alpha-7" />
+ <!-- Configuration Ends -->
+
+ <!-- To run this script in Eclipse:
+ Run As > Ant Build
+ -->
+ <!-- To run this script via commandline (build default modules & run tests):
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant
+ or, to build everything but not *run* the tests:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant
-DMAVEN_FLAGS="-Dmaven.test.skip"
+ or, to build specific module(s):
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant
-DCOMPONENTS=tests,common,flow,jbpm
+ -->
+
+ <target name="run" depends="init, get.bootstrap.scripts, get.sources,
genpoms, install" />
+
+ <!-- override for local build -->
+ <condition property="isInHudson" value="true">
+ <or>
+ <contains string="${user.dir}" substring="hudson" />
+ <contains string="${user.name}" substring="hudson" />
+ <contains string="${user.home}" substring="hudson" />
+ </or>
+ </condition>
+ <target name="local" unless="isInHudson">
+ <property name="WORKINGDIR" value="${basedir}" />
+ <property name="COMMON_TOOLS" value="${java.io.tmpdir}" />
+ </target>
+
+ <target name="get.ant-contrib"
unless="ant-contrib.jar.exists">
+ <property name="ANTCONTRIB_MIRROR"
value="http://downloads.sourceforge.net/ant-contrib/" />
+ <get usetimestamp="true"
+ dest="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip"
+ src="${ANTCONTRIB_MIRROR}/ant-contrib-1.0b2-bin.zip"
+ />
+ <touch file="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip" />
+ <mkdir dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" />
+ <unzip src="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip"
+ dest="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_"
+ overwrite="true"
+ />
+ <copy
file="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_/ant-contrib/lib/ant-contrib.jar"
+ tofile="${COMMON_TOOLS}/ant-contrib.jar"
+ failonerror="true"
+ />
+ <delete dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_"
includeemptydirs="true" quiet="true" />
+ </target>
+
+ <target name="get.svnant" unless="svnant.jar.exists">
+ <property name="SVNANT_MIRROR"
value="http://www.tigris.org/files/documents/906/46267" />
+ <!-- ant <get> does not work due to redirection; on Windows just download this
file manually -->
+ <exec executable="wget" dir="${COMMON_TOOLS}">
+ <arg line="${SVNANT_MIRROR}/svnant-1.3.0.zip --no-clobber" />
+ </exec>
+ <touch file="${COMMON_TOOLS}/svnant-1.3.0.zip" />
+ <mkdir dir="${java.io.tmpdir}/svnant-1.3.0.zip_" />
+ <unzip src="${COMMON_TOOLS}/svnant-1.3.0.zip"
dest="${java.io.tmpdir}/svnant-1.3.0.zip_" overwrite="true" />
+ <copy todir="${COMMON_TOOLS}" failonerror="true">
+ <fileset dir="${java.io.tmpdir}/svnant-1.3.0.zip_/svnant-1.3.0/lib/"
includes="*.jar" />
+ </copy>
+ <delete dir="${java.io.tmpdir}/svnant-1.3.0.zip_"
includeemptydirs="true" quiet="true" />
+ </target>
+
+ <target name="init" depends="local">
+ <property name="WORKINGDIR" value="${basedir}" />
+ <!--
https://jira.jboss.org/jira/browse/JBQA-3313 Use static, shared space outside
workspace, instead of working directly in the workspace -->
+ <condition property="WORKINGDIR"
value="/home/hudson/static_build_env/jbds/tools/sources"
else="${basedir}">
+ <available file="/home/hudson/static_build_env/jbds" type="dir"
/>
+ </condition>
+ <mkdir dir="${WORKINGDIR}" />
+ <echo level="info">WORKINGDIR = ${WORKINGDIR}</echo>
+
+ <condition property="COMMON_TOOLS"
+ value="/home/hudson/static_build_env/jbds/tools"
+ else="${WORKINGDIR}/../tools"
+ >
+ <available file="/home/hudson/static_build_env/jbds" type="dir"
/>
+ </condition>
+ <mkdir dir="${COMMON_TOOLS}" />
+ <echo level="info">COMMON_TOOLS = ${COMMON_TOOLS}</echo>
+
+ <available file="${COMMON_TOOLS}/ant-contrib.jar" type="file"
property="ant-contrib.jar.exists" />
+ <antcall target="get.ant-contrib" />
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+ <pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
+ </classpath>
+ </taskdef>
+
+ <available file="${COMMON_TOOLS}/svnant.jar" type="file"
property="svnant.jar.exists" />
+ <antcall target="get.svnant" />
+ <taskdef resource="org/tigris/subversion/svnant/svnantlib.xml">
+ <classpath>
+ <pathelement location="${COMMON_TOOLS}/svnant.jar" />
+ <pathelement location="${COMMON_TOOLS}/svnkit.jar" />
+ <pathelement location="${COMMON_TOOLS}/svnClientAdapter.jar" />
+ </classpath>
+ </taskdef>
+
+ <property name="MAVEN_MIRROR"
value="http://mirror.csclub.uwaterloo.ca/apache/maven/binaries" />
+ <get usetimestamp="true"
+ dest="${COMMON_TOOLS}/apache-maven-${maven.version}-bin.tar.gz"
+ src="${MAVEN_MIRROR}/apache-maven-${maven.version}-bin.tar.gz"
+ />
+ <untar compression="gzip"
+ overwrite="false"
+ dest="${COMMON_TOOLS}"
+ src="${COMMON_TOOLS}/apache-maven-${maven.version}-bin.tar.gz"
+ />
+ <chmod perm="755"
file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn" />
+ </target>
+
+ <target name="get.sources" description="if sources not already on
disk, fetch them">
+ <property name="svn.recurse" value="true" />
+
+ <!-- = = = = = = = = = = = = = = = = =
+ COMPONENT: component to fetch or update
+ op: up (update) or co (checkout)
+ = = = = = = = = = = = = = = = = = -->
+ <macrodef name="svn.fetch">
+ <attribute name="COMPONENT" />
+ <attribute name="op" />
+ <sequential>
+ <!-- check out or update -->
+ <if>
+ <equals arg1="@{op}" arg2="up" />
+ <then>
+ <svn javahl="false" svnkit="true">
+ <update recurse="${svn.recurse}" dir="@{COMPONENT}" />
+ </svn>
+ </then>
+ <else>
+ <echo level="info">Fetch sources from ${svn.root}/@{COMPONENT} into
${WORKINGDIR}/@{COMPONENT}</echo>
+ <svn javahl="false" svnkit="true">
+ <checkout recurse="${svn.recurse}"
+ url="${svn.root}/@{COMPONENT}"
+ destpath="${WORKINGDIR}/@{COMPONENT}"
+ />
+ </svn>
+ </else>
+ </if>
+
+ <!-- Store svn info so we can compare it later and thus not need to update or
checkout every time -->
+ <svn javahl="false" svnkit="true">
+ <info target="@{COMPONENT}"
propprefix="svn.info.@{COMPONENT}" />
+ </svn>
+ <echo file="svn.info-@{COMPONENT}.txt">svn.info.(a){COMPONENT}.rev =
${svn.info.(a){COMPONENT}.rev}
+</echo>
+ <echo file="build.cfg" message="@{COMPONENT},"
append="true" />
+ </sequential>
+ </macrodef>
+
+ <!-- check for each component dir in ${WORKINGDIR}; if not found, fetch -->
+ <echo file="build.cfg" message="COMPONENTS.to.build = " />
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=",
+ ">
+ <sequential>
+ <if>
+ <not>
+ <available file="${WORKINGDIR}/@{COMPONENT}" type="dir"
/>
+ </not>
+ <then>
+ <svn.fetch component="@{COMPONENT}" op="co" />
+ </then>
+ <else>
+ <if>
+ <available file="svn.info-(a){COMPONENT}.txt" type="file"
/>
+ <then>
+ <property file="svn.info-(a){COMPONENT}.txt" />
+ <!-- check svn info; if new version found, svn up -->
+ <svn javahl="false" svnkit="true">
+ <info target="@{COMPONENT}"
propprefix="svn.info.(a){COMPONENT}.check" />
+ </svn>
+ <if>
+ <not>
+ <equals arg1="${svn.info.(a){COMPONENT}.rev}"
+ arg2="${svn.info.(a){COMPONENT}.check.rev}"
+ />
+ </not>
+ <then>
+ <svn.fetch component="@{COMPONENT}" op="up" />
+ </then>
+ <else>
+ <if>
+ <and>
+ <isset property="build.if.sources.unchanged" />
+ <istrue value="${build.if.sources.unchanged}" />
+ </and>
+ <then>
+ <echo file="build.cfg" message="@{COMPONENT},"
append="true" />
+ </then>
+ </if>
+ </else>
+ </if>
+ </then>
+ <else>
+ <svn.fetch component="@{COMPONENT}" op="up" />
+ </else>
+ </if>
+ </else>
+ </if>
+ </sequential>
+ </for>
+
+ </target>
+
+ <target name="get.bootstrap.scripts">
+ <!-- also get files required to bootstrap the build -->
+ <for param="BOOTSTRAP" list="parent-pom.xml, genpom.xml,
build.xml" delimiter=",
+">
+ <sequential>
+ <get src="${svn.root}/@{BOOTSTRAP}"
dest="${WORKINGDIR}/@{BOOTSTRAP}" usetimestamp="true" />
+ </sequential>
+ </for>
+ </target>
+
+ <target name="get.components.to.build">
+ <property file="build.cfg" />
+ <var name="COMPONENTS" unset="true" />
+ <property name="COMPONENTS" value="${COMPONENTS.to.build}"
/>
+ <echo level="debug">Got COMPONENTS = ${COMPONENTS}</echo>
+ </target>
+
+ <target name="genpoms">
+ <antcallback target="get.components.to.build"
return="COMPONENTS" />
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=",
+ ">
+ <sequential>
+ <!-- If poms already exist, DO NOT OVERWRITE unless
overwrite.existing.pom.xml=true -->
+ <ant antfile="genpom.xml" target="run">
+ <property name="COMPONENT" value="@{COMPONENT}" />
+ </ant>
+ </sequential>
+ </for>
+ </target>
+
+ <target name="install">
+ <!-- if not running genpom, make sure you call this to filter out unchanged sources
from build -->
+ <!-- <antcallback target="get.components.to.build"
return="COMPONENTS"/> -->
+
+ <!-- could set -Dmaven.test.skip to skip tests, etc. -->
+ <property name="MAVEN_FLAGS" value="" />
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=",
+ ">
+ <sequential>
+ <echo level="verbose">Exe:
${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn</echo>
+ <echo level="verbose">Pom:
${WORKINGDIR}/(a){COMPONENT}/pom.xml</echo>
+ <exec
executable="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn"
+ dir="${WORKINGDIR}/@{COMPONENT}"
+ failifexecutionfails="true"
+ failonerror="true"
+ timeout="10800000"
+ >
+ <env key="M2_HOME"
value="${COMMON_TOOLS}/apache-maven-${maven.version}" />
+ <env key="MAVEN_OPTS" value="-Xms512m -Xmx1024m -XX:PermSize=128m
-XX:MaxPermSize=256m" />
+ <!-- more debug output with <env key="MAVEN_OPTS"
value="-Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/> -->
+ <!-- <arg line="-o -Dmaven.test.skip" /> -->
+ <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository
-B -fae clean install" />
+ </exec>
+ </sequential>
+ </for>
+ </target>
+
+ <!-- TODO: generate site.xml files for components: gensite.xml script called by
build.xml -->
+ <!-- TODO: zip up update site zips for each component; publish to
download.jboss.org
as part of deploy task -->
+ <target name="zip.sites">
+
+ </target>
+
+ <target name="deploy">
+ <!-- TODO enable publishing to
download.jboss.org or
porkchop.jboss.com -->
+ <property name="DESTINATION.jbosstools"
value="filemgmt.jboss.org/downloads_htdocs/tools/repository/" />
+ <property name="DESTINATION.jbds"
value="/qa/services/http/binaries/RHDS/repository/" />
+
+ <echo level="debug">Promote build in ${sourceZipsDirActual}
...</echo>
+ <for param="aDir" list="${sourceZipsDirActual}"
delimiter=",
+">
+ <sequential>
+ <!-- rsync or copy build dir @{aDir} into ${targetZipsDir}/ -->
+ <if>
+ <available file="/usr/bin/rsync" type="file" />
+ <then>
+ <var name="rsyncCmd"
+ value="/usr/bin/rsync -a${synchMethodParam} --exclude=eclipse/ @{aDir}
${targetZipsDir}/"
+ />
+ <echo message="${rsyncCmd}" />
+ <exec executable="bash">
+ <arg line=" -c "${rsyncCmd}"" />
+ </exec>
+ <var name="rsyncCmd" unset="true" />
+ </then>
+ <else>
+ <propertyregex override="true"
+ property="aBuildDir"
+ defaultvalue="@{aDir}"
+ input="@{aDir}"
+ regexp=".+/([^/]+)"
+ replace="\1"
+ />
+ <echo>Copy ${aBuildDir} into ${targetZipsDir}/</echo>
+ <mkdir dir="${targetZipsDir}/${aBuildDir}" />
+ <copy todir="${targetZipsDir}/${aBuildDir}"
+ includeemptydirs="true"
+ preservelastmodified="true"
+ failonerror="true"
+ >
+ <fileset dir="@{aDir}" excludes="eclipse/" />
+ </copy>
+ </else>
+ </if>
+
+ <!-- unpack update zip(s) -->
+ <if>
+ <and>
+ <isset property="targetUpdateDir" />
+ <not>
+ <equals arg1="${targetUpdateDir}" arg2="" />
+ </not>
+ </and>
+ <then>
+ <for param="anUpdateZip">
+ <path>
+ <fileset dir="@{aDir}" includes="*-Update-*.zip" />
+ </path>
+ <sequential>
+ <unzip dest="${targetUpdateDir}/"
+ src="@{anUpdateZip}"
+ overwrite="${unzipMethodParam}"
+ />
+ <for param="subdir">
+ <path>
+ <dirset dir="${targetUpdateDir}/" />
+ </path>
+ <sequential>
+ <copy file="staticDropFiles/index.php" todir="@{subdir}"
/>
+ </sequential>
+ </for>
+ </sequential>
+ </for>
+ </then>
+ </if>
+ </sequential>
+ </for>
+ <!--
+ <get usetimestamp="true"
+ dest="${COMMON_TOOLS}/maven-ant-tasks-2.1.0.jar"
+ src="${MAVEN_MIRROR}/maven-ant-tasks-2.1.0.jar"
+ />
+ <taskdef resource="org/apache/maven/artifact/ant/antlib.xml">
+ <classpath>
+ <pathelement location="${COMMON_TOOLS}/maven-ant-tasks-2.1.0.jar" />
+ </classpath>
+ </taskdef>
+ <install-provider artifactId="wagon-ssh"
version="1.0-beta-2"/>
+ <deploy>
+
+ <remoteRepository url="scp://${DESTINATION}">
+ <authentication username="tools"
privateKey="${user.home}/.ssh/id_rsa" />
+ </remoteRepository>
+ <pom refid="mypom" />
+ </deploy>
+ -->
+ </target>
+
+ <!-- ************************************ TESTS ************************************
-->
+
+ <target name="test.expected.values">
+ <property name="ant.enable.asserts" value="true" />
+
+ <!-- expected values for get.sources.* tests -->
+ <property name="get.sources.expected.dirs"
value="tests,common,xulrunner," />
+ <property name="get.sources.expected.files" value="build.cfg"
/>
+
+ <!-- expected values for test.get.sources.build.updated.only tests -->
+ <property name="get.components.to.build.expected.2"
value="tests,common,xulrunner," />
+ <property name="get.components.to.build.expected.4"
value="tests,xulrunner," />
+ <property name="get.components.to.build.expected.6" value=""
/>
+
+ <!-- expected values for test.get.sources.build.all tests -->
+ <property name="get.components.to.build.expected.2.all"
value="tests,common,xulrunner," />
+ <property name="get.components.to.build.expected.4.all"
value="tests,common,xulrunner," />
+ <property name="get.components.to.build.expected.6.all"
value="tests,common,xulrunner," />
+
+ </target>
+
+ <target name="test.all">
+ <antcall target="test.get.sources.build.all" />
+ <antcall target="test.get.sources" />
+ <antcall target="test.deploy" />
+ </target>
+
+ <target name="test.get.sources.build.all"
+ depends="init, test.expected.values"
+ description="verify get.sources works to fetch, then update; verify all
components will be built"
+ >
+ <var name="build.if.sources.unchanged" value="true" />
+ <var name="get.components.to.build.expected.2" unset="true"
/>
+ <var name="get.components.to.build.expected.4" unset="true"
/>
+ <var name="get.components.to.build.expected.6" unset="true"
/>
+ <var name="get.components.to.build.expected.2"
value="${get.components.to.build.expected.2.all}" />
+ <var name="get.components.to.build.expected.4"
value="${get.components.to.build.expected.4.all}" />
+ <var name="get.components.to.build.expected.6"
value="${get.components.to.build.expected.6.all}" />
+ <antcall target="test.get.sources" />
+ </target>
+
+ <target name="test.get.sources"
+ depends="init, test.expected.values"
+ description="verify get.sources works to fetch, then update; verify if
components are not updated, they will not be built"
+ >
+ <var name="COMPONENTS" unset="true" />
+ <var name="COMPONENTS" value="${get.sources.expected.dirs}"
/>
+
+ <!-- for testing purposes, do not recurse (otherwise will have to download 100s of
Mb of data -->
+ <var name="svn.recurse" unset="true" />
+ <var name="svn.recurse" value="false" />
+
+ <!-- cleanup before test -->
+ <for param="expected.dir" list="${get.sources.expected.dirs}"
delimiter=",
+ ">
+ <sequential>
+ <delete dir="(a){expected.dir}" includeemptydirs="true" />
+ <delete file="svn.info-(a){expected.dir}.txt" />
+ </sequential>
+ </for>
+ <for param="expected.file" list="${get.sources.expected.files}"
delimiter=",
+ ">
+ <sequential>
+ <delete file="(a){expected.file}" />
+ </sequential>
+ </for>
+
+ <echo level="info">----------------------------------</echo>
+ <echo level="info">
+1/6: Test checkout</echo>
+ <antcall target="get.sources" />
+ <for param="expected.dir" list="${get.sources.expected.dirs}"
delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="false" message="Dir @{expected.dir} not
found!">
+ <bool>
+ <available file="(a){expected.dir}" type="dir" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <for param="expected.file" list="${get.sources.expected.files}"
delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="false" message="Dir @{expected.file} not
found!">
+ <bool>
+ <available file="(a){expected.file}" type="file" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+2/6: Test build.cfg</echo>
+ <var name="COMPONENTS" unset="true" />
+ <antcallback target="get.components.to.build"
return="COMPONENTS" />
+ <assert failonerror="false"
+ message="expected: [${get.components.to.build.expected.2}] but got:
[${COMPONENTS}]"
+ >
+ <bool>
+ <equals arg1="${get.components.to.build.expected.2}"
arg2="${COMPONENTS}" />
+ </bool>
+ </assert>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+3/6: Test update</echo>
+ <delete file="svn.info-tests.txt" />
+ <delete file="svn.info-xulrunner.txt" />
+ <antcall target="get.sources" />
+ <for param="expected.dir" list="${get.sources.expected.dirs}"
delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="false" message="Dir @{expected.dir} not
found!">
+ <bool>
+ <available file="(a){expected.dir}" type="dir" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <for param="expected.file" list="${get.sources.expected.files}"
delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="false" message="Dir @{expected.file} not
found!">
+ <bool>
+ <available file="(a){expected.file}" type="file" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+4/6: Test build.cfg</echo>
+ <var name="COMPONENTS" unset="true" />
+ <antcallback target="get.components.to.build"
return="COMPONENTS" />
+ <assert failonerror="false"
+ message="expected: [${get.components.to.build.expected.4}] but got:
[${COMPONENTS}]"
+ >
+ <bool>
+ <equals arg1="${get.components.to.build.expected.4}"
arg2="${COMPONENTS}" />
+ </bool>
+ </assert>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+5/6: Test info w/o update</echo>
+ <antcall target="get.sources" />
+ <for param="expected.dir" list="${get.sources.expected.dirs}"
delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="false" message="Dir @{expected.dir} not
found!">
+ <bool>
+ <available file="(a){expected.dir}" type="dir" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <for param="expected.file" list="${get.sources.expected.files}"
delimiter=",
+ ">
+ <sequential>
+ <assert failonerror="false" message="Dir @{expected.file} not
found!">
+ <bool>
+ <available file="(a){expected.file}" type="file" />
+ </bool>
+ </assert>
+ </sequential>
+ </for>
+ <echo level="info">----------------------------------</echo>
+
+ <echo level="info">
+6/6: Test build.cfg</echo>
+ <var name="COMPONENTS" unset="true" />
+ <antcallback target="get.components.to.build"
return="COMPONENTS" />
+ <assert failonerror="false"
+ message="expected: [${get.components.to.build.expected.6}] but got:
[${COMPONENTS}]"
+ >
+ <bool>
+ <equals arg1="${get.components.to.build.expected.6}"
arg2="${COMPONENTS}" />
+ </bool>
+ </assert>
+ <echo level="info">----------------------------------</echo>
+ </target>
+
+ <!-- TODO: fixme -->
+ <target name="test.deploy" depends="init,
test.expected.values">
+ <antcall target="deploy">
+ <param name="targetZipsDir"
value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository/" />
+ </antcall>
+ </target>
+
+</project>
Added: branches/modular_build/build/genpom.xml
===================================================================
--- branches/modular_build/build/genpom.xml (rev 0)
+++ branches/modular_build/build/genpom.xml 2010-04-23 19:35:07 UTC (rev 21646)
@@ -0,0 +1,1000 @@
+<project default="run" basedir="." name="jbosstools
genpom.xml">
+ <!-- Configuration Start -->
+ <property name="projectName" value="org.jboss.tools" />
+ <property name="pathToParentPom" value="" />
+ <property name="COMPONENT" value="trunk" />
+ <property name="pomVersion" value="0.0.1-SNAPSHOT" />
+ <property name="dirsToExclude"
+ value="**/*.sdk.*, **/doc*, **/releng/**, **/build/**,
**/download.jboss.org, **/sampleprojects/**, **/util/**, **/test, **/builders, **/contrib,
**/releng/**, ."
+ />
+ <property name="overwrite.existing.pom.xml" value="false" />
+ <!-- Configuration Ends -->
+
+ <!-- To run this script in Eclipse:
+ Run As > Ant Build
+ -->
+ <!-- To run this script via commandline:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -f genpom.xml -q
+ or, to build a specific module IFF no poms already exist:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; \
+ ant -f genpom.xml -q -DCOMPONENT=xulrunner
+ or, to build a specific module and overwrite existing pom.xml files:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; \
+ ant -f genpom.xml -q -DCOMPONENT=common -Doverwrite.existing.pom.xml=true
+ -->
+
+ <target name="get.ant-contrib"
unless="ant-contrib.jar.exists">
+ <property name="ANTCONTRIB_MIRROR"
value="http://downloads.sourceforge.net/ant-contrib/" />
+ <get usetimestamp="true"
+ dest="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip"
+ src="${ANTCONTRIB_MIRROR}/ant-contrib-1.0b2-bin.zip"
+ />
+ <touch file="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip" />
+ <mkdir dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_" />
+ <unzip src="${COMMON_TOOLS}/ant-contrib-1.0b2-bin.zip"
+ dest="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_"
+ overwrite="true"
+ />
+ <copy
file="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_/ant-contrib/lib/ant-contrib.jar"
+ tofile="${COMMON_TOOLS}/ant-contrib.jar"
+ failonerror="true"
+ />
+ <delete dir="${java.io.tmpdir}/ant-contrib-1.0b2-bin.zip_"
includeemptydirs="true" quiet="true" />
+ </target>
+
+ <!-- override for local build -->
+ <available file="/qa/tools/opt" type="dir"
property="isJBossQA" />
+ <target name="local" unless="isJBossQA">
+ <property name="WORKINGDIR" value="${basedir}" />
+ <property name="COMMON_TOOLS" value="${java.io.tmpdir}" />
+ </target>
+
+ <target name="init" depends="local">
+ <available file="${COMMON_TOOLS}/ant-contrib.jar" type="file"
property="ant-contrib.jar.exists" />
+ <antcall target="get.ant-contrib" />
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+ <pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
+ </classpath>
+ </taskdef>
+
+ <!-- = = = = = = = = = = = = = = = = =
+ macrodef: write out a pom.xml which aggregates subdirs
+ = = = = = = = = = = = = = = = = = -->
+ <macrodef name="writeAggregatePom">
+ <attribute name="dir" default="." />
+ <attribute name="parentpom" />
+ <attribute name="artifactId" default="" />
+ <attribute name="artifactVersion" default="" />
+ <sequential>
+ <if>
+ <equals arg1="@{artifactId}" arg2="" />
+ <then>
+ <var name="artifactId" unset="true" />
+ <antcallback target="getArtifactId" return="artifactId">
+ <property name="dir" value="@{dir}" />
+ </antcallback>
+ </then>
+ <else>
+ <var name="artifactId" value="@{artifactId}" />
+ </else>
+ </if>
+ <if>
+ <equals arg1="@{artifactVersion}" arg2="" />
+ <then>
+ <var name="artifactVersion" unset="true" />
+ <antcallback target="getArtifactVersion"
return="artifactVersion">
+ <property name="dir" value="@{dir}" />
+ </antcallback>
+ </then>
+ <else>
+ <var name="artifactVersion" value="@{artifactVersion}"
/>
+ </else>
+ </if>
+ <var name="artifactType" value="pom" />
+ <propertyregex property="activeDir"
+ input="@{dir}"
+ defaultvalue="@{dir}"
+ regexp="${WORKINGDIR}/"
+ replace=""
+ casesensitive="true"
+ override="true"
+ />
+ <echo level="verbose"> Agg dir: ${activeDir}, artifactType:
${artifactType}, artifactId: ${artifactId}, artifactVersion: ${artifactVersion},
parentpom: @{parentpom}</echo>
+ <if>
+ <or>
+ <not>
+ <available file="(a){dir}/pom.xml" type="file" />
+ </not>
+ <istrue value="${overwrite.existing.pom.xml}" />
+ </or>
+ <then>
+ <echo file="(a){dir}/pom.xml">&lt;project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <relativePath>@{parentpom}</relativePath>
+ <groupId>${projectName}</groupId>
+ <artifactId>${projectName}.parent.pom</artifactId>
+ <version>${pomVersion}</version>
+ </parent>
+ <groupId>${projectName}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${artifactVersion}</version>
+ <packaging>${artifactType}</packaging>
+ <modules>
+</echo>
+ <var name="artifactId" unset="true" />
+ <var name="artifactVersion" unset="true" />
+ <for param="subdir" delimiter=",
+ ">
+ <path>
+ <dirset dir="@{dir}" excludes="${dirsToExclude}"
includes="*" />
+ </path>
+ <sequential>
+ <basename property="subdirSuffix" file="@{subdir}" />
+ <echo file="(a){dir}/pom.xml"
append="true"> <module>${subdirSuffix}</module>
+</echo>
+ <var name="subdirSuffix" unset="true" />
+ </sequential>
+ </for>
+ <echo file="(a){dir}/pom.xml"
append="true"> </modules>
+</project>
+ </echo>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!-- = = = = = = = = = = = = = = = = =
+ macrodef: write out a pom.xml for a plugin or feature or test
+ = = = = = = = = = = = = = = = = = -->
+ <macrodef name="writeModulePom">
+ <attribute name="dir" default="." />
+ <attribute name="parentpom" />
+ <sequential>
+ <var name="artifactType" unset="true" />
+ <antcallback target="getArtifactType"
return="artifactType">
+ <property name="dir" value="@{dir}" />
+ </antcallback>
+ <if>
+ <equals arg1="${artifactType}" arg2="eclipse-update-site"
/>
+ <then>
+ <var name="artifactId" unset="true" />
+ <basename property="artifactId" file="@{dir}" />
+ <var name="artifactVersion" value="${pomVersion}" />
+ </then>
+ <else>
+ <var name="artifactId" unset="true" />
+ <antcallback target="getArtifactId" return="artifactId">
+ <property name="dir" value="@{dir}" />
+ </antcallback>
+ <var name="artifactVersion" unset="true" />
+ <antcallback target="getArtifactVersion"
return="artifactVersion">
+ <property name="dir" value="@{dir}" />
+ </antcallback>
+ <var name="artifactOs" unset="true" />
+ <var name="artifactWs" unset="true" />
+ <var name="artifactArch" unset="true" />
+ <antcallback target="getArtifactOsWsArch" return="artifactOs,
artifactWs, artifactArch">
+ <property name="artifactId" value="${artifactId}" />
+ </antcallback>
+ </else>
+ </if>
+ <propertyregex property="activeDir"
+ input="@{dir}"
+ defaultvalue="@{dir}"
+ regexp="${WORKINGDIR}/"
+ replace=""
+ casesensitive="true"
+ override="true"
+ />
+ <echo level="verbose"> Mod dir: ${activeDir}, artifactType:
${artifactType}, artifactId: ${artifactId}, artifactVersion: ${artifactVersion},
parentpom: @{parentpom}</echo>
+ <if>
+ <or>
+ <not>
+ <available file="(a){dir}/pom.xml" type="file" />
+ </not>
+ <istrue value="${overwrite.existing.pom.xml}" />
+ </or>
+ <then>
+ <echo file="(a){dir}/pom.xml">&lt;project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <relativePath>@{parentpom}</relativePath>
+ <groupId>${projectName}</groupId>
+ <artifactId>${projectName}.parent.pom</artifactId>
+ <version>${pomVersion}</version>
+ </parent>
+ <groupId>${projectName}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${artifactVersion}</version>
+ <packaging>${artifactType}</packaging>
+</echo>
+ <if>
+ <or>
+ <and>
+ <isset property="artifactOs" />
+ <not>
+ <equals arg1="" arg2="${artifactOs}" />
+ </not>
+ </and>
+ <and>
+ <isset property="artifactWs" />
+ <not>
+ <equals arg1="" arg2="${artifactWs}" />
+ </not>
+ </and>
+ <and>
+ <isset property="artifactArch" />
+ <not>
+ <equals arg1="" arg2="${artifactArch}" />
+ </not>
+ </and>
+ </or>
+ <then>
+ <echo file="(a){dir}/pom.xml"
append="true"> <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tychoVersion}</version>
+ <configuration>
+ <resolver>p2</resolver>
+ <environments>
+ <environment>
+ <os>${artifactOs}</os>
+ <ws>${artifactWs}</ws>
+ <arch>${artifactArch}</arch>
+ </environment>
+ </environments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</echo>
+ </then>
+ </if>
+ <echo file="(a){dir}/pom.xml"
append="true"></project>
+</echo>
+ </then>
+ </if>
+ <var name="artifactId" unset="true" />
+ <var name="artifactVersion" unset="true" />
+ <var name="artifactType" unset="true" />
+ <var name="artifactOs" unset="true" />
+ <var name="artifactWs" unset="true" />
+ <var name="artifactArch" unset="true" />
+ <var name="modulecountstring" value="${modulecountstring}1"
/>
+ </sequential>
+ </macrodef>
+
+ <!-- = = = = = = = = = = = = = = = = =
+ macrodef: generateAggregator
+ = = = = = = = = = = = = = = = = = -->
+ <macrodef name="generateAggregator">
+ <attribute name="dir" default="${WORKINGDIR}" />
+ <attribute name="parentPom"
default="${pathToParentPom}parent-pom.xml" />
+ <attribute name="artifactId" default="" />
+ <attribute name="artifactVersion" default="" />
+ <sequential>
+ <writeAggregatePom dir="@{dir}"
+ parentpom="@{parentpom}"
+ artifactId="@{artifactId}"
+ artifactVersion="@{artifactVersion}"
+ />
+
+ <dump dir="@{dir}"
+ parentpom="@{parentpom}"
+ artifactId="@{artifactId}"
+ artifactVersion="@{artifactVersion}"
+ />
+ <var name="aggregatorcountstring"
value="${aggregatorcountstring}1" />
+
+ </sequential>
+ </macrodef>
+
+
+ <!-- = = = = = = = = = = = = = = = = =
+ macrodef: dump
+ = = = = = = = = = = = = = = = = = -->
+ <macrodef name="dump">
+ <attribute name="dir" />
+ <attribute name="parentpom" />
+ <attribute name="artifactId" default="" />
+ <attribute name="artifactVersion" default="" />
+ <sequential>
+ <if>
+ <equals arg1="${COMPONENT}" arg2="trunk" />
+ <then>
+ <path id="trunkDir">
+ <dirset dir="@{dir}" excludes="${dirsToExclude}"
includes="*" />
+ </path>
+ </then>
+ <else>
+ <path id="trunkDir">
+ <dirset dir="@{dir}/${pathToParentPom}"
+ excludes="${dirsToExclude}"
+ includes="${COMPONENT}/*/*, ${COMPONENT}/plugins,
${COMPONENT}/features, ${COMPONENT}/tests, ${COMPONENT}/site"
+ />
+ </path>
+ </else>
+ </if>
+ <for param="subdir" delimiter=",
+ ">
+ <path refid="trunkDir" />
+ <sequential>
+ <echo level="debug">@{subdir}</echo>
+ <var name="aggregate" value="false" />
+ <if>
+ <or>
+ <!-- a plugin, feature, or update site dir -->
+ <available file="(a){subdir}/META-INF/MANIFEST.MF"
type="file" />
+ <available file="(a){subdir}/feature.xml" type="file" />
+ <available file="(a){subdir}/site.xml" type="file" />
+ </or>
+ <then>
+ <!-- valid place to create a pom -->
+ <writeModulePom dir="@{subdir}"
parentpom="../${pathToParentPom}@{parentpom}" />
+ </then>
+ <else>
+ <for list="plugins tests features site" param="type"
delimiter=" ">
+ <sequential>
+ <basename property="artifactIdAgg" file="@{subdir}"
/>
+ <if>
+ <available file="@{subdir}/@{type}" type="dir" />
+ <then>
+ <var name="aggregate" value="true" />
+ <generateAggregator dir="@{subdir}/@{type}"
+
parentpom="../../${pathToParentPom}@{parentpom}"
+ artifactId="${artifactIdAgg}.@{type}"
+ artifactVersion="@{artifactVersion}"
+ />
+ </then>
+ </if>
+ <var name="artifactIdAgg" unset="true" />
+ </sequential>
+ </for>
+
+ <if>
+ <istrue value="${aggregate}" />
+ <else>
+ <basename property="artifactIdAgg" file="@{subdir}"
/>
+ <if>
+ <equals arg1="${COMPONENT}" arg2="trunk" />
+ <then>
+ <var name="artifactId" value="${artifactIdAgg}.all"
/>
+ </then>
+ <else>
+ <var name="artifactId"
value="${COMPONENT}.${artifactIdAgg}" />
+ </else>
+ </if>
+ <writeAggregatePom dir="@{subdir}"
+ parentpom="../${pathToParentPom}parent-pom.xml"
+ artifactId="${artifactId}"
+ artifactVersion="@{artifactVersion}"
+ />
+
+ <echo level="debug">subdir = @{subdir}</echo>
+ <echo level="verbose">Aggregated:
${artifactIdAgg}</echo>
+
+ <var name="artifactIdAgg" unset="true" />
+ <var name="artifactId" unset="true" />
+ </else>
+ </if>
+ </else>
+ </if>
+ </sequential>
+ </for>
+ </sequential>
+ </macrodef>
+
+ </target>
+
+ <target name="run" depends="init">
+ <if>
+ <not>
+ <available file="${WORKINGDIR}/${pathToParentPom}parent-pom.xml"
type="file" />
+ </not>
+ <then>
+ <fail>Error: no parent-pom.xml found in
${WORKINGDIR}/${pathToParentPom}</fail>
+ </then>
+ </if>
+
+ <if>
+ <not>
+ <equals arg1="${COMPONENT}" arg2="trunk" />
+ </not>
+ <then>
+ <var name="pathToParentPom" unset="true" />
+ <var name="pathToParentPom" value="../" />
+ </then>
+ </if>
+ <echo level="verbose">COMPONENT = ${COMPONENT}, pathToParentPom =
${pathToParentPom}</echo>
+
+ <!-- if set, compare values in tags file to values found in manifests and report
discrepancies -->
+ <!--<property name="tagsFile"
+
value="/home/nboldt/eclipse/workspace-jboss/devstudio-trunk/releng/org.jboss.ide.eclipse.releng/builders/product/versionTags/jbosstools/3.1.0.GA.tags"
+ />-->
+
+ <if>
+ <and>
+ <isset property="tagsFile" />
+ <available file="${tagsFile}" type="file" />
+ </and>
+ <then>
+ <property file="${tagsFile}" prefix="tagsFile" />
+ </then>
+ </if>
+
+ <!-- counter variables -->
+ <var name="aggregatorcountstring" value="" />
+ <var name="modulecountstring" value="" />
+
+ <if>
+ <equals arg1="${COMPONENT}" arg2="trunk" />
+ <then>
+ <!-- call generateAggregator for overall -->
+ <generateAggregator dir="${WORKINGDIR}"
+ parentpom="${pathToParentPom}parent-pom.xml"
+ artifactId="${COMPONENT}"
+ artifactVersion="${pomVersion}"
+ />
+ </then>
+ <else>
+ <!-- call generateAggregator for component -->
+ <generateAggregator dir="${WORKINGDIR}/${COMPONENT}"
+ parentpom="${pathToParentPom}parent-pom.xml"
+ artifactId="${COMPONENT}"
+ artifactVersion="${pomVersion}"
+ />
+ </else>
+ </if>
+ <!-- summary -->
+ <length string="${modulecountstring}" property="modulecount"
/>
+ <length string="${aggregatorcountstring}"
property="aggregatorcount" />
+ <echo level="info">Modules: ${modulecount} Aggregations:
${aggregatorcount}</echo>
+
+ </target>
+
+ <target name="getArtifactType">
+ <property name="dir" value="." />
+ <if>
+ <matches string="${dir}" pattern=".+/features/.+" />
+ <then>
+ <var name="artifactType" value="eclipse-feature" />
+ </then>
+ <elseif>
+ <or>
+ <matches string="${dir}" pattern=".+/site" />
+ <matches string="${dir}" pattern=".+site" />
+ </or>
+ <then>
+ <var name="artifactType" value="eclipse-update-site" />
+ </then>
+ </elseif>
+ <elseif>
+ <and>
+ <not>
+ <matches string="${dir}" pattern=".+/plugins/.+" />
+ </not>
+ <matches string="${dir}" pattern=".+/tests/.+" />
+ </and>
+ <then>
+ <var name="artifactType" value="eclipse-test-plugin" />
+ </then>
+ </elseif>
+ <else>
+ <var name="artifactType" value="eclipse-plugin" />
+ </else>
+ </if>
+ </target>
+
+ <target name="getArtifactVersion">
+ <property name="dir" value="." />
+ <!-- echo>${dir}</echo -->
+ <if>
+ <available file="${dir}/META-INF/MANIFEST.MF" type="file"
/>
+ <then>
+ <!-- get Bundle-SymbolicName: -->
+ <loadfile srcfile="${dir}/META-INF/MANIFEST.MF"
property="artifactVersion">
+ <filterchain>
+ <linecontains>
+ <contains value="Bundle-Version:" />
+ </linecontains>
+ </filterchain>
+ </loadfile>
+ <propertyregex property="artifactVersion"
+ input="${artifactVersion}"
+ defaultvalue="${artifactVersion}"
+ regexp="Bundle-Version:( +)([^\n\r]+)[\n\r]+"
+ replace="\2"
+ casesensitive="true"
+ override="true"
+ />
+
+ <!-- compare tags file to current manifests -->
+ <antcallback target="checkArtifactVersionAgainstTagFile"
return="artifactVersion.from.tag" />
+ <if>
+ <and>
+ <isset property="artifactVersion.from.tag" />
+ <not>
+ <equals arg1="${artifactVersion.from.tag}"
arg2="${artifactVersion}" />
+ </not>
+ </and>
+ <then>
+ <loadfile property="manifest.file"
srcfile="${dir}/META-INF/MANIFEST.MF">
+ <filterchain>
+ <tokenfilter>
+ <replaceregex pattern="Bundle-Version:( +)${artifactVersion}"
+ replace="Bundle-Version: ${artifactVersion.from.tag}"
+ flags=""
+ />
+ </tokenfilter>
+ </filterchain>
+ </loadfile>
+ <echo message="${manifest.file}"
file="${dir}/META-INF/MANIFEST.MF" />
+ <var name="manifest.file" unset="true" />
+ </then>
+ <else>
+ <var name="artifactVersion.from.tag"
value="${artifactVersion}" />
+ </else>
+ </if>
+
+ <!-- now, switch to Maven style (s/.qualifier/-SNAPSHOT/) -->
+ <propertyregex property="artifactVersion"
+ input="${artifactVersion.from.tag}"
+ defaultvalue="${artifactVersion.from.tag}"
+ regexp="(.+).qualifier"
+ replace="\1-SNAPSHOT"
+ casesensitive="true"
+ override="true"
+ />
+ <var name="artifactVersion.from.tag" unset="true" />
+ </then>
+ <elseif>
+ <available file="${dir}/feature.xml" type="file" />
+ <then>
+ <!-- get <feature version=""> -->
+ <xmlproperty file="${dir}/feature.xml"
collapseAttributes="true" />
+ <var name="artifactVersion" value="${feature.version}" />
+
+ <!-- compare tags file to current manifests -->
+ <antcallback target="checkArtifactVersionAgainstTagFile"
return="artifactVersion.from.tag" />
+ <if>
+ <and>
+ <isset property="artifactVersion.from.tag" />
+ <not>
+ <equals arg1="${artifactVersion.from.tag}"
arg2="${artifactVersion}" />
+ </not>
+ </and>
+ <then>
+ <loadfile property="manifest.file"
srcfile="${dir}/feature.xml">
+ <filterchain>
+ <tokenfilter>
+ <replaceregex
pattern="version="${artifactVersion}""
+
replace="version="${artifactVersion.from.tag}""
+ flags=""
+ />
+ </tokenfilter>
+ </filterchain>
+ </loadfile>
+ <echo message="${manifest.file}" file="${dir}/feature.xml"
/>
+ <var name="manifest.file" unset="true" />
+ </then>
+ <else>
+ <var name="artifactVersion.from.tag"
value="${artifactVersion}" />
+ </else>
+ </if>
+ <var name="feature.version" unset="true" />
+
+ <!-- now, switch to Maven style (s/.qualifier/-SNAPSHOT/) -->
+ <propertyregex property="artifactVersion"
+ input="${artifactVersion.from.tag}"
+ defaultvalue="${artifactVersion.from.tag}"
+ regexp="(.+).qualifier"
+ replace="\1-SNAPSHOT"
+ casesensitive="true"
+ override="true"
+ />
+ <var name="artifactVersion.from.tag" unset="true" />
+ </then>
+ </elseif>
+ <else>
+ <echo level="verbose">Warning! artifactVersion not found for
${dir}!</echo>
+ <var name="artifactVersion" value="0.0.0" />
+ </else>
+ </if>
+ </target>
+
+ <target name="checkArtifactVersionAgainstTagFile">
+ <dirname property="this.dir" file="${dir}" />
+ <dirname property="parent.dir.path" file="${this.dir}" />
+ <basename property="parent.dir" file="${parent.dir.path}" />
+ <var name="this.dir" unset="true" />
+ <var name="parent.dir.path" unset="true" />
+ <if>
+ <isset property="tagsFile.${parent.dir}" />
+ <then>
+ <propertycopy from="tagsFile.${parent.dir}"
property="artifactVersion.from.tag" />
+ <propertyregex property="artifactVersion.from.tag"
+ input="${artifactVersion.from.tag}"
+ defaultvalue="${artifactVersion.from.tag}"
+ regexp="(.+).GA"
+ replace="\1.qualifier"
+ casesensitive="true"
+ override="true"
+ />
+ </then>
+ </if>
+ <if>
+ <and>
+ <isset property="tagsFile.${parent.dir}" />
+ <not>
+ <equals arg1="${artifactVersion}"
arg2="${artifactVersion.from.tag}" />
+ </not>
+ </and>
+ <then>
+ <basename file="${dir}" property="this.dir" />
+ <echo level="info">For ${this.dir}, got ${artifactVersion}; should be
${artifactVersion.from.tag}</echo>
+ </then>
+ <else>
+ <var name="artifactVersion.from.tag"
value="${artifactVersion}" />
+ </else>
+ </if>
+ <var name="parent.dir" unset="true" />
+ </target>
+
+ <!-- supports only the following platforms:
+ org.mozilla.xulrunner.carbon.macosx
+ org.mozilla.xulrunner.cocoa.macosx
+ org.mozilla.xulrunner.gtk.linux.x86
+ org.mozilla.xulrunner.gtk.linux.x86_64
+ org.mozilla.xulrunner.win32.win32.x86
+ -->
+ <target name="getArtifactOsWsArch">
+ <property name="artifactId"
value="org.mozilla.xulrunner.cocoa.macosx" />
+ <propertyregex property="artifactOs"
+ input="${artifactId}"
+ defaultvalue=""
+ regexp="(macosx|linux|win32)"
+ select="\1"
+ casesensitive="true"
+ override="true"
+ />
+ <propertyregex property="artifactWs"
+ input="${artifactId}"
+ defaultvalue=""
+ regexp="(carbon|cocoa|win32|gtk)"
+ select="\1"
+ casesensitive="true"
+ override="true"
+ />
+ <propertyregex property="artifactArch"
+ input="${artifactId}"
+ defaultvalue=""
+ regexp="\.(x86|x86_64)$"
+ select="\1"
+ casesensitive="true"
+ override="true"
+ />
+
+ </target>
+
+ <target name="getArtifactId">
+ <property name="dir" value="." />
+ <!-- echo>${dir}</echo -->
+ <if>
+ <available file="${dir}/META-INF/MANIFEST.MF" type="file"
/>
+ <then>
+ <!-- get Bundle-SymbolicName: -->
+ <loadfile srcfile="${dir}/META-INF/MANIFEST.MF"
property="artifactId">
+ <filterchain>
+ <linecontains>
+ <contains value="Bundle-SymbolicName:" />
+ </linecontains>
+ </filterchain>
+ </loadfile>
+ <propertyregex property="artifactId"
+ input="${artifactId}"
+ defaultvalue="${artifactId}"
+ regexp="Bundle-SymbolicName:([\t ]+)([^\n\r\t ]+);(.+)[\n\r\t
]+"
+ replace="\2"
+ casesensitive="true"
+ override="true"
+ />
+ <propertyregex property="artifactId"
+ input="${artifactId}"
+ defaultvalue="${artifactId}"
+ regexp="Bundle-SymbolicName:([\t ]+)([^\n\r\t ]+)[\n\r\t
]+"
+ replace="\2"
+ casesensitive="true"
+ override="true"
+ />
+ </then>
+ <elseif>
+ <available file="${dir}/feature.xml" type="file" />
+ <then>
+ <!-- get <feature id=""> -->
+ <xmlproperty file="${dir}/feature.xml"
collapseAttributes="true" />
+ <var name="artifactId" value="${feature.id}" />
+ <var name="feature.id" unset="true" />
+ </then>
+ </elseif>
+ <else>
+ <echo level="info">Warning! artifactId not found for
${dir}!</echo>
+ <basename property="artifactId" file="${dir}" />
+ </else>
+ </if>
+ </target>
+
+ <!-- ************************************ TESTS ************************************
-->
+
+ <target name="test.expected.values">
+ <property name="ant.enable.asserts" value="true" />
+
+ <!-- expected values for artifactVersion tests -->
+ <property name="artifactVersion.esb/features/org.jboss.tools.esb.feature"
value="1.0.0" />
+ <property
name="artifactVersion.as/tests/org.jboss.ide.eclipse.as.archives.integration.test"
value="1.0.0" />
+ <property name="artifactVersion.esb/plugins/org.jboss.tools.esb.core"
value="2.0.0" />
+ <property
name="artifactVersion.bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui"
value="0.5.0-SNAPSHOT" />
+ <property
name="artifactVersion.bpel/features/org.jboss.tools.bpel.sdk.feature"
value="1.0.0-SNAPSHOT" />
+ <property name="artifactVersion.bpel/plugins/org.eclipse.bpel.xpath10"
value="0.5.0-SNAPSHOT" />
+ <property
name="artifactVersion.vpe/plugins/org.jboss.tools.vpe.ui.palette"
value="2.1.0" />
+ <property
name="artifactVersion.tests/features/org.jboss.tools.test.feature"
value="2.0.0" />
+ <property
name="artifactVersion.portlet/features/org.jboss.tools.portlet.test.feature"
value="1.0.0" />
+ <property name="artifactVersion.jst/features/org.jboss.tools.jst.feature"
value="2.0.0" />
+ <property
name="artifactVersion.jst/features/org.jboss.tools.jst.web.tiles.feature"
value="2.0.0" />
+
+ <!-- expected values for artifactId tests -->
+ <property name="artifactId.esb/features/org.jboss.tools.esb.feature"
value="org.jboss.tools.esb.feature" />
+ <property
name="artifactId.as/tests/org.jboss.ide.eclipse.as.archives.integration.test"
+ value="org.jboss.ide.eclipse.as.archives.integration.test"
+ />
+ <property name="artifactId.esb/plugins/org.jboss.tools.esb.core"
value="org.jboss.tools.esb.core" />
+ <property
name="artifactId.bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui"
+ value="org.eclipse.bpel.apache.ode.deploy.ui"
+ />
+ <property
name="artifactId.bpel/features/org.jboss.tools.bpel.sdk.feature"
+ value="org.jboss.tools.bpel.sdk.feature"
+ />
+ <property name="artifactId.bpel/plugins/org.eclipse.bpel.xpath10"
value="org.eclipse.bpel.xpath10" />
+ <property name="artifactId.vpe/plugins/org.jboss.tools.vpe.ui.palette"
value="org.jboss.tools.vpe.ui.palette" />
+ <property name="artifactId.tests/features/org.jboss.tools.test.feature"
value="org.jboss.tools.test.feature" />
+ <property
name="artifactId.portlet/features/org.jboss.tools.portlet.test.feature"
+ value="org.jboss.tools.portlet.test.feature"
+ />
+ <property name="artifactId.jst/features/org.jboss.tools.jst.feature"
value="org.jboss.tools.jst.feature" />
+ <property
name="artifactId.jst/features/org.jboss.tools.jst.web.tiles.feature"
+ value="org.jboss.tools.jst.web.tiles.feature"
+ />
+
+ <!-- expected values for artifactType tests -->
+ <property name="artifactType.esb/features/org.jboss.tools.esb.feature"
value="eclipse-feature" />
+ <property
name="artifactType.as/tests/org.jboss.ide.eclipse.as.archives.integration.test"
+ value="eclipse-test-plugin"
+ />
+ <property name="artifactType.esb/plugins/org.jboss.tools.esb.core"
value="eclipse-plugin" />
+ <property
name="artifactType.bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui"
value="eclipse-plugin" />
+ <property
name="artifactType.bpel/features/org.jboss.tools.bpel.sdk.feature"
value="eclipse-feature" />
+ <property name="artifactType.bpel/plugins/org.eclipse.bpel.xpath10"
value="eclipse-plugin" />
+ <property name="artifactType.vpe/plugins/org.jboss.tools.vpe.ui.palette"
value="eclipse-plugin" />
+ <property name="artifactType.tests/features/org.jboss.tools.test.feature"
value="eclipse-feature" />
+ <property
name="artifactType.portlet/features/org.jboss.tools.portlet.test.feature"
value="eclipse-feature" />
+ <property name="artifactType.jst/features/org.jboss.tools.jst.feature"
value="eclipse-feature" />
+ <property
name="artifactType.jst/features/org.jboss.tools.jst.web.tiles.feature"
value="eclipse-feature" />
+
+ <!-- expected values for artifactOsWsArch tests -->
+ <property name="artifactOsWsArch.org.mozilla.xpcom.os" value=""
/>
+ <property name="artifactOsWsArch.org.mozilla.xpcom.ws" value=""
/>
+ <property name="artifactOsWsArch.org.mozilla.xpcom.arch"
value="" />
+
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.carbon.macosx.os"
value="macosx" />
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.carbon.macosx.ws"
value="carbon" />
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.carbon.macosx.arch"
value="" />
+
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.cocoa.macosx.os"
value="macosx" />
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.cocoa.macosx.ws"
value="cocoa" />
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.cocoa.macosx.arch"
value="" />
+
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.gtk.linux.x86.os"
value="linux" />
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.gtk.linux.x86.ws"
value="gtk" />
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.gtk.linux.x86.arch"
value="x86" />
+
+ <property
name="artifactOsWsArch.org.mozilla.xulrunner.gtk.linux.x86_64.os"
value="linux" />
+ <property
name="artifactOsWsArch.org.mozilla.xulrunner.gtk.linux.x86_64.ws"
value="gtk" />
+ <property
name="artifactOsWsArch.org.mozilla.xulrunner.gtk.linux.x86_64.arch"
value="x86_64" />
+
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.win32.win32.x86.os"
value="win32" />
+ <property name="artifactOsWsArch.org.mozilla.xulrunner.win32.win32.x86.ws"
value="win32" />
+ <property
name="artifactOsWsArch.org.mozilla.xulrunner.win32.win32.x86.arch"
value="x86" />
+ </target>
+
+ <target name="test.all">
+
+ <property name="dirs"
+ value="
+ ${WORKINGDIR}/esb/features/org.jboss.tools.esb.feature
+ ${WORKINGDIR}/as/tests/org.jboss.ide.eclipse.as.archives.integration.test
+ ${WORKINGDIR}/esb/plugins/org.jboss.tools.esb.core
+ ${WORKINGDIR}/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui
+ ${WORKINGDIR}/bpel/features/org.jboss.tools.bpel.sdk.feature
+ ${WORKINGDIR}/bpel/plugins/org.eclipse.bpel.xpath10
+ ${WORKINGDIR}/vpe/plugins/org.jboss.tools.vpe.ui.palette
+ ${WORKINGDIR}/tests/features/org.jboss.tools.test.feature
+ ${WORKINGDIR}/portlet/features/org.jboss.tools.portlet.test.feature
+ ${WORKINGDIR}/jst/features/org.jboss.tools.jst.feature
+ ${WORKINGDIR}/jst/features/org.jboss.tools.jst.web.tiles.feature
+ "
+ />
+ <antcall target="test.getArtifactVersion" />
+ <antcall target="test.getArtifactId" />
+ <antcall target="test.getArtifactType" />
+ <antcall target="test.getArtifactOsWsArch" />
+ </target>
+
+ <target name="test.getArtifactVersion" depends="init,
test.expected.values">
+ <property name="dirs"
+ value="
+ ${WORKINGDIR}/esb/features/org.jboss.tools.esb.feature
+ ${WORKINGDIR}/as/tests/org.jboss.ide.eclipse.as.archives.integration.test
+ ${WORKINGDIR}/esb/plugins/org.jboss.tools.esb.core
+ ${WORKINGDIR}/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui
+ ${WORKINGDIR}/tests/features/org.jboss.tools.test.feature
+ ${WORKINGDIR}/portlet/features/org.jboss.tools.portlet.test.feature
+ ${WORKINGDIR}/jst/features/org.jboss.tools.jst.feature
+ ${WORKINGDIR}/jst/features/org.jboss.tools.jst.web.tiles.feature
+ "
+ />
+ <for param="dir" list="${dirs}" delimiter=",
+ ">
+ <sequential>
+ <antcallback target="getArtifactVersion"
return="artifactVersion">
+ <property name="dir" value="@{dir}" />
+ </antcallback>
+ <propertyregex property="activeDir"
+ input="@{dir}"
+ defaultvalue="@{dir}"
+ regexp="${WORKINGDIR}/"
+ replace=""
+ casesensitive="true"
+ override="true"
+ />
+ <propertycopy name="expected.value"
from="artifactVersion.${activeDir}" />
+ <assert failonerror="false"
+ message="For ${activeDir}, artifactVersion = ${artifactVersion};
expected ${expected.value}"
+ >
+ <bool>
+ <equals arg1="${expected.value}" arg2="${artifactVersion}"
/>
+ </bool>
+ </assert>
+ <var name="expected.value" unset="true" />
+ <var name="artifactVersion" unset="true" />
+ </sequential>
+ </for>
+ </target>
+
+ <target name="test.getArtifactId" depends="init,
test.expected.values">
+ <property name="dirs"
+ value="
+ ${WORKINGDIR}/esb/features/org.jboss.tools.esb.feature
+ ${WORKINGDIR}/as/tests/org.jboss.ide.eclipse.as.archives.integration.test
+ ${WORKINGDIR}/esb/plugins/org.jboss.tools.esb.core
+ "
+ />
+ <for param="dir" list="${dirs}" delimiter=",
+ ">
+ <sequential>
+ <antcallback target="getArtifactId" return="artifactId">
+ <property name="dir" value="@{dir}" />
+ </antcallback>
+ <propertyregex property="activeDir"
+ input="@{dir}"
+ defaultvalue="@{dir}"
+ regexp="${WORKINGDIR}/"
+ replace=""
+ casesensitive="true"
+ override="true"
+ />
+ <propertycopy name="expected.value"
from="artifactId.${activeDir}" />
+ <assert failonerror="false"
+ message="For ${activeDir}, artifactId = ${artifactId}; expected
${expected.value}"
+ >
+ <bool>
+ <equals arg1="${expected.value}" arg2="${artifactId}" />
+ </bool>
+ </assert>
+ <var name="expected.value" unset="true" />
+ <var name="artifactId" unset="true" />
+ </sequential>
+ </for>
+ </target>
+
+ <target name="test.getArtifactOsWsArch" depends="init,
test.expected.values">
+ <property name="artifactIds"
+ value="
+ org.mozilla.xpcom
+ org.mozilla.xulrunner.carbon.macosx
+ org.mozilla.xulrunner.cocoa.macosx
+ org.mozilla.xulrunner.gtk.linux.x86
+ org.mozilla.xulrunner.gtk.linux.x86_64
+ org.mozilla.xulrunner.win32.win32.x86
+ "
+ />
+ <for param="artifactId" list="${artifactIds}" delimiter=",
+ ">
+ <sequential>
+ <echo level="debug">artifactId = @{artifactId}</echo>
+ <antcallback target="getArtifactOsWsArch" return="artifactOs,
artifactWs, artifactArch">
+ <property name="artifactId" value="@{artifactId}" />
+ </antcallback>
+ <propertycopy name="expected.value.os"
from="artifactOsWsArch.(a){artifactId}.os" />
+ <propertycopy name="expected.value.ws"
from="artifactOsWsArch.(a){artifactId}.ws" />
+ <propertycopy name="expected.value.arch"
from="artifactOsWsArch.(a){artifactId}.arch" />
+ <assert failonerror="false"
+ message="For @{artifactId}, artifactOs = ${artifactOs}; expected
${expected.value.os}"
+ >
+ <bool>
+ <equals arg1="${expected.value.os}" arg2="${artifactOs}"
/>
+ </bool>
+ </assert>
+ <assert failonerror="false"
+ message="For @{artifactId}, artifactWs = ${artifactWs}; expected
${expected.value.ws}"
+ >
+ <bool>
+ <equals arg1="${expected.value.ws}" arg2="${artifactWs}"
/>
+ </bool>
+ </assert>
+ <assert failonerror="false"
+ message="For @{artifactId}, artifactArch = ${artifactArch}; expected
${expected.value.arch}"
+ >
+ <bool>
+ <equals arg1="${expected.value.arch}" arg2="${artifactArch}"
/>
+ </bool>
+ </assert>
+ <var name="expected.value.os" unset="true" />
+ <var name="expected.value.ws" unset="true" />
+ <var name="expected.value.arch" unset="true" />
+ </sequential>
+ </for>
+
+ </target>
+
+ <target name="test.getArtifactType" depends="init,
test.expected.values">
+ <property name="dirs"
+ value="
+ ${WORKINGDIR}/esb/features/org.jboss.tools.esb.feature
+ ${WORKINGDIR}/as/tests/org.jboss.ide.eclipse.as.archives.integration.test
+ ${WORKINGDIR}/esb/plugins/org.jboss.tools.esb.core
+ "
+ />
+ <for param="dir" list="${dirs}" delimiter=",
+ ">
+ <sequential>
+ <antcallback target="getArtifactType"
return="artifactType">
+ <property name="dir" value="@{dir}" />
+ </antcallback>
+ <propertyregex property="activeDir"
+ input="@{dir}"
+ defaultvalue="@{dir}"
+ regexp="${WORKINGDIR}/"
+ replace=""
+ casesensitive="true"
+ override="true"
+ />
+ <propertycopy name="expected.value"
from="artifactType.${activeDir}" />
+ <assert failonerror="false"
+ message="For ${activeDir}, artifactType = ${artifactType}; expected
${expected.value}"
+ >
+ <bool>
+ <equals arg1="${expected.value}" arg2="${artifactType}"
/>
+ </bool>
+ </assert>
+ <var name="expected.value" unset="true" />
+ <var name="artifactType" unset="true" />
+ </sequential>
+ </for>
+ </target>
+
+</project>