Author: mbenson Date: Fri Jun 23 15:16:41 2006 New Revision: 416828 URL: http://svn.apache.org/viewvc?rev=416828&view=rev Log: Extracted get-m2.xml from fetch.xml; modified so that a single run is sufficient even when DLing the m2 tasks.
Added: ant/core/trunk/get-m2.xml (with props) Modified: ant/core/trunk/fetch.xml Modified: ant/core/trunk/fetch.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/fetch.xml?rev=416828&r1=416827&r2=416828&view=diff ============================================================================== --- ant/core/trunk/fetch.xml (original) +++ ant/core/trunk/fetch.xml Fri Jun 23 15:16:41 2006 @@ -48,6 +48,7 @@ <!-- load in our properties table --> <property file="${lib.dir}/libraries.properties"/> + <import file="get-m2.xml" /> <target name="pick-dest"> <condition property="dest.dir" @@ -75,60 +76,7 @@ </target> - <target name="probe-m2" depends="pick-dest"> - <!-- Look for M2 ant tasks in our classpath--> - <property name="m2.artifact" location="${dest.dir}/${m2.jar.name}"/> - <available property="m2.antlib.found" - resource="org/apache/maven/artifact/ant/antlib.xml" /> - <condition property="m2.antlib.typefound"> - <typefound name="antlib:org.apache.maven.artifact.ant:artifact" /> - </condition> - </target> - - - <target name="download-m2" depends="probe-m2,pick-dest" unless="m2.antlib.found"> - <!-- fetch M2 ant tasks into our repository, if it is not there--> - <get src="${m2.antlib.url}" - dest="${m2.artifact}" - verbose="true" - usetimestamp="false"/> - </target> - - <target name="dont-validate-m2-checksum" depends="probe-m2" - if="m2.antlib.found"> - <property name="checksum.equal" value="true" /> - </target> - - <target name="validate-m2-checksum" - depends="download-m2,dont-validate-m2-checksum" - if="m2.sha1.checksum" unless="m2.antlib.found"> - <checksum file="${m2.artifact}" - algorithm="SHA" - property="${m2.sha1.checksum}" - verifyProperty="checksum.equal"/> - </target> - - <target name="checksum-mismatch" depends="validate-m2-checksum" - unless="checksum.equal" if="m2.sha1.checksum"> - <delete file="${m2.artifact}"/> - <fail > - Failed to verify the downloaded file ${m2.antlib.url}" against the checksum - coded into libraries.properties. - The local copy has been deleted, for security reasons - </fail> - </target> - - <target name="checksum-match" depends="checksum-mismatch" - unless="checksum.equal"> - <fail status="0"> - The Maven2 JAR has been installed; rerun Ant to load it. - </fail> - </target> - - <target name="get-m2" depends="checksum-match" - description="Download the Maven2 Ant tasks"/> - - <target name="macros" depends="get-m2" + <target name="macros" depends="pick-dest,get-m2" xmlns:artifact="antlib:org.apache.maven.artifact.ant"> <macrodef name="f2"> @@ -160,10 +108,7 @@ <!-- any init stuff --> - <target name="init" depends="pick-dest,macros" > - - </target> - + <target name="init" depends="macros" /> <target name="diag" depends="init"> Added: ant/core/trunk/get-m2.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/get-m2.xml?rev=416828&view=auto ============================================================================== --- ant/core/trunk/get-m2.xml (added) +++ ant/core/trunk/get-m2.xml Fri Jun 23 15:16:41 2006 @@ -0,0 +1,108 @@ +<?xml version="1.0"?> + +<!-- + ======================================================================= + Build file to fetch maven2 tasks; extracted from (Ant's) fetch.xml + + Copyright (c) 2005-2006 The Apache Software Foundation. All rights + reserved. + + ======================================================================= +--> +<project name="get-m2" default="get-m2" basedir="."> + +<description> + This build file downloads the Maven2 Ant tasks, + and installs them in the location specified by the dest.dir property. + + You may need to set proxy settings. On Java1.5, Ant tries to get + this from the OS, unless you use the -noproxy option. + + Proxies can be configured manually setting the JVM proxy values in the + ANT_OPTS environment variable. + + For example, to set the proxy up in the tcsh shell, the command would be + something like: + + For csh/tcsh: + setenv ANT_OPTS "-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080" + For bash: + export ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080" + For Windows, set the environment variable in the appropriate dialog box + and open a new console. or, by hand + set ANT_OPTS = -Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080 +</description> + + <property file="get-m2.properties" /> + + <property name="m2.antlib.resource" + value="org/apache/maven/artifact/ant/antlib.xml" /> + + <property name="m2.antlib.uri" + value="antlib:org.apache.maven.artifact.ant" /> + + <macrodef name="require"> + <attribute name="property" /> + <sequential> + <fail unless="@{property}">[EMAIL PROTECTED] not specified</fail> + </sequential> + </macrodef> + + <target name="probe-m2"> + <require property="dest.dir" /> + <require property="m2.jar.name" /> + + <!-- Look for M2 ant tasks in our classpath--> + <property name="m2.artifact" location="${dest.dir}/${m2.jar.name}" /> + <available property="m2.antlib.found" resource="${m2.antlib.resource}" /> + <condition property="m2.antlib.typefound"> + <typefound name="${m2.antlib.uri}:artifact" /> + </condition> + </target> + + <target name="download-m2" depends="probe-m2" unless="m2.antlib.found"> + <require property="m2.antlib.url" /> + <echo>Downloading to ${dest.dir}</echo> + + <mkdir dir="${dest.dir}" /> + <!-- fetch M2 ant tasks into our repository, if it is not there--> + <get src="${m2.antlib.url}" + dest="${m2.artifact}" + verbose="true" + usetimestamp="false" /> + </target> + + <target name="dont-validate-m2-checksum" depends="probe-m2" + if="m2.antlib.found"> + <property name="checksum.equal" value="true" /> + </target> + + <target name="validate-m2-checksum" + depends="download-m2,dont-validate-m2-checksum" + if="m2.sha1.checksum" unless="m2.antlib.found"> + <checksum file="${m2.artifact}" + algorithm="SHA" + property="${m2.sha1.checksum}" + verifyProperty="checksum.equal" /> + </target> + + <target name="checksum-mismatch" depends="validate-m2-checksum" + if="m2.sha1.checksum" unless="checksum.equal"> + <delete file="${m2.artifact}" /> + <fail> + Failed to verify the downloaded file ${m2.antlib.url}" against the checksum + coded into libraries.properties. + The local copy has been deleted, for security reasons + </fail> + </target> + + <target name="checksum-match" depends="checksum-mismatch" + unless="m2.antlib.found"> + <taskdef classpath="${m2.artifact}" resource="${m2.antlib.resource}" + uri="${m2.antlib.uri}" /> + </target> + + <target name="get-m2" depends="checksum-match" + description="Download the Maven2 Ant tasks" /> + +</project> Propchange: ant/core/trunk/get-m2.xml ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]