Author: rjung Date: Wed Sep 16 21:55:29 2009 New Revision: 815983 URL: http://svn.apache.org/viewvc?rev=815983&view=rev Log: Improve build.xml and build.properties.default for native trunk: - Add properties for javac settings - Add properties for downloading Tomcat src and Junit - Add download tasks from Tomcat trunk - Add task descriptions - Copy Java source files form Tomcat download during build - remove task compile-only - remove task examples and keep only compile-examples - rename the tasks for running examples in order to make output of "ant -p" a little more ordered
Modified: tomcat/native/trunk/build.properties.default tomcat/native/trunk/build.xml Modified: tomcat/native/trunk/build.properties.default URL: http://svn.apache.org/viewvc/tomcat/native/trunk/build.properties.default?rev=815983&r1=815982&r2=815983&view=diff ============================================================================== --- tomcat/native/trunk/build.properties.default (original) +++ tomcat/native/trunk/build.properties.default Wed Sep 16 21:55:29 2009 @@ -28,3 +28,34 @@ # The pathname of the "junit.jar" JAR file junit.jar = ${junit.home}/junit.jar + +# ----- Default Base Path for Dependent Packages ----- +# Please note this path must be absolute, not relative, +# as it is referenced with different working directory +# contexts by the various build scripts. +base.path=/usr/share/java +#base.path=C:/path/to/the/repository +#base.path=/usr/local + +compile.source=1.4 +compile.target=1.4 +compile.debug=off +compile.deprecation=on +compile.optimize=on + +base-tomcat.loc=http://archive.apache.org/dist/tomcat +base-sf.loc=http://downloads.sourceforge.net + +# ----- Tomcat native Java sources ----- +tomcat.version=6.0.20 +tomcat.home=${base.path}/tomcat-${tomcat.version} +tomcat.tar.gz=${tomcat.home}/tomcat.tar.gz +tomcat.loc=${base-tomcat.loc}/tomcat-6/v${tomcat.version}/src/apache-tomcat-${tomcat.version}-src.tar.gz +tomcat.src=${base.path}/apache-tomcat-${tomcat.version}-src + +# ----- JUnit Unit Test Suite, version 3.7 or later ----- +junit.home=${base.path}/junit3.8.2 +junit.lib=${junit.home} +junit.jar=${junit.lib}/junit.jar +junit.loc=${base-sf.loc}/junit/junit3.8.2.zip + Modified: tomcat/native/trunk/build.xml URL: http://svn.apache.org/viewvc/tomcat/native/trunk/build.xml?rev=815983&r1=815982&r2=815983&view=diff ============================================================================== --- tomcat/native/trunk/build.xml (original) +++ tomcat/native/trunk/build.xml Wed Sep 16 21:55:29 2009 @@ -54,9 +54,11 @@ <property name="dist.root" value="./dist"/> <property name="ant.home" value="."/> - <property name="debug" value="off"/> - <property name="optimize" value="on"/> - <property name="deprecation" value="on"/> + <property name="compile.source" value="1.4"/> + <property name="compile.target" value="1.4"/> + <property name="compile.debug" value="off"/> + <property name="compile.optimize" value="on"/> + <property name="compile.deprecation" value="on"/> <property name="docs.src" value="./xdocs"/> <property name="docs.dest" value="${dist.root}/doc"/> @@ -104,6 +106,65 @@ <mkdir dir="${build.dir}"/> </target> + <!-- Download and dependency building --> + <target name="proxyflags"> + <!-- check proxy parameters. --> + <condition property="useproxy"> + <equals arg1="${proxy.use}" arg2="on" /> + </condition> + </target> + + <target name="setproxy" depends="proxyflags" if="useproxy"> + <taskdef name="setproxy" + classname="org.apache.tools.ant.taskdefs.optional.net.SetProxy" /> + <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" + proxyuser="${proxy.user}" proxypassword="${proxy.password}" /> + <echo message="Using ${proxy.host}:${proxy.port} to download ${sourcefile}"/> + </target> + + <target name="testexist"> + <echo message="Testing for ${destfile}"/> + <available file="${destfile}" property="exist"/> + </target> + + <target name="downloadgz" unless="exist" depends="setproxy,testexist"> + <!-- Download and extract the package --> + <get src="${sourcefile}" dest="${base.path}/file.tar.gz" /> + <gunzip src="${base.path}/file.tar.gz" dest="${base.path}/file.tar"/> + <untar src="${base.path}/file.tar" dest="${base.path}"/> + <delete file="${base.path}/file.tar"/> + <delete file="${base.path}/file.tar.gz"/> + </target> + + <target name="downloadzip" unless="exist" depends="setproxy,testexist"> + <!-- Download and extract the package --> + <get src="${sourcefile}" dest="${base.path}/file.zip" /> + <mkdir dir="${destdir}" /> + <unzip src="${base.path}/file.zip" dest="${destdir}"/> + <delete file="${base.path}/file.zip"/> + </target> + + <target name="downloadfile" unless="exist" depends="setproxy,testexist"> + <!-- Download extract the file --> + <mkdir dir="${destdir}" /> + <get src="${sourcefile}" dest="${destfile}" /> + </target> + + <target name="download" description="Download needed dependencies"> + + <mkdir dir="${base.path}"/> + <antcall target="downloadgz"> + <param name="sourcefile" value="${tomcat.loc}"/> + <param name="destfile" value="${tomcat.src}"/> + </antcall> + + <antcall target="downloadzip"> + <param name="sourcefile" value="${junit.loc}"/> + <param name="destfile" value="${junit.jar}"/> + <param name="destdir" value="${base.path}"/> + </antcall> + </target> + <!-- =================================================================== --> <!-- Creates the API documentation --> <!-- =================================================================== --> @@ -138,14 +199,14 @@ <!-- =================================================================== --> <!-- Cleans up the build directory --> <!-- =================================================================== --> - <target name="clean"> + <target name="clean" description="Clean build directory"> <delete dir="${build.dir}"/> </target> <!-- =================================================================== --> <!-- Compiles the source directory --> <!-- =================================================================== --> - <target name="compile" depends="prepare"> + <target name="compile" depends="prepare" description="Compile Java sources"> <mkdir dir="${build.dest}"/> <mkdir dir="${build.dest}/java"/> <mkdir dir="${build.src}"/> @@ -154,6 +215,12 @@ <format property="TODAY" pattern="MMM d yyyy" locale="en"/> <format property="TSTAMP" pattern="hh:mm:ss"/> </tstamp> + <!-- Copy Java sources from Tomcat source download --> + <copy todir="${src.dir}/java" preservelastmodified="true"> + <fileset dir="${base.path}/apache-tomcat-${tomcat.version}-src/java"> + <include name="org/apache/tomcat/jni/"/> + </fileset> + </copy> <!-- Copy static resource files --> <filter token="VERSION" value="${version}"/> <filter token="VERSION_NUMBER" value="${version.number}"/> @@ -168,12 +235,15 @@ <javac srcdir="${build.src}/java" destdir="${build.dest}/java" - debug="${debug}" - deprecation="${deprecation}" - optimize="${optimize}" + source="${compile.source}" + target="${compile.target}" + debug="${compile.debug}" + deprecation="${compile.deprecation}" + optimize="${compile.optimize}" encoding="ISO-8859-1"> <classpath refid="classpath"/> </javac> + <copy todir="${build.dest}/java" filtering="yes" encoding="ISO-8859-1"> <fileset dir="${build.src}/java"> <include name="**/*.xml"/> @@ -182,67 +252,10 @@ </copy> </target> - <target name="compile-only" - description="Compile shareable components"> - - <javac srcdir="${source.home}" - destdir="${build.home}/classes" - debug="${compile.debug}" - deprecation="${compile.deprecation}" - optimize="${compile.optimize}" - encoding="ISO-8859-1"> - <classpath refid="classpath"/> - </javac> - <copy todir="${build.home}/classes" filtering="on" encoding="ISO-8859-1"> - <fileset dir="${source.home}" excludes="**/*.java"/> - </copy> - </target> - - <!-- =================================================================== --> - <!-- Compiles the examples directory --> - <!-- =================================================================== --> - <target name="examples" depends="compile"> - <mkdir dir="${build.dest}"/> - <mkdir dir="${build.dest}/examples"/> - <mkdir dir="${build.src}"/> - <mkdir dir="${build.src}/examples"/> - <tstamp> - <format property="TODAY" pattern="MMM d yyyy" locale="en"/> - <format property="TSTAMP" pattern="hh:mm:ss"/> - </tstamp> - <!-- Copy static resource files --> - <filter token="VERSION" value="${version}"/> - <filter token="VERSION_NUMBER" value="${version.number}"/> - <filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/> - <copy todir="${build.src}/examples" filtering="yes" encoding="ISO-8859-1"> - <fileset dir="${src.dir}/examples"> - <include name="**/*.java"/> - <include name="**/*.xml"/> - <include name="**/*.properties"/> - </fileset> - </copy> - - <javac srcdir="${build.src}/examples" - destdir="${build.dest}/examples" - debug="${debug}" - deprecation="${deprecation}" - optimize="${optimize}" - encoding="ISO-8859-1"> - <classpath refid="examples.classpath"/> - </javac> - <copy todir="${build.dest}/examples" filtering="yes" encoding="ISO-8859-1"> - <fileset dir="${build.src}/examples"> - <include name="**/*.xml"/> - <include name="**/*.properties"/> - </fileset> - </copy> - </target> - <!-- ================================================================== --> <!-- Make Tomcat Native jar --> <!-- ================================================================== --> - <target name="jar" depends="compile" - description="Generates the Jar file"> + <target name="jar" depends="compile" description="Generates the Jar file"> <jar destfile="${build.dir}/${final.name}.jar" basedir="${build.dir}/classes/java" @@ -264,9 +277,19 @@ <!-- =================================================================== --> <!-- Compiles the test directory --> <!-- =================================================================== --> - <target name="compile-tests" depends="compile"> + <target name="compile-tests" depends="compile" description="Compile Java test classes"> + <mkdir dir="${build.dest}"/> <mkdir dir="${build.dest}/test"/> + <mkdir dir="${build.src}"/> <mkdir dir="${build.src}/test"/> + <tstamp> + <format property="TODAY" pattern="MMM d yyyy" locale="en"/> + <format property="TSTAMP" pattern="hh:mm:ss"/> + </tstamp> + <!-- Copy static resource files --> + <filter token="VERSION" value="${version}"/> + <filter token="VERSION_NUMBER" value="${version.number}"/> + <filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/> <copy todir="${build.src}/test" filtering="yes" encoding="ISO-8859-1"> <fileset dir="${src.dir}/test"> <include name="**/*.java"/> @@ -276,18 +299,26 @@ </copy> <javac srcdir="${build.src}/test" destdir="${build.dest}/test" + source="${compile.source}" + target="${compile.target}" debug="on" - deprecation="${deprecation}" - optimize="${optimize}" + deprecation="${compile.deprecation}" + optimize="${compile.optimize}" encoding="ISO-8859-1"> <classpath refid="test.classpath"/> </javac> + <copy todir="${build.dest}/test" filtering="yes" encoding="ISO-8859-1"> + <fileset dir="${build.src}/test"> + <include name="**/*.xml"/> + <include name="**/*.properties"/> + </fileset> + </copy> </target> <!-- =================================================================== --> <!-- Junit tests --> <!-- =================================================================== --> - <target name="test" depends="compile-tests"> + <target name="test" depends="compile-tests" description="Run the tests"> <echo message="Running Tomcat Native package tests ..."/> <java dir="${test.dir}" classname="${test.runner}" fork="yes" failonerror="${test.failonerror}"> <arg value="org.apache.tomcat.jni.FileTestSuite"/> @@ -308,9 +339,19 @@ <!-- =================================================================== --> <!-- Compiles the examples directory --> <!-- =================================================================== --> - <target name="compile-examples" depends="compile"> + <target name="compile-examples" depends="compile" description="Compile example Java classes"> + <mkdir dir="${build.dest}"/> <mkdir dir="${build.dest}/examples"/> + <mkdir dir="${build.src}"/> <mkdir dir="${build.src}/examples"/> + <tstamp> + <format property="TODAY" pattern="MMM d yyyy" locale="en"/> + <format property="TSTAMP" pattern="hh:mm:ss"/> + </tstamp> + <!-- Copy static resource files --> + <filter token="VERSION" value="${version}"/> + <filter token="VERSION_NUMBER" value="${version.number}"/> + <filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/> <copy todir="${build.src}/examples" filtering="yes" encoding="ISO-8859-1"> <fileset dir="${src.dir}/examples"> <include name="**/*.java"/> @@ -320,18 +361,26 @@ </copy> <javac srcdir="${build.src}/examples" destdir="${build.dest}/examples" - debug="${debug}" - deprecation="${deprecation}" - optimize="${optimize}" + source="${compile.source}" + target="${compile.target}" + debug="${compile.debug}" + deprecation="${compile.deprecation}" + optimize="${compile.optimize}" encoding="ISO-8859-1"> <classpath refid="examples.classpath"/> </javac> + <copy todir="${build.dest}/examples" filtering="yes" encoding="ISO-8859-1"> + <fileset dir="${build.src}/examples"> + <include name="**/*.xml"/> + <include name="**/*.properties"/> + </fileset> + </copy> </target> <!-- =================================================================== --> - <!-- excutes the examples --> + <!-- executes the examples --> <!-- =================================================================== --> - <target name="echo-example" depends="examples"> + <target name="run-echo" depends="compile-examples" description="Run the Echo example"> <echo message="Running Tomcat Native Echo example ..."/> <java dir="${examples.dir}" classname="org.apache.tomcat.jni.Echo" fork="yes" failonerror="${test.failonerror}"> @@ -341,7 +390,7 @@ <jvmarg value="-Djava.library.path=${tc.library.path}"/> </java> </target> - <target name="server-example" depends="examples"> + <target name="run-ssl-server" depends="compile-examples" description="Run the SSL Server example"> <echo message="Running Tomcat Native SSL Server example ..."/> <java dir="${examples.dir}" classname="org.apache.tomcat.jni.SSLServer" fork="yes" failonerror="${test.failonerror}"> @@ -351,7 +400,7 @@ <jvmarg value="-Djava.library.path=${tc.library.path}"/> </java> </target> - <target name="locals-example" depends="examples"> + <target name="run-local-server" depends="compile-examples" description="Run the Local Server example"> <echo message="Running Tomcat Native Local Server example ..."/> <java dir="${examples.dir}" classname="org.apache.tomcat.jni.LocalServer" fork="yes" failonerror="${test.failonerror}"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org