2007-02-28 17:57:03 -05:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
or more contributor license agreements. See the NOTICE file
|
|
|
|
distributed with this work for additional information
|
|
|
|
regarding copyright ownership. The ASF licenses this file
|
|
|
|
to you under the Apache License, Version 2.0 (the
|
|
|
|
"License"); you may not use this file except in compliance
|
|
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
|
|
software distributed under the License is distributed on an
|
|
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
KIND, either express or implied. See the License for the
|
|
|
|
specific language governing permissions and limitations
|
|
|
|
under the License.
|
|
|
|
-->
|
|
|
|
|
2008-07-10 08:10:04 -04:00
|
|
|
<!--
|
|
|
|
|
|
|
|
By default the bootstrap will use ~/.m2/repository as the integration repository but you can define the integration repository by
|
|
|
|
specifying a property on the command line:
|
|
|
|
|
|
|
|
ant -Dmaven.repo.local=/my/integration/repository
|
|
|
|
|
|
|
|
Those familiar with Maven will note this is the same way the local repository can be set from the command-line. This facilitates
|
|
|
|
having a set of builds converge on the same repository for integration purposes.
|
|
|
|
|
2008-07-13 14:11:17 -04:00
|
|
|
TODO:
|
|
|
|
- Ant Tasks for Modello (generally useful and will greatly shorten the script)
|
|
|
|
- Ant Tasks for Plexus Component Descriptors (generally useful and will allow us to eliminate the hand-coded descriptors)
|
|
|
|
|
2008-07-10 08:10:04 -04:00
|
|
|
-->
|
|
|
|
|
2008-04-15 11:41:13 -04:00
|
|
|
<project default="all" basedir="." xmlns:artifact="urn:maven-artifact-ant">
|
2008-10-30 17:46:48 -04:00
|
|
|
|
|
|
|
<property name="it.workdir.version" value="3.0.x"/>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2008-04-15 11:41:13 -04:00
|
|
|
<target name="initTaskDefs">
|
|
|
|
<xmlproperty file="pom.xml" prefix="pom.xml" />
|
2008-07-10 07:22:08 -04:00
|
|
|
<path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1-SNAPSHOT.jar"/>
|
2008-04-15 11:41:13 -04:00
|
|
|
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath"/>
|
|
|
|
</target>
|
2006-12-06 19:17:53 -05:00
|
|
|
|
2008-04-15 11:41:13 -04:00
|
|
|
<target name="isMavenHomeSet" depends="initTaskDefs">
|
2006-10-11 02:23:43 -04:00
|
|
|
<property environment="env"/>
|
|
|
|
<condition property="maven.home" value="${env.M2_HOME}">
|
|
|
|
<isset property="env.M2_HOME"/>
|
|
|
|
</condition>
|
2008-04-15 11:41:13 -04:00
|
|
|
<fail unless="maven.home" message="You must set the M2_HOME environment variable or specify a maven.home property to this Ant script"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
</target>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2008-04-15 20:41:00 -04:00
|
|
|
<target name="init" depends="isMavenHomeSet">
|
|
|
|
<xmlproperty prefix="pom" file="pom.xml"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
<basename file="${maven.home}" property="maven.home.basename"/>
|
|
|
|
<dirname file="${maven.home}" property="maven.home.dirname"/>
|
2008-07-13 13:59:26 -04:00
|
|
|
<!-- Initialize properties -->
|
2007-09-08 19:42:20 -04:00
|
|
|
<property name="maven.home.basename.expected" value="apache-maven-${pom.project.version}"/>
|
2008-07-13 13:59:26 -04:00
|
|
|
<property name="maven.assembly" location="maven-distribution/target/${maven.home.basename.expected}-bin.zip"/>
|
|
|
|
<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
|
|
|
|
<property name="surefire.useFile" value="true"/>
|
|
|
|
<echo>maven.home = ${maven.home}</echo>
|
2006-10-11 02:23:43 -04:00
|
|
|
</target>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2006-10-20 22:10:23 -04:00
|
|
|
<target name="clean-bootstrap" description="cleans up generated bootstrap classes">
|
2007-01-17 16:18:17 -05:00
|
|
|
<delete dir="bootstrap"/>
|
2006-10-20 22:10:23 -04:00
|
|
|
</target>
|
|
|
|
|
2008-04-15 11:41:13 -04:00
|
|
|
<target name="pull" depends="init" unless="skip.pull">
|
2008-07-13 13:59:26 -04:00
|
|
|
<property name="verbose" value="false"/>
|
2008-04-15 11:41:13 -04:00
|
|
|
<!-- Pull the dependencies that Maven needs to build -->
|
|
|
|
<copy file="pom.xml" tofile="dependencies.xml"/>
|
|
|
|
<replace file="${basedir}/dependencies.xml" token="<!--start-->" value="<!--"/>
|
|
|
|
<replace file="${basedir}/dependencies.xml" token="<!--end-->" value="-->"/>
|
|
|
|
<artifact:pom file="${basedir}/dependencies.xml" id="pom"/>
|
2008-07-11 17:16:59 -04:00
|
|
|
<artifact:dependencies pathId="pom.pathid" filesetId="pom.fileset" verbose="${verbose}" useScope="compile">
|
2008-07-10 08:07:01 -04:00
|
|
|
<localRepository path="${maven.repo.local}"/>
|
2008-04-15 11:41:13 -04:00
|
|
|
<pom refid="pom"/>
|
|
|
|
</artifact:dependencies>
|
|
|
|
<delete file="${basedir}/dependencies.xml"/>
|
2007-08-17 02:01:00 -04:00
|
|
|
|
2008-04-15 11:41:13 -04:00
|
|
|
<!-- Pull the dependencies for Modello -->
|
2008-04-15 20:49:10 -04:00
|
|
|
<artifact:dependencies pathId="modello.pathid" filesetId="modello.fileset" verbose="${verbose}">
|
2008-07-10 08:07:01 -04:00
|
|
|
<localRepository path="${maven.repo.local}"/>
|
2008-08-11 19:05:20 -04:00
|
|
|
<dependency groupId="org.codehaus.modello" artifactId="modello-maven-plugin" version="1.0-alpha-20"/>
|
2008-10-01 09:08:04 -04:00
|
|
|
</artifact:dependencies>
|
|
|
|
|
|
|
|
<!-- Pull the dependencies for the MetadataGenerator CLI -->
|
|
|
|
<artifact:dependencies pathId="pmdg.pathid" filesetId="pmdg.fileset" verbose="${verbose}">
|
|
|
|
<localRepository path="${maven.repo.local}"/>
|
2008-11-22 17:26:16 -05:00
|
|
|
<dependency groupId="org.codehaus.plexus" artifactId="plexus-component-metadata" version="1.0-beta-2-SNAPSHOT"/>
|
2008-04-15 11:41:13 -04:00
|
|
|
</artifact:dependencies>
|
2008-10-01 09:08:04 -04:00
|
|
|
|
2006-10-11 02:23:43 -04:00
|
|
|
</target>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2008-11-22 17:26:16 -05:00
|
|
|
<target name="generate-resources" depends="pull" description="generates plexus component metadata.">
|
|
|
|
<mkdir dir="${basedir}/bootstrap/target"/>
|
|
|
|
<mkdir dir="${basedir}/bootstrap/target/classes"/>
|
|
|
|
|
|
|
|
<path id="maven.classpath">
|
|
|
|
<pathelement location="bootstrap/target/classes"/>
|
|
|
|
<path refid="sources"/>
|
|
|
|
<path refid="pmdg.pathid"/>
|
|
|
|
<path refid="pom.pathid"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<java fork="fork" classname="org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" failonerror="true">
|
|
|
|
<classpath refid="maven.classpath"/>
|
|
|
|
<arg value="--source"/>
|
|
|
|
<arg value="${basedir}/bootstrap/target/generate-sources"/>
|
|
|
|
<arg value="--classes"/>
|
|
|
|
<arg value="${basedir}/bootstrap/target/classes"/>
|
|
|
|
<arg value="--output"/>
|
|
|
|
<arg value="${basedir}/bootstrap/target/classes/META-INF/plexus/components.xml"/>
|
|
|
|
</java>
|
|
|
|
</target>
|
|
|
|
|
2008-04-15 20:41:00 -04:00
|
|
|
<target name="generate-sources" depends="pull" description="generates Java sources from Modello mdo model files">
|
2006-10-11 12:44:55 -04:00
|
|
|
<mkdir dir="bootstrap/target"/>
|
|
|
|
<mkdir dir="bootstrap/target/generated-sources"/>
|
|
|
|
|
2006-10-11 02:23:43 -04:00
|
|
|
<macrodef name="modello-single-mode">
|
|
|
|
<attribute name="file"/>
|
|
|
|
<attribute name="mode"/>
|
|
|
|
<attribute name="version"/>
|
|
|
|
<sequential>
|
2006-12-06 19:17:53 -05:00
|
|
|
<java fork="fork" classname="org.codehaus.modello.ModelloCli" failonerror="true">
|
2008-04-15 11:41:13 -04:00
|
|
|
<classpath refid="modello.pathid"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
<arg file="@{file}"/>
|
|
|
|
<arg value="@{mode}"/>
|
2006-10-11 12:44:55 -04:00
|
|
|
<arg file="bootstrap/target/generated-sources"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
<arg value="@{version}"/>
|
|
|
|
<arg value="false"/>
|
|
|
|
</java>
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2006-10-11 02:23:43 -04:00
|
|
|
<macrodef name="modello">
|
|
|
|
<attribute name="file"/>
|
|
|
|
<attribute name="version" default="1.0.0"/>
|
|
|
|
<sequential>
|
|
|
|
<echo taskname="modello" message="Generating sources for @{file}"/>
|
|
|
|
<modello-single-mode file="@{file}" version="@{version}" mode="java"/>
|
|
|
|
<modello-single-mode file="@{file}" version="@{version}" mode="xpp3-reader"/>
|
|
|
|
<modello-single-mode file="@{file}" version="@{version}" mode="xpp3-writer"/>
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2007-01-22 14:24:50 -05:00
|
|
|
<modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/>
|
2007-03-20 17:40:59 -04:00
|
|
|
<modello file="maven-lifecycle/src/main/mdo/maven-lifecycle.mdo"/>
|
2007-09-05 20:46:41 -04:00
|
|
|
<modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/>
|
2008-09-27 10:52:28 -04:00
|
|
|
<modello file="maven-project/src/main/mdo/profiles.mdo"/>
|
2007-09-07 02:07:29 -04:00
|
|
|
<modello file="maven-core/src/main/mdo/settings.mdo"/>
|
2008-03-01 09:07:09 -05:00
|
|
|
<modello file="maven-toolchain/src/main/mdo/toolchains.xml"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="compile-boot" depends="generate-sources" description="compiles the bootstrap sources">
|
|
|
|
<path id="sources">
|
|
|
|
<dirset dir=".">
|
2006-10-11 12:44:55 -04:00
|
|
|
<include name="bootstrap/target/generated-sources"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
<include name="*/src/main/*"/>
|
|
|
|
<include name="maven-reporting/maven-reporting-api/src/main/*"/>
|
|
|
|
<exclude name="maven-core-it-verifier/**"/>
|
|
|
|
</dirset>
|
|
|
|
</path>
|
|
|
|
|
2006-10-11 12:44:55 -04:00
|
|
|
<mkdir dir="bootstrap/target/classes"/>
|
2008-04-15 11:41:13 -04:00
|
|
|
<javac destdir="bootstrap/target/classes" debug="${debug}">
|
2006-10-11 02:23:43 -04:00
|
|
|
<src refid="sources"/>
|
2008-04-15 11:41:13 -04:00
|
|
|
<classpath refid="pom.pathid"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
</javac>
|
|
|
|
|
|
|
|
<!-- DGF generating a fake pom.properties so Maven thinks it has a version number -->
|
2006-10-11 12:44:55 -04:00
|
|
|
<mkdir dir="bootstrap/target/classes/META-INF/maven/org.apache.maven/maven-core"/>
|
|
|
|
<echo message="version=${pom.project.version}"
|
|
|
|
file="bootstrap/target/classes/META-INF/maven/org.apache.maven/maven-core/pom.properties"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
|
|
|
|
<path id="maven.classpath">
|
2006-10-11 12:44:55 -04:00
|
|
|
<pathelement location="bootstrap/target/classes"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
<path refid="sources"/>
|
2008-04-15 11:41:13 -04:00
|
|
|
<path refid="pom.pathid"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
</path>
|
|
|
|
</target>
|
|
|
|
|
2008-04-15 20:41:00 -04:00
|
|
|
<target name="maven-compile" depends="compile-boot" description="compiles Maven using the bootstrap Maven, skipping automated tests">
|
2006-10-11 02:23:43 -04:00
|
|
|
<java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
|
|
|
|
<classpath refid="maven.classpath"/>
|
2008-09-28 08:16:53 -04:00
|
|
|
<arg value="-e"/>
|
2006-10-31 14:38:37 -05:00
|
|
|
<arg value="-B"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
<arg value="clean"/>
|
2007-01-17 18:56:41 -05:00
|
|
|
<arg value="install"/>
|
2008-07-10 08:07:01 -04:00
|
|
|
<arg value="-Dmaven.repo.local=${maven.repo.local}"/>
|
2008-07-10 08:55:48 -04:00
|
|
|
<arg value="-Dsurefire.useFile=${surefire.useFile}"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
</java>
|
|
|
|
</target>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2008-07-13 14:11:17 -04:00
|
|
|
<target name="maven-assembly" depends="maven-compile" description="generates the Maven installation assembly using the bootstrap Maven">
|
2007-08-09 13:46:33 -04:00
|
|
|
<echo>
|
|
|
|
The new Maven distribution was created as part of the MAVEN-COMPILE step, above.
|
|
|
|
This goal just validates the presence of that distribution.
|
|
|
|
</echo>
|
2006-10-11 02:23:43 -04:00
|
|
|
<condition property="build.failed">
|
|
|
|
<not>
|
|
|
|
<available file="${maven.assembly}"/>
|
|
|
|
</not>
|
|
|
|
</condition>
|
2008-04-15 20:41:00 -04:00
|
|
|
<fail if="build.failed" message="Assembly task seemed to succeed, but couldn't find assembly file: ${maven.assembly}"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
</target>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2008-04-15 20:41:00 -04:00
|
|
|
<target name="extract-assembly" depends="init,maven-assembly" description="extracts the maven assembly into maven.home">
|
2006-12-06 19:17:53 -05:00
|
|
|
<echo>Extracting assembly to ${maven.home.dirname} ...</echo>
|
2008-07-11 17:32:54 -04:00
|
|
|
<!-- If we are starting from scratch make sure the directory is created -->
|
2008-07-13 13:59:26 -04:00
|
|
|
<delete dir="${maven.home}"/>
|
2008-07-11 17:32:54 -04:00
|
|
|
<mkdir dir="${maven.home}"/>
|
2006-10-11 02:23:43 -04:00
|
|
|
<unzip src="${maven.assembly}" dest="${maven.home.dirname}"/>
|
2006-10-11 18:58:27 -04:00
|
|
|
<chmod perm="+x">
|
|
|
|
<fileset dir="${maven.home}/bin">
|
|
|
|
<include name="mvn"/>
|
|
|
|
</fileset>
|
|
|
|
</chmod>
|
2006-10-11 02:23:43 -04:00
|
|
|
</target>
|
2008-10-30 17:46:48 -04:00
|
|
|
|
|
|
|
<target name="its-setup">
|
|
|
|
<condition property="its.win32">
|
|
|
|
<os family="windows"/>
|
|
|
|
</condition>
|
|
|
|
<condition property="its.unix">
|
|
|
|
<not>
|
|
|
|
<os family="windows"/>
|
|
|
|
</not>
|
|
|
|
</condition>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="its-win32" if="its.win32">
|
|
|
|
<echo>Retrieving integration tests</echo>
|
|
|
|
<exec dir="${basedir}/maven-integration-tests" executable="cmd">
|
|
|
|
<arg value="/c"/>
|
|
|
|
<arg value="${maven.home}\bin\mvn.bat"/>
|
|
|
|
<arg value="initialize"/>
|
|
|
|
</exec>
|
|
|
|
|
|
|
|
<echo>Running integration tests</echo>
|
|
|
|
<!-- Hard-coding to /tmp/ to avoid long path names that will make windows scream. -->
|
|
|
|
<exec failonerror="true" dir="/tmp/maven-integration-tests-${it.workdir.version}" executable="cmd">
|
|
|
|
<arg value="/c"/>
|
|
|
|
<arg value="${maven.home}\bin\mvn.bat"/>
|
|
|
|
<arg value="-Prun-its"/>
|
|
|
|
<arg value="clean"/>
|
|
|
|
<arg value="install"/>
|
|
|
|
</exec>
|
|
|
|
</target>
|
2006-10-11 12:44:55 -04:00
|
|
|
|
2008-10-30 17:46:48 -04:00
|
|
|
<target name="its-unix" if="its.unix">
|
|
|
|
<echo>Retrieving integration tests</echo>
|
|
|
|
<exec dir="${basedir}/maven-integration-tests" executable="${maven.home}/bin/mvn">
|
|
|
|
<arg value="initialize"/>
|
|
|
|
</exec>
|
|
|
|
|
|
|
|
<echo>Running integration tests</echo>
|
|
|
|
<!-- Hard-coding to /tmp/ to avoid long path names that will make windows scream. -->
|
|
|
|
<exec failonerror="true" dir="/tmp/maven-integration-tests-${it.workdir.version}" executable="${maven.home}/bin/mvn">
|
|
|
|
<arg value="-Prun-its"/>
|
|
|
|
<arg value="clean"/>
|
|
|
|
<arg value="install"/>
|
|
|
|
</exec>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="run-its" depends="init,its-setup,its-win32,its-unix">
|
|
|
|
<echo>Integration-test results should be displayed above.</echo>
|
|
|
|
</target>
|
|
|
|
|
2006-10-25 23:31:08 -04:00
|
|
|
<target name="all" depends="clean-bootstrap,init,extract-assembly"/>
|
2006-10-18 23:37:53 -04:00
|
|
|
|
2008-10-30 17:46:48 -04:00
|
|
|
<target name="with-its" depends="all,run-its"/>
|
|
|
|
|
2006-10-11 02:23:43 -04:00
|
|
|
</project>
|