Author: max.andersen(a)jboss.com
Date: 2010-04-26 13:20:10 -0400 (Mon, 26 Apr 2010)
New Revision: 21695
Modified:
trunk/genpom.xml
Log:
merge gave bad genpom.xml. Copied branch genpom.xml to trunk. JBDS-486
Modified: trunk/genpom.xml
===================================================================
--- trunk/genpom.xml 2010-04-26 17:08:32 UTC (rev 21694)
+++ trunk/genpom.xml 2010-04-26 17:20:10 UTC (rev 21695)
@@ -1,16 +1,13 @@
-<project default="run" basedir=".">
+<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="debug" value="false" />
<property name="dirsToExclude"
-<<<<<<< .working
- value="**/*.sdk.*, **/doc*, **/download.jboss.org, **/util, **/test,
**/builders, **/releng, ."
-=======
- value="**/*.sdk.*, **/doc*, **/releng/**, **/build/**,
**/download.jboss.org, **/sampleprojects/**, **/util/**, **/test, **/builders, **/contrib,
**/releng/**, ."
->>>>>>> .merge-right.r21669
+ value="**/*.sdk.*, **/doc*, **/releng/**, **/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:
@@ -18,10 +15,12 @@
-->
<!-- To run this script via commandline:
cd /home/nboldt/workspace36/jbosstools-modular_build; ant -f genpom.xml -q
- or, to build a specific module only:
+ or, to build a specific module IFF no poms already exist:
cd /home/nboldt/workspace36/jbosstools-modular_build; \
- ant -f genpom.xml -q -DpathToParentPom=../
-DWORKINGDIR=/home/nboldt/workspace36/jbosstools-modular_build/as
-
+ 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">
@@ -59,21 +58,6 @@
</classpath>
</taskdef>
- <macrodef name="debug">
- <text name="echo" />
- <sequential>
- <if>
- <and>
- <isset property="debug" />
- <istrue value="${debug}" />
- </and>
- <then>
- <echo message="@{echo}" />
- </then>
- </if>
- </sequential>
- </macrodef>
-
<!-- = = = = = = = = = = = = = = = = =
macrodef: write out a pom.xml which aggregates subdirs
= = = = = = = = = = = = = = = = = -->
@@ -116,16 +100,23 @@
casesensitive="true"
override="true"
/>
- <debug> Agg dir: ${activeDir}, artifactType: ${artifactType}, artifactId:
${artifactId}, artifactVersion: ${artifactVersion}, parentpom: @{parentpom}</debug>
- <!-- <echo>Write Agg @{dir}/pom.xml</echo> -->
- <echo file="(a){dir}/pom.xml">&lt;project
+ <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>
+ <relativePath>@{parentpom}</relativePath>
+ <groupId>${projectName}</groupId>
+ <artifactId>${projectName}.parent.pom</artifactId>
+ <version>${pomVersion}</version>
</parent>
<groupId>${projectName}</groupId>
<artifactId>${artifactId}</artifactId>
@@ -133,23 +124,25 @@
<packaging>${artifactType}</packaging>
<modules>
</echo>
- <var name="artifactId" unset="true" />
- <var name="artifactVersion" unset="true" />
- <for param="subdir" delimiter=",
+ <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>
+ <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>
+ <var name="subdirSuffix" unset="true" />
+ </sequential>
+ </for>
+ <echo file="(a){dir}/pom.xml"
append="true"> </modules>
</project>
</echo>
+ </then>
+ </if>
</sequential>
</macrodef>
@@ -165,12 +158,11 @@
<property name="dir" value="@{dir}" />
</antcallback>
<if>
- <!-- cannot calculate id and version for an update site so just set them to
defaults -->
<equals arg1="${artifactType}" arg2="eclipse-update-site"
/>
<then>
<var name="artifactId" unset="true" />
<basename property="artifactId" file="@{dir}" />
- <var name="artifactVersion" value="0.0.0" />
+ <var name="artifactVersion" value="${pomVersion}" />
</then>
<else>
<var name="artifactId" unset="true" />
@@ -181,6 +173,12 @@
<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"
@@ -191,8 +189,16 @@
casesensitive="true"
override="true"
/>
- <debug> Mod dir: ${activeDir}, artifactType: ${artifactType}, artifactId:
${artifactId}, artifactVersion: ${artifactVersion}, parentpom: @{parentpom}</debug>
- <echo file="(a){dir}/pom.xml">&lt;project
+ <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>
@@ -201,15 +207,65 @@
<artifactId>${projectName}.parent.pom</artifactId>
<version>${pomVersion}</version>
</parent>
- <groupId>${projectName}</groupId>
+ <groupId>${projectName}</groupId>
<artifactId>${artifactId}</artifactId>
- <version>${artifactVersion}</version>
- <packaging>${artifactType}</packaging>
-</project>
- </echo>
+ <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>
@@ -249,14 +305,27 @@
<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>
- <dirset dir="@{dir}" excludes="${dirsToExclude}"
includes="*" />
- </path>
+ <path refid="trunkDir" />
<sequential>
- <!-- <debug> @{subdir}</debug> -->
+ <echo level="debug">@{subdir}</echo>
<var name="aggregate" value="false" />
<if>
<or>
@@ -267,10 +336,10 @@
</or>
<then>
<!-- valid place to create a pom -->
- <writeModulePom dir="@{subdir}"
parentpom="../@{parentpom}" />
+ <writeModulePom dir="@{subdir}"
parentpom="../${pathToParentPom}@{parentpom}" />
</then>
<else>
- <for list="plugins tests features" param="type"
delimiter=" ">
+ <for list="plugins tests features site" param="type"
delimiter=" ">
<sequential>
<basename property="artifactIdAgg" file="@{subdir}"
/>
<if>
@@ -278,7 +347,7 @@
<then>
<var name="aggregate" value="true" />
<generateAggregator dir="@{subdir}/@{type}"
- parentpom="../../@{parentpom}"
+
parentpom="../../${pathToParentPom}@{parentpom}"
artifactId="${artifactIdAgg}.@{type}"
artifactVersion="@{artifactVersion}"
/>
@@ -292,16 +361,26 @@
<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="${artifactIdAgg}.all"
+ artifactId="${artifactId}"
artifactVersion="@{artifactVersion}"
/>
- <debug>subdir = @{subdir}</debug>
- <echo>Aggregated: ${artifactIdAgg}</echo>
+ <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>
@@ -311,30 +390,6 @@
</sequential>
</macrodef>
- <!-- = = = = = = = = = = = = = = = = =
- macrodef: count items in a list
- = = = = = = = = = = = = = = = = = -->
- <!-- example usage:
- <list.count list="foo bar baz" />
- <echo message="${list.count.return}" />
- <var name="list.count.return" unset="true"/>
- <list.count list="foo bar" />
- <echo message="${list.count.return}" />
- -->
- <macrodef name="list.count">
- <attribute name="list" default="" />
- <sequential>
- <var name="count" value="" />
- <for param="listitem" list="@{list}" delimiter=",
- ">
- <sequential>
- <var name="count" value="${count}0" />
- </sequential>
- </for>
- <length property="list.count.return" string="${count}" />
- </sequential>
- </macrodef>
-
</target>
<target name="run" depends="init">
@@ -347,6 +402,17 @@
</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"
@@ -366,16 +432,29 @@
<var name="aggregatorcountstring" value="" />
<var name="modulecountstring" value="" />
- <!-- call generateAggregator for overall -->
- <generateAggregator dir="${WORKINGDIR}"
- parentpom="${pathToParentPom}parent-pom.xml"
- artifactId="trunk"
- artifactVersion="${pomVersion}"
- />
+ <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>Modules: ${modulecount} Aggregations: ${aggregatorcount}</echo>
+ <echo level="info">Modules: ${modulecount} Aggregations:
${aggregatorcount}</echo>
</target>
@@ -523,7 +602,7 @@
</then>
</elseif>
<else>
- <echo>Warning! artifactVersion not found for ${dir}!</echo>
+ <echo level="verbose">Warning! artifactVersion not found for
${dir}!</echo>
<var name="artifactVersion" value="0.0.0" />
</else>
</if>
@@ -558,7 +637,7 @@
</and>
<then>
<basename file="${dir}" property="this.dir" />
- <echo>For ${this.dir}, got ${artifactVersion}; should be
${artifactVersion.from.tag}</echo>
+ <echo level="info">For ${this.dir}, got ${artifactVersion}; should be
${artifactVersion.from.tag}</echo>
</then>
<else>
<var name="artifactVersion.from.tag"
value="${artifactVersion}" />
@@ -567,6 +646,42 @@
<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 -->
@@ -608,7 +723,7 @@
</then>
</elseif>
<else>
- <echo>Warning! artifactId not found for ${dir}!</echo>
+ <echo level="info">Warning! artifactId not found for
${dir}!</echo>
<basename property="artifactId" file="${dir}" />
</else>
</if>
@@ -669,6 +784,31 @@
<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">
@@ -691,6 +831,7 @@
<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">
@@ -770,6 +911,56 @@
</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="