Replaced maven-generated ant build with standalone version adapted from [io].

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@737417 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2009-01-24 18:44:58 +00:00
parent 3ffa187429
commit b5f0d0e102
1 changed files with 322 additions and 170 deletions

480
build.xml
View File

@ -1,185 +1,337 @@
<?xml version="1.0" encoding="UTF-8"?> <!--
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
<!--build.xml generated by maven from project.xml version 1.2-RC2 http://www.apache.org/licenses/LICENSE-2.0
on date April 24 2008, time 1634-->
<project default="jar" name="commons-math" basedir="."> Unless required by applicable law or agreed to in writing, software
<property name="defaulttargetdir" value="target"> distributed under the License is distributed on an "AS IS" BASIS,
</property> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<property name="libdir" value="target/lib"> See the License for the specific language governing permissions and
</property> limitations under the License.
<property name="classesdir" value="target/classes"> -->
</property> <project name="Commons IO" default="jar" basedir=".">
<property name="testclassesdir" value="target/test-classes">
</property>
<property name="testclassesdir" value="target/test-classes"> <!--
</property> "Math" component of the Apache Commons Project
<property name="testreportdir" value="target/test-reports"> $Id:$
</property> $Revision:$ $Date:$
<property name="distdir" value="dist"> -->
</property>
<property name="javadocdir" value="dist/docs/api">
</property> <!-- ========== Initialize Properties ===================================== -->
<property name="final.name" value="commons-math-1.2-RC2">
</property> <property file="build.properties"/> <!-- Component local -->
<path id="build.classpath"> <property file="${user.home}/build.properties"/> <!-- User local -->
<fileset dir="${libdir}">
<include name="**/*.jar">
</include> <!-- ========== External Dependencies ===================================== -->
</fileset>
<!-- Junit -->
<property name="junit.version" value="4.4"/>
<property name="junit.home" value="/usr/share/junit"/>
<property name="junit.jar" value="${junit.home}/junit-${junit.version}.jar"/>
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="component.name" value="commons-math"/>
<!-- The primary package name of this component -->
<property name="component.package" value="org.apache.commons.math"/>
<!-- The title of this component -->
<property name="component.title" value="Commons MATH"/>
<!-- The current version number of this component -->
<property name="component.version" value="2.0-SNAPSHOT"/>
<!-- The base directory for component sources -->
<property name="source.home" value="src/java"/>
<!-- The base directory for unit test sources -->
<property name="test.home" value="src/test"/>
<!-- Download lib dir -->
<property name="download.lib.dir" value="lib"/>
<!-- The base directory for compilation targets -->
<property name="build.home" value="target"/>
<!-- The base directory for distribution targets -->
<property name="dist.home" value="${build.home}/dist"/>
<!-- Base file name for dist files -->
<property name="final.name" value="${component.name}-${component.version}"/>
<!-- Directory where binary release files are staged -->
<property name="stage.bin.dir" value="${dist.home}/stage-bin"/>
<!-- Directory where source release files are staged -->
<property name="stage.src.dir" value="${dist.home}/stage-src"/>
<!-- ========== Compiler Defaults ========================================= -->
<!-- Should Java compilations set the 'debug' compiler option? -->
<property name="compile.debug" value="true"/>
<!-- Should Java compilations set the 'deprecation' compiler option? -->
<property name="compile.deprecation" value="false"/>
<!-- Should Java compilations set the 'optimize' compiler option? -->
<property name="compile.optimize" value="true"/>
<!-- JDK level -->
<property name="compile.source" value="1.5"/>
<property name="compile.target" value="1.5"/>
<!-- Base compile classpath -->
<path id="compile.classpath">
<pathelement location="${build.home}/classes"/>
</path> </path>
<target name="init" description="o Initializes some properties">
<mkdir dir="${libdir}">
</mkdir>
<condition property="noget">
<equals arg2="only" arg1="${build.sysclasspath}">
</equals>
</condition>
<!--Test if JUNIT is present in ANT classpath-->
<available property="Junit.present" classname="junit.framework.Test"> <!-- External dependency classpath -->
</available> <path id="downloaded.lib.classpath">
<pathelement location="${download.lib.dir}/junit-${junit.version}.jar"/>
</path>
<!-- ========== Test Execution Defaults =================================== -->
<!-- Construct unit test classpath -->
<path id="test.classpath">
<pathelement location="${build.home}/classes"/>
<pathelement location="${build.home}/test-classes"/>
<pathelement location="${junit.jar}"/>
<path refid="downloaded.lib.classpath"/>
</path>
<!-- Should the build fail if there are test failures? -->
<property name="test.failonerror" value="true"/>
<!-- ========== Executable Targets ======================================== -->
<target name="clean" description="Clean build and distribution directories">
<delete dir="${build.home}"/>
</target> </target>
<target name="compile" description="o Compile the code" depends="get-deps">
<mkdir dir="${classesdir}">
</mkdir> <target name="init"
<javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html"> description="Initialize and evaluate conditionals">
<src> <echo message="-------- ${component.title} ${component.version} --------"/>
<pathelement location="src/java"> <filter token="name" value="${component.name}"/>
</pathelement> <filter token="package" value="${component.package}"/>
</src> <filter token="version" value="${component.version}"/>
<classpath refid="build.classpath"> <filter token="compilesource" value="${compile.source}"/>
</classpath> <filter token="compiletarget" value="${compile.target}"/>
<tstamp/>
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/classes"/>
<mkdir dir="${build.home}/test-classes"/>
</target>
<!-- ========== Compile Targets =========================================== -->
<target name="compile" depends="init" description="Compile">
<javac srcdir="${source.home}"
destdir="${build.home}/classes"
source="${compile.source}"
target="${compile.target}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac> </javac>
<mkdir dir="${classesdir}/META-INF"> </target>
</mkdir>
<copy todir="${classesdir}/META-INF">
<fileset dir="."> <!-- ========== Unit Test Targets ========================================= -->
<include name="NOTICE.txt">
</include> <target name="compile.tests" depends="compile, download-dependencies" description="Compile unit tests.">
<javac srcdir="${test.home}"
destdir="${build.home}/test-classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="test.classpath"/>
</javac>
<copy todir="${build.home}/test-classes">
<fileset dir="${test.home}">
<include name="**/*.xml"/>
<include name="**/*.txt"/>
</fileset> </fileset>
</copy> </copy>
</target> </target>
<target name="jar" description="o Create the jar" depends="compile,test">
<jar jarfile="${defaulttargetdir}/${final.name}.jar" excludes="**/package.html" basedir="${classesdir}"> <target name="test" depends="compile.tests"
</jar> description="Run unit tests">
</target> <junit printsummary="true"
<target name="clean" description="o Clean up the generated directories"> errorProperty="test.failed"
<delete dir="${defaulttargetdir}"> failureProperty="test.failed"
</delete> fork="true"
<delete dir="${distdir}"> showOutput="true">
</delete> <formatter usefile="false" type="plain"/>
</target> <classpath refid="test.classpath"/>
<target name="dist" description="o Create a distribution" depends="jar, javadoc"> <batchtest>
<mkdir dir="dist"> <fileset dir="${test.home}" includes="**/*Test.java"
</mkdir> excludes="**/*AbstractTest.java"/>
<copy todir="dist">
<fileset dir="${defaulttargetdir}" includes="*.jar">
</fileset>
<fileset dir="${basedir}" includes="LICENSE*, README*">
</fileset>
</copy>
</target>
<target name="test" description="o Run the test cases" if="test.failure" depends="internal-test">
<fail message="There were test failures.">
</fail>
</target>
<target name="internal-test" if="Junit.present" depends="junit-present,compile-tests">
<mkdir dir="${testreportdir}">
</mkdir>
<junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
<sysproperty key="basedir" value=".">
</sysproperty>
<formatter type="xml">
</formatter>
<formatter usefile="false" type="plain">
</formatter>
<classpath>
<path refid="build.classpath">
</path>
<pathelement path="${testclassesdir}">
</pathelement>
<pathelement path="${classesdir}">
</pathelement>
</classpath>
<batchtest todir="${testreportdir}">
<fileset dir="src/test">
<include name="**/*Test.java">
</include>
<exclude name="**/*AbstractTest.java">
</exclude>
</fileset>
</batchtest> </batchtest>
</junit> </junit>
<fail message="There were test failures.">
<condition>
<and>
<istrue value="${test.failonerror}"/>
<isset property="test.failed"/>
</and>
</condition>
</fail>
</target> </target>
<target name="junit-present" unless="Junit.present" depends="init">
<echo>================================= WARNING ================================</echo>
<echo>Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed.</echo> <!-- ========== Produce JavaDocs ========================================== -->
<echo>==========================================================================</echo>
</target> <target name="javadoc" depends="compile" description="Create component Javadoc documentation">
<target name="compile-tests" if="Junit.present" depends="junit-present,compile"> <mkdir dir="${build.home}/apidocs"/>
<mkdir dir="${testclassesdir}">
</mkdir>
<javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
<src>
<pathelement location="src/test">
</pathelement>
</src>
<classpath>
<path refid="build.classpath">
</path>
<pathelement path="${classesdir}">
</pathelement>
</classpath>
</javac>
<copy todir="${testclassesdir}">
<fileset dir="src/test">
<include name="**/*.xml">
</include>
<include name="**/*.txt">
</include>
</fileset>
</copy>
</target>
<target name="javadoc" description="o Generate javadoc" depends="get-deps">
<mkdir dir="${javadocdir}">
</mkdir>
<tstamp> <tstamp>
<format pattern="2003-yyyy" property="year"> <format property="current.year" pattern="yyyy"/>
</format>
</tstamp> </tstamp>
<property name="copyright" value="Copyright &amp;copy; The Apache Software Foundation. All Rights Reserved."> <javadoc sourcepath="${source.home}"
</property> destdir="${build.home}/apidocs"
<property name="title" value="Math 1.2-RC2 API"> packagenames="org.apache.commons.*"
</property> author="true"
<javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="src/java" packagenames="org.apache.commons.math.*"> private="true"
<classpath> version="true"
<path refid="build.classpath"> doctitle="&lt;h1&gt;${component.title} ${component.version}&lt;/h1&gt;"
</path> windowtitle="${component.title} ${component.version}"
</classpath> bottom="Copyright (c) 2003-${current.year} Apache Software Foundation"
classpathref="compile.classpath">
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
<link href="http://commons.apache.org/collections/api"/>
</javadoc> </javadoc>
</target> </target>
<target name="get-deps" unless="noget" depends="init">
<!--Proxy settings works only with a JDK 1.2 and higher.-->
<echo>Proxy used :</echo>
<echo>Proxy host [${proxy.host}]</echo> <!-- ========== Create Jar ================================================ -->
<echo>Proxy port [${proxy.port}]</echo>
<echo>Proxy user [${proxy.username}]</echo> <target name="jar" depends="test" description="Create jar file">
<setproxy proxyuser="${proxy.username}" proxyport="${proxy.port}" proxypassword="${proxy.password}" proxyhost="${proxy.host}">
</setproxy> <mkdir dir="${build.home}/classes/META-INF"/>
<get dest="${libdir}/maven-cobertura-plugin-1.1.1.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/maven-plugins/plugins/maven-cobertura-plugin-1.1.1.jar"> <copy file="LICENSE.txt" tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
</get> <copy file="NOTICE.txt" tofile="${build.home}/classes/META-INF/NOTICE.txt"/>
<get dest="${libdir}/maven-xdoc-plugin-1.9.2.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/maven/plugins/maven-xdoc-plugin-1.9.2.jar">
</get> <manifest file="${build.home}/MANIFEST.MF">
<attribute name="Specification-Title" value="${component.title}"/>
<attribute name="Specification-Version" value="${component.version}"/>
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="${component.title}"/>
<attribute name="Implementation-Version" value="${component.version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="X-Compile-Source-JDK" value="${compile.source}"/>
<attribute name="X-Compile-Target-JDK" value="${compile.target}"/>
</manifest>
<jar jarfile="${build.home}/${final.name}.jar"
basedir="${build.home}/classes"
manifest="${build.home}/MANIFEST.MF"/>
</target> </target>
<target name="noProxy" unless="useProxy" depends="init">
<echo>Proxy not used.</echo>
<!-- ========== Distribution Target =========================================== -->
<target name="dist" depends="clean,jar,javadoc" description="Create distribution artifacts">
<mkdir dir="${dist.home}"/>
<!-- jar(s) -->
<copy todir="${dist.home}">
<fileset dir=".">
<include name="RELEASE-NOTES.txt"/>
</fileset>
<fileset dir="${build.home}">
<include name="*.jar"/>
</fileset>
</copy>
<!-- Binary Distro -->
<mkdir dir="${stage.bin.dir}/${final.name}"/>
<copy todir="${stage.bin.dir}/${final.name}">
<fileset dir=".">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
<include name="RELEASE-NOTES.txt"/>
</fileset>
<fileset dir="${build.home}">
<include name="*.jar"/>
</fileset>
</copy>
<copy todir="${stage.bin.dir}/${final.name}/apidocs">
<fileset dir="${build.home}/apidocs" />
</copy>
<!-- Source Distro -->
<mkdir dir="${stage.src.dir}/${final.name}-src"/>
<copy todir="${stage.src.dir}/${final.name}-src">
<fileset dir=".">
<include name="*.xml"/>
<include name="*.txt"/>
<include name="*.html"/>
</fileset>
</copy>
<copy todir="${stage.src.dir}/${final.name}-src/src">
<fileset dir="src" excludes="mantissa/**,experimental/**" />
</copy>
<zip zipfile="${dist.home}/${final.name}.zip" basedir="${stage.bin.dir}"/>
<zip zipfile="${dist.home}/${final.name}-src.zip" basedir="${stage.src.dir}"/>
<tar tarfile="${dist.home}/${final.name}.tar" basedir="${stage.bin.dir}" longfile="gnu"/>
<tar tarfile="${dist.home}/${final.name}-src.tar" basedir="${stage.src.dir}" longfile="gnu"/>
<gzip src="${dist.home}/${final.name}.tar" zipfile="${dist.home}/${final.name}.tar.gz"/>
<gzip src="${dist.home}/${final.name}-src.tar" zipfile="${dist.home}/${final.name}-src.tar.gz"/>
<!-- clean up staging directories -->
<delete dir="${stage.bin.dir}"/>
<delete dir="${stage.src.dir}"/>
</target> </target>
<target name="install-maven">
<get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar">
</get> <!-- ========== Gump Target ===================================================== -->
<unjar dest="${maven.home}" src="${user.home}/maven-install-latest.jar">
</unjar> <target name="gump" depends="clean,test,javadoc,jar" description="Gump Target - clean,test,javadoc,jar"/>
<!-- ========== Download Dependencies =========================================== -->
<target name="download-dependencies"
depends="check-availability" unless="skip.download">
<echo message="doing download-dependencies..." />
<antcall target="download-junit" />
</target> </target>
<target name="check-availability">
<echo message="doing check-availability..." />
<available file="${junit.jar}" property="junit.found"/>
</target>
<target name="download-junit" unless="junit.found">
<echo message="Downloading junit..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/junit-${junit.version}.jar"
usetimestamp="true" ignoreerrors="true"
src="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/>
</target>
</project> </project>