git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273440 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -19,14 +19,44 @@ | |||||
| <property name="commons-discovery.jar" location="${commons.src}/discovery/dist/commons-discovery.jar" /> | <property name="commons-discovery.jar" location="${commons.src}/discovery/dist/commons-discovery.jar" /> | ||||
| <target name="build" depends="main" /> | |||||
| <target name="main"> | <target name="main"> | ||||
| <mkdir dir="build/classes" /> | <mkdir dir="build/classes" /> | ||||
| <javac srcdir="src/java" | <javac srcdir="src/java" | ||||
| debug="${debug}" | debug="${debug}" | ||||
| destdir="${embed.build}/classes" > | destdir="${embed.build}/classes" > | ||||
| <include name="**" /> | <include name="**" /> | ||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/**" /> | |||||
| </javac> | |||||
| <copy toDir="${embed.build}/classes"> | |||||
| <fileset dir="src/java" includes="META-INF/**" /> | |||||
| </copy> | |||||
| <jar file="${embed.build}/ant-sax2.jar" basedir="${embed.build}/classes" | |||||
| manifest="src/java/META-INF/MANIFEST" > | |||||
| <include name="**" /> | |||||
| </jar> | |||||
| <echo message="${embed.build}/ant-sax2.jar toDir=${ant.home}/lib"/> | |||||
| <copy file="${embed.build}/ant-sax2.jar" toDir="${ant.home}/lib"/> | |||||
| <copy file="${commons-logging.jar}" toDir="${ant.home}/lib"/> | |||||
| <copy file="${commons-discovery.jar}" toDir="${ant.home}/lib"/> | |||||
| <copy file="${commons-logging.jar}" toDir="${embed.build}"/> | |||||
| <copy file="${commons-discovery.jar}" toDir="${embed.build}"/> | |||||
| </target> | |||||
| <target name="embed-optional"> | |||||
| <mkdir dir="build/classes" /> | |||||
| <javac srcdir="src/java" | |||||
| debug="${debug}" | |||||
| destdir="${embed.build}/classes" > | |||||
| <include name="org/apache/tools/ant/taskdefs/optional/**" /> | |||||
| <classpath> | <classpath> | ||||
| <!-- all this will move to their package --> | <!-- all this will move to their package --> | ||||
| <pathelement location="build/classes" /> | |||||
| <pathelement location="${jxpath.jar}" /> | <pathelement location="${jxpath.jar}" /> | ||||
| <pathelement location="${velocity.jar}" /> | <pathelement location="${velocity.jar}" /> | ||||
| <pathelement location="${jexl.jar}" /> | <pathelement location="${jexl.jar}" /> | ||||
| @@ -38,11 +68,27 @@ | |||||
| <fileset dir="src/java" includes="META-INF/**" /> | <fileset dir="src/java" includes="META-INF/**" /> | ||||
| </copy> | </copy> | ||||
| <jar file="${embed.build}/ant-sax2.jar" basedir="${embed.build}/classes" > | |||||
| <include name="**" /> | |||||
| <jar file="${embed.build}/optional-dynprop.jar" basedir="${embed.build}/classes" | |||||
| manifest="src/java/META-INF/MANIFEST" > | |||||
| <include name="org/apache/tools/ant/taskdefs/optional/**" /> | |||||
| </jar> | </jar> | ||||
| <echo message="${embed.build}/ant-sax2.jar toDir=${ant.home}/lib"/> | |||||
| <copy file="${embed.build}/ant-sax2.jar" toDir="${ant.home}/lib"/> | <copy file="${embed.build}/ant-sax2.jar" toDir="${ant.home}/lib"/> | ||||
| <copy file="${commons-logging.jar}" toDir="${ant.home}/lib"/> | |||||
| <copy file="${commons-discovery.jar}" toDir="${ant.home}/lib"/> | |||||
| <copy file="${commons-logging.jar}" toDir="${embed.build}"/> | |||||
| <copy file="${commons-discovery.jar}" toDir="${embed.build}"/> | |||||
| </target> | </target> | ||||
| <target name="gump" description="Patch gump bootstrap ant" depends="main" > | |||||
| <!-- What we'll do - in order to get around gump classpath use - is | |||||
| to recreate ant.jar ( using build/classes ) to include our code --> | |||||
| <unjar jar="${ant.src}/bootstrap/lib/ant.jar" dest="${embed.build}/classes" /> | |||||
| <delete file="${ant.src}/bootstrap/lib/ant.jar" /> | |||||
| <jar file="${ant.src}/bootstrap/lib/ant.jar" basedir="${embed.build}/classes" | |||||
| manifest="${embed.build}/classes/META-INF/MANIFEST" includes="**" /> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -2,10 +2,12 @@ | |||||
| <property name="ant.src" location="../.."/> | <property name="ant.src" location="../.."/> | ||||
| <import file="build.xml"/> | <import file="build.xml"/> | ||||
| <target name="main"> | |||||
| <echo>Base.path from build.xml ( in top level ): ${base.path}</echo> | |||||
| <target name="init"> | |||||
| <property name="junit.jar" location="${base.path}/junit3.7/junit.jar"/> | <property name="junit.jar" location="${base.path}/junit3.7/junit.jar"/> | ||||
| <echo>${junit.jar} ${velocity.jar}</echo> | |||||
| <echo>Base.path from build.xml ( in init ) : ${base.path}</echo> | |||||
| <path id="myJars" > | <path id="myJars" > | ||||
| <pathelement path="${junit.jar}" /> | <pathelement path="${junit.jar}" /> | ||||
| @@ -16,14 +18,39 @@ | |||||
| <pathelement path="${commons-discovery.jar}" /> | <pathelement path="${commons-discovery.jar}" /> | ||||
| <pathelement path="${commons-logging.jar}" /> | <pathelement path="${commons-logging.jar}" /> | ||||
| <pathelement path="${ant.home}/lib/ant-sax2.jar" /> | <pathelement path="${ant.home}/lib/ant-sax2.jar" /> | ||||
| <pathelement location="/usr/share/java/xalan-j_2_3_1/bin/xercesImpl.jar"/> | |||||
| <pathelement location="${ant.home}/lib/xercesImpl.jar"/> | |||||
| <pathelement location="${ant.home}/lib/xml-apis.jar"/> | |||||
| <pathelement location="${ant.home}/lib/ant.jar"/> | |||||
| </path> | </path> | ||||
| <systemPath pathRef="myJars"/> | <systemPath pathRef="myJars"/> | ||||
| </target> | |||||
| <target name="discovery" depends="init"> | |||||
| <echo message="${commons-discovery.jar}"/> | |||||
| <systemPath pathRef="myJars"/> | |||||
| <taskdef classname="org.apache.tools.ant.taskdefs.ServiceDiscoveryTask" | |||||
| name="discovery" /> | |||||
| <taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPath" | |||||
| name="jxpath" /> | |||||
| <jxpath/> | |||||
| <discovery debug="1" id="myDiscovery" | |||||
| serviceName="META-INF/services/javax.xml.parsers.SAXParserFactory" /> | |||||
| <echo message="Found ${jxpath:/references[@name='myDiscovery']}" /> | |||||
| </target> | |||||
| <target name="systemPathTest" depends="init"> | |||||
| <junit id="replacedJunit" /> | <junit id="replacedJunit" /> | ||||
| <echo message="toString sample: ${toString:replacedJunit}" /> | |||||
| <echo message="Found JUNIT: ${toString:replacedJunit}" /> | |||||
| </target> | |||||
| <target name="dynamicProperties" depends="init"> | |||||
| <!-- This is Taksdef2.java - it'll use the systemPath as parent loader | <!-- This is Taksdef2.java - it'll use the systemPath as parent loader | ||||
| --> | --> | ||||
| <taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPath" | <taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPath" | ||||
| @@ -39,8 +66,15 @@ | |||||
| <jxpath/> | <jxpath/> | ||||
| <velocityProperties/> | <velocityProperties/> | ||||
| <jexlProperties/> | <jexlProperties/> | ||||
| <echo id="foo" message="Starting dynamic props tests" /> | |||||
| <echo message="Value: ${vm:$ant.references.jxpathTask.foo}" /> | |||||
| <jxpathSet path="/references[@name='jxpathTask']/foo" value="Test"/> | |||||
| <echo message="Value: ${vm:$ant.references.jxpathTask.foo}" /> | |||||
| <echo message="vel /references/myJars: ${vm:$ant.references.myJars}" /> | |||||
| <echo message="${jexl:ant.references.jxpathTask.foo=bar}" /> | |||||
| <echo message="Value: ${vm:$ant.references.jxpathTask.foo}" /> | |||||
| <echo message="jexl /references/myJars: ${jexl:ant.references.myJars}" /> | <echo message="jexl /references/myJars: ${jexl:ant.references.myJars}" /> | ||||
| @@ -57,7 +91,9 @@ | |||||
| <echo message="XMLDOM: ${jxpath:/references/test.xml/root/project/@name}" /> | <echo message="XMLDOM: ${jxpath:/references/test.xml/root/project/@name}" /> | ||||
| </target> | |||||
| <target name="main" depends="init,dynamicProperties,systemPathTest,test-import"> | |||||
| </target> | </target> | ||||