blob: 6381834496261b586ddc7bf56e061dd001f29391 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed 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.
This work is copyright by the author(s) and is part of a greater work collectively copyright by the
Groovy community. See the NOTICE.txt file distributed with this work for additional information.
Author : Paul King
$Revision$ ($LastChangedBy$)
$Date$
-->
<project name="build-maven" default="" basedir="../.." xmlns:artifact="urn:maven-artifact-ant">
<import file="build-setup.xml"/>
<macrodef name="fetch.maven">
<attribute name="scope"/>
<attribute name="module"/>
<sequential>
<artifact:dependencies useScope="@{scope}" filesetId="fs.@{scope}.@{module}" pomRefId="@{module}.pom"/>
</sequential>
</macrodef>
<macrodef name="maven.pom">
<attribute name="file"/>
<attribute name="id"/>
<sequential>
<artifact:pom file="@{file}" id="@{id}"/>
</sequential>
</macrodef>
<macrodef name="fetch.maven.all.scopes">
<attribute name="module"/>
<sequential>
<fetch.maven scope="compile" module="@{module}"/>
<fetch.maven scope="runtime" module="@{module}"/>
<fetch.maven scope="test" module="@{module}"/>
</sequential>
</macrodef>
<macrodef name="fetch.maven.all.modules">
<sequential>
<fetch.maven.all.scopes module="groovy"/>
<fetch.maven scope="runtime" module="groovy-jdk14-extras"/>
<fetch.maven scope="runtime" module="groovy-tools"/>
<fetch.maven scope="runtime" module="groovy-examples"/>
</sequential>
</macrodef>
<target name="-mavenInit" depends="-mavenTaskdef,-mavenPomDefinitions"/>
<target name="-mavenTaskdef" unless="_skipFetch_">
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
<classpath>
<fileset dir="${bootstrapDirectory}" includes="maven-ant-tasks-*.jar"/>
</classpath>
</typedef>
</target>
<target name="-mavenPomDefinitions" unless="_skipFetch_">
<maven.pom file="pom.xml" id="groovy.pom"/>
<xslt in="pom.xml" out="${targetDirectory}/groovy-all.pom" style="config/maven/groovy-all.xsl"/>
<maven.pom file="${targetDirectory}/groovy-all.pom" id="groovy-all.pom"/>
<maven.pom file="config/maven/groovy-tools.pom" id="groovy-tools.pom"/>
<maven.pom file="config/maven/groovy-examples.pom" id="groovy-examples.pom"/>
<maven.pom file="config/maven/groovy-jdk14-extras.pom" id="groovy-jdk14-extras.pom"/>
<antcall target="-mavenPomDefinitionsRetro"/>
</target>
<target name="-mavenPomDefinitionsRetro" if="_forceRetro_">
<xslt in="pom.xml" out="${targetDirectory}/groovy-jdk14.pom" style="config/maven/groovy-jdk14.xsl"/>
<xslt in="${targetDirectory}/groovy-all.pom" out="${targetDirectory}/groovy-all-jdk14.pom" style="config/maven/groovy-all-jdk14.xsl"/>
<!-- TODO: work out why setting these here get overriden; currently set in build.xml -->
<!--<maven.pom file="${targetDirectory}/groovy-jdk14.pom" id="groovy-jdk14.pom"/>-->
<!--<maven.pom file="${targetDirectory}/groovy-all-jdk14.pom" id="groovy-all-jdk14.pom"/>-->
</target>
<target name="-fetchDependencies" depends="-mavenFetchAllModules,-copyLibraries,-definePathsWithoutCopyingLibraries"/>
<target name="-mavenFetchAllModules" depends="-mavenInit" unless="_skipFetch_">
<fetch.maven.all.modules/>
</target>
<target name="-copyLibraries" unless="_skipFetch_">
<definePath pathId="compilePath" filesetId="fs.compile.groovy" libdir="${compileLibDirectory}"/>
<definePath pathId="runtimePath" filesetId="fs.runtime.groovy" libdir="${runtimeLibDirectory}"/>
<definePath pathId="testLibPath" filesetId="fs.test.groovy" libdir="${testLibDirectory}"/>
<definePath pathId="toolsPath" filesetId="fs.runtime.groovy-tools" libdir="${toolsLibDirectory}"/>
<definePath pathId="examplesPath" filesetId="fs.runtime.groovy-examples" libdir="${examplesLibDirectory}"/>
<definePath pathId="jdk14ExtrasPath" filesetId="fs.runtime.groovy-jdk14-extras" libdir="${extrasLibDirectory}"/>
</target>
<target name="-definePathsWithoutCopyingLibraries" if="_skipFetch_">
<path id="compilePath">
<fileset dir="${compileLibDirectory}" includes="**/*.jar"/>
</path>
<path id="runtimePath">
<fileset dir="${runtimeLibDirectory}" includes="**/*.jar"/>
</path>
<path id="testLibPath">
<fileset dir="${testLibDirectory}" includes="**/*.jar"/>
</path>
<path id="toolsPath">
<fileset dir="${toolsLibDirectory}" includes="**/*.jar"/>
</path>
<path id="examplesPath">
<fileset dir="${examplesLibDirectory}" includes="**/*.jar"/>
</path>
<path id="jdk14ExtrasPath">
<fileset dir="${extrasLibDirectory}" includes="**/*.jar"/>
</path>
</target>
<target name="-mavenDeployInit" depends="-mavenInit">
<artifact:install-provider artifactId="wagon-webdav" version="1.0-beta-2"/>
</target>
<macrodef name="definePath">
<attribute name="filesetId"/>
<attribute name="libdir"/>
<attribute name="pathId"/>
<sequential>
<mkdir dir="@{libdir}"/>
<copy todir="@{libdir}">
<mapper type="flatten"/>
<fileset refid="@{filesetId}"/>
</copy>
<path id="@{pathId}">
<fileset dir="@{libdir}" includes="**/*.jar"/>
</path>
</sequential>
</macrodef>
<macrodef name="mavenDeploy">
<attribute name="version"/>
<attribute name="prefix"/>
<sequential>
<artifact:deploy file="${targetDistDirectory}/@{prefix}-@{version}.jar">
<pom refid="@{prefix}.pom"/>
<attach file="${targetDistDirectory}/@{prefix}-@{version}-sources.jar" classifier="sources"/>
<attach file="${targetDistDirectory}/@{prefix}-@{version}-javadoc.jar" classifier="javadoc"/>
</artifact:deploy>
</sequential>
</macrodef>
<macrodef name="mavenInstallRepo">
<attribute name="version"/>
<attribute name="prefix"/>
<sequential>
<artifact:install file="${targetDistDirectory}/@{prefix}-@{version}.jar">
<pom refid="@{prefix}.pom"/>
<attach file="${targetDistDirectory}/@{prefix}-@{version}-sources.jar" classifier="sources"/>
<attach file="${targetDistDirectory}/@{prefix}-@{version}-javadoc.jar" classifier="javadoc"/>
</artifact:install>
</sequential>
</macrodef>
</project>