commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject [math] Fixed ant build.
Date Sat, 02 Jan 2016 17:30:58 GMT
Repository: commons-math
Updated Branches:
  refs/heads/master 8a8ca83f2 -> 75676e5d4


Fixed ant build.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/75676e5d
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/75676e5d
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/75676e5d

Branch: refs/heads/master
Commit: 75676e5d4e295faf4217932223892e8808f8f873
Parents: 8a8ca83
Author: Phil Steitz <phil.steitz@gmail.com>
Authored: Sat Jan 2 10:30:49 2016 -0700
Committer: Phil Steitz <phil.steitz@gmail.com>
Committed: Sat Jan 2 10:30:49 2016 -0700

----------------------------------------------------------------------
 build.xml    | 21 ++++++++++++++++-----
 test-jar.xml | 50 ++++++++++++++++----------------------------------
 2 files changed, 32 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/75676e5d/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 8072d8e..8d33ae1 100644
--- a/build.xml
+++ b/build.xml
@@ -30,12 +30,12 @@
 
 <!-- ========== External Dependencies ===================================== -->
 
+  <property name="repository"              value = "${user.home}/.m2/repository"/>
 
   <!-- Junit -->
-  <property name="junit.version"           value="4.8.2"/>
-  <property name="junit.home"              value="/usr/share/junit"/>
-  <property name="junit.jar"               value="${junit.home}/junit-${junit.version}.jar"/>
-
+  <property name="junit.version"           value="4.11"/>
+  <property name="junit.jar"               value="$junit-{junit.version}.jar"/>
+  <property name="hamcrest.jar"            value="hamcrest-core-1.3.jar"/>
 
 <!-- ========== Component Declarations ==================================== -->
 
@@ -111,6 +111,7 @@
   <!-- External dependency classpath -->
   <path id="downloaded.lib.classpath">
     <pathelement location="${download.lib.dir}/junit-${junit.version}.jar"/>
+	<pathelement location="${download.lib.dir}/${hamcrest.jar}"/>
   </path>
 
 <!-- ========== Test Execution Defaults =================================== -->
@@ -121,6 +122,7 @@
     <pathelement location="${build.home}/classes"/>
     <pathelement location="${build.home}/test-classes"/>
     <pathelement location="${junit.jar}"/>
+	<pathelement location="${hamcrest.jar}"/>
     <path refid="downloaded.lib.classpath"/>
   </path>
 
@@ -343,9 +345,10 @@
 <!-- ========== Download Dependencies =========================================== -->
 
     <target name="download-dependencies" 
-           depends="check-availability" unless="skip.download">
+         depends="check-availability" unless="skip.download">
         <echo message="doing download-dependencies..." />
         <antcall target="download-junit" />
+        <antcall target="download-hamcrest" />
     </target>
 
     <target name="check-availability">
@@ -360,6 +363,14 @@
             usetimestamp="true" ignoreerrors="true"
             src="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/>
     </target>
+
+	<target name="download-hamcrest" unless="hamcrest.found">
+	        <echo message="Downloading hamcrest..."/>
+	        <mkdir dir="${download.lib.dir}" />
+	        <get dest="${download.lib.dir}/${hamcrest.jar}"
+	            usetimestamp="true" ignoreerrors="true"
+	            src="http://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
+	</target>
       
 </project>
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/75676e5d/test-jar.xml
----------------------------------------------------------------------
diff --git a/test-jar.xml b/test-jar.xml
index c6e12ec..e5a20a5 100644
--- a/test-jar.xml
+++ b/test-jar.xml
@@ -21,25 +21,23 @@
    Compiles and runs unit tests against distribution jar(s).  Use .antrc or the 
    command line to control the jdk used to execute this build file.  
    
-   Assumes that the distribution jar to be tested is in the base directory. 
-   Use the "jardir" property to specify the path to the directory containing
-   the jar. Any other jars in this directory will also be added to the
-   classpath.  
+   Assumes that the distribution jar to be tested is in the basedir/lib, along
+   with any dependent jars (junit, hamcrest). Use the "libdir" property to specify
+   the path to the directory containing these jars. 
    
    The default target, "test," executes clean as a dependency.
 -->
   
 <project default="test" name="commons-math" basedir=".">
-  <property name="defaulttargetdir" value="target"/>
-  <property name="libdir" value="target/lib"/>
+  <property name="libdir" value="lib"/>
   <property name="testclassesdir" value="target/test-classes"/>
   <property name="testreportdir" value="target/test-reports"/>
   <property name="defaulttargetdir" value="target"/>
-  <property name="jardir" value="${basedir}"/>
-   <path id="build.classpath">
+  <property name="test.resources" value="src/test/resources"/>
+  <property name="build.home" value="target"/>
+  <path id="build.classpath">
     <fileset dir="${libdir}">
-      <include name="**/*.jar">
-      </include>
+      <include name="*.jar" />
     </fileset>
   </path>
   <target name="clean" description="o Clean up the generated directories">
@@ -58,24 +56,17 @@
     Java library path: ${java.library.path}
     ===========================================================================
     </echo>
-    <mkdir dir="${libdir}" />
-    <condition property="noget">
-      <equals arg2="only" arg1="${build.sysclasspath}">
-      </equals>
-    </condition>
-    <!--Test if JUNIT is present in ANT classpath-->
-    <available property="Junit.present" classname="org.junit.Test">
-    </available>
   </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="clean, junit-present,compile-tests">
+  <target name="internal-test" depends="clean,compile-tests">
     <mkdir dir="${testreportdir}"/>
-    <junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
+    <junit dir="./" failureproperty="test.failure" printSummary="yes"
+           fork="true" haltonerror="true" showOutput="true">
       <sysproperty key="basedir" value="."/>
-      <formatter usefile="false" type="plain"/>
+      <formatter type="brief"/>
       <classpath>
         <path refid="build.classpath"/>
         <pathelement path="${testclassesdir}"/>
@@ -88,14 +79,7 @@
       </batchtest>
     </junit>
   </target>
-  <target name="junit-present" unless="Junit.present" depends="init">
-  <echo>
-    ================================= WARNING ================================
-    Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed.
-    ==========================================================================
-  </echo>
-  </target>
-  <target name="compile-tests" if="Junit.present" depends="junit-present">
+  <target name="compile-tests" >
     <mkdir dir="${testclassesdir}"/>
     <javac destdir="${testclassesdir}" deprecation="true" debug="true"
             optimize="false" excludes="**/package.html">
@@ -106,12 +90,10 @@
         <path refid="build.classpath"/>
       </classpath>
     </javac>
-    <copy todir="${testclassesdir}">
-      <fileset dir="src/test/resources">
-        <include name="**/*.xml"/>
-        <include name="**/*.txt"/>
+	<copy todir="${build.home}/test-classes">
+	  <fileset dir="${test.resources}">
       </fileset>
-    </copy>
+	</copy>
   </target>
 </project>
 


Mime
View raw message