Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added jar dependencies, cleaned up build.xml

  • Loading branch information...
commit 9ea9da85ba2abad79834225773d9a527244b04d6 1 parent 3891c0f
@acerisara acerisara authored
View
2  .gitignore
@@ -4,5 +4,5 @@ build/**/*
build-stamp
dist/**/*
src/resources/data
-lib
classes/
+dist/
View
83 build.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<project name="GEM Java Tests" default="junit-tests-with-coverage" basedir=".">
+<project name="GEM Java Tests" default="help" basedir=".">
<property name="lib.dir" value="lib"/>
<property name="src.dir" value="java"/>
<property name="test.dir" value="java_tests"/>
@@ -11,95 +11,75 @@
<property name="instrumented.dir" value="${build.dir}/inst"/>
<property name="javadoc.report.dir" value="${dist.dir}/javadoc"/>
<property name="tests.report.dir" value="${dist.dir}/tests_result"/>
+
<path id="libraries">
- <!-- TODO Find out which jar from OpenSHA causes java.util.zip.ZipException: error in opening zip file -->
- <pathelement location="${lib.dir}/lambdaj-2.1-with-dependencies.jar"/>
- <pathelement location="${lib.dir}/commons-configuration-1.6.jar"/>
- <pathelement location="${lib.dir}/commons-collections-3.2.1.jar"/>
- <pathelement location="${lib.dir}/commons-logging-1.1.1.jar"/>
- <pathelement location="${lib.dir}/commons-io-1.4.jar"/>
- <pathelement location="${lib.dir}/commons-math-2.1.jar"/>
- <pathelement location="${lib.dir}/junit-4.8.1.jar"/>
- <pathelement location="${lib.dir}/oscache-2.4.1.jar"/>
- <pathelement location="${lib.dir}/hamcrest-all-1.2.jar"/>
- <pathelement location="${lib.dir}/emma.jar"/>
- <pathelement location="${lib.dir}/lombok.jar"/>
- <pathelement location="${lib.dir}/emma_ant.jar"/>
- <pathelement location="${lib.dir}/mockito-all-1.8.2.jar"/>
- <pathelement location="${lib.dir}/dom4j.jar"/>
- <pathelement location="${lib.dir}/commons-lang-2.4.jar"/>
- <pathelement location="${lib.dir}/memcached-2.5.jar"/>
- <pathelement location="${lib.dir}/gson-1.5.jar"/>
+ <fileset dir="${lib.dir}" includes="*.jar" />
</path>
- <target name="clean">
+
+ <target name="help" description="Display detailed usage information">
+ <exec executable="ant">
+ <arg value="-p"/>
+ </exec>
+ </target>
+
+ <target name="clean" description="Clean build directories">
<delete dir="${dist.dir}"/>
<delete dir="${build.dir}"/>
</target>
- <target name="download">
- <exec executable="bash" dir="./">
- <arg value="install.sh"/>
- </exec>
- </target>
+
<target name="javadoc">
<javadoc classpathref="libraries" packagenames="org.gem.engine.*" sourcepath="${src.dir}" destdir="${javadoc.report.dir}" author="true" version="true" use="true" windowtitle="OpenGEM Java Core API"/>
</target>
- <target name="compile-sources" depends="clean,download">
+
+ <target name="compile-sources" depends="clean">
<mkdir dir="${classes.dir}"/>
<javac fork="no" debug="true" destdir="${classes.dir}" classpathref="libraries" includes="org/**/*.java" srcdir="${src.dir}"/>
</target>
- <target name="compile" depends="compile-sources">
+
+ <target name="compile" depends="compile-sources" description="Compile the Java classes and build the jar">
<mkdir dir="${dist.dir}"/>
+
<jar destfile="${dist.dir}/opensha-lite.jar">
- <fileset dir="${classes.dir}" includes="**/*.class"/>
- <fileset dir="${src.dir}" includes="**/*.txt"/>
- </jar>
+ <fileset dir="${classes.dir}" includes="**/*.class"/>
+ <fileset dir="${src.dir}" includes="**/*.txt"/>
+ </jar>
</target>
+
<taskdef resource="emma_ant.properties" classpathref="libraries"/>
- <target name="junit-tests-with-coverage" depends="compile">
+
+ <target name="junit-tests-with-coverage" depends="compile" description="Run the test suite and check the code coverage">
<mkdir dir="${coverage.dir}"/>
<mkdir dir="${tests.report.dir}"/>
+
<!-- Compile test classes -->
<javac fork="no" debug="true" destdir="${classes.dir}" classpathref="libraries" includes="org/**/*.java" srcdir="${test.dir}"/>
+
<emma enabled="true">
<instr verbosity="verbose" instrpath="${classes.dir}" destdir="${instrumented.dir}" metadatafile="${coverage.dir}/metadata.emma" merge="true" mode="fullcopy">
<filter excludes="*Test*"/>
<filter excludes="au.com.jenisys.view.*"/>
</instr>
</emma>
+
<copy todir="${instrumented.dir}/classes/org/opensha/sha/imr/attenRelImpl/" overwrite="true">
<fileset dir="${src.dir}/org/opensha/sha/imr/attenRelImpl/">
<include name="**/*.txt" />
</fileset>
</copy>
+
<mkdir dir="${coverage.dir}/test_data"/>
<copy todir="${coverage.dir}/test_data/">
<fileset dir="${data.dir}"/>
</copy>
+
<junit haltonerror="yes" haltonfailure="yes" fork="yes" dir="${coverage.dir}" maxmemory="2048m">
<classpath>
<!-- Input test files -->
<pathelement path="${data.dir}"/>
<pathelement path="${instrumented.dir}/classes"/>
- <!-- TODO Find out why referencing the defined path with an id gets a java.lang.NullPointerException -->
- <pathelement location="${lib.dir}/lambdaj-2.1-with-dependencies.jar"/>
- <pathelement location="${lib.dir}/commons-logging-1.1.1.jar"/>
- <pathelement location="${lib.dir}/commons-math-2.1.jar"/>
- <pathelement location="${lib.dir}/commons-io-1.4.jar"/>
- <pathelement location="${lib.dir}/junit-4.8.1.jar"/>
- <pathelement location="${lib.dir}/oscache-2.4.1.jar"/>
- <pathelement location="${lib.dir}/hamcrest-all-1.2.jar"/>
- <pathelement location="${lib.dir}/emma.jar"/>
- <pathelement location="${lib.dir}/lombok.jar"/>
- <pathelement location="${lib.dir}/emma_ant.jar"/>
- <pathelement location="${lib.dir}/mockito-all-1.8.2.jar"/>
- <pathelement location="${lib.dir}/dom4j.jar"/>
- <pathelement location="${lib.dir}/commons-lang-2.4.jar"/>
- <pathelement location="${lib.dir}/memcached-2.5.jar"/>
- <pathelement location="${lib.dir}/gson-1.5.jar"/>
- <pathelement location="${lib.dir}/commons-configuration-1.6.jar"/>
- <pathelement location="${lib.dir}/commons-collections-3.2.1.jar"/>
- <pathelement location="${lib.dir}/commons-io-1.4.jar"/>
+ <path refid="libraries" />
</classpath>
+
<formatter type="xml"/>
<batchtest fork="yes" todir="${tests.report.dir}">
<fileset dir="${test.dir}">
@@ -113,13 +93,16 @@
</fileset>
</batchtest>
</junit>
+
<emma enabled="true">
<report sourcepath="${src.dir}">
<infileset dir="${coverage.dir}" includes="*.emma, *.ec"/>
<xml outfile="${coverage.dir}/coverage.xml" depth="method"/>
</report>
</emma>
+
<echo message="Cleaning compiled resources..."/>
<delete dir="${build.dir}"/>
</target>
+
</project>
View
6 install.sh
@@ -1,6 +0,0 @@
-#!/bin/bash
-mkdir -p lib
-pushd lib
-wget -r -q -np -nd -nc -Ajar http://gemsun02.ethz.ch/~jmckenty/javalibs/
-popd
-
View
BIN  lib/commons-collections-3.2.1.jar
Binary file not shown
View
BIN  lib/commons-configuration-1.6.jar
Binary file not shown
View
BIN  lib/commons-io-1.4.jar
Binary file not shown
View
BIN  lib/commons-lang-2.4.jar
Binary file not shown
View
BIN  lib/commons-logging-1.1.1.jar
Binary file not shown
View
BIN  lib/commons-math-2.1.jar
Binary file not shown
View
BIN  lib/dom4j.jar
Binary file not shown
View
BIN  lib/emma.jar
Binary file not shown
View
BIN  lib/emma_ant.jar
Binary file not shown
View
BIN  lib/gson-1.5.jar
Binary file not shown
View
BIN  lib/junit-4.8.1.jar
Binary file not shown
View
BIN  lib/log4j-1.2.16.jar
Binary file not shown
View
BIN  lib/memcached-2.5.jar
Binary file not shown
View
27 opensha.tmproj
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>documents</key>
- <array>
- <dict>
- <key>expanded</key>
- <true/>
- <key>name</key>
- <string>opensha</string>
- <key>regexFolderFilter</key>
- <string>!.*/(\.[^/]*|CVS|_darcs|data|resources|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>sourceDirectory</key>
- <string></string>
- </dict>
- </array>
- <key>fileHierarchyDrawerWidth</key>
- <integer>442</integer>
- <key>metaData</key>
- <dict/>
- <key>showFileHierarchyDrawer</key>
- <true/>
- <key>windowFrame</key>
- <string>{{453, 91}, {1467, 1087}}</string>
-</dict>
-</plist>
Please sign in to comment.
Something went wrong with that request. Please try again.