forked from SodiumFRP/sodium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
148 lines (126 loc) · 5.83 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<project default="jar" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="resolve" description="Retrieve dependencies with Ivy." depends="init-ivy">
<ivy:resolve log="download-only"/>
<ivy:cachepath conf="build" pathid="build.classpath"/>
<ivy:cachepath conf="default" pathid="runtime.classpath"/>
<ivy:cachefileset conf="default" setid="runtime.fileset"/>
<ivy:cachepath conf="test" pathid="test.classpath"/>
<ivy:cachepath conf="analysis" pathid="analysis.classpath"/>
</target>
<target name="clean">
<delete dir="build"/>
<delete dir="doc"/>
<delete file="sodium.jar"/>
<delete file="sodium-java1.5.jar"/>
<delete>
<fileset dir="." includes="TEST-*.txt"/>
</delete>
</target>
<target name="javaCheck">
<echo message="ant.java.version=${ant.java.version}" />
<condition property="Java8OrHigher">
<not>
<or>
<equals arg1="${ant.java.version}" arg2="1.1" />
<equals arg1="${ant.java.version}" arg2="1.2" />
<equals arg1="${ant.java.version}" arg2="1.3" />
<equals arg1="${ant.java.version}" arg2="1.4" />
<equals arg1="${ant.java.version}" arg2="1.5" />
<equals arg1="${ant.java.version}" arg2="1.6" />
<equals arg1="${ant.java.version}" arg2="1.7" />
</or>
</not>
</condition>
</target>
<target name="compile" depends="compile-old,compile-new"/>
<target name="compile-new" depends="javaCheck" if="Java8OrHigher">
<mkdir dir="build/1.8/src" />
<javac includeantruntime="false" debug="true" srcdir="src/main/java" destdir="build/1.8/src" source="1.8" target="1.8"/>
</target>
<target name="compile-old">
<mkdir dir="build/1.5/src" />
<javac includeantruntime="false" debug="true" srcdir="src-java1.5" destdir="build/1.5/src" source="1.5" target="1.5"/>
<javac includeantruntime="false" debug="true" srcdir="src/main/java" destdir="build/1.5/src" source="1.5" target="1.5"/>
</target>
<target name="jar" depends="jar-old,jar-new"/>
<target name="jar-new" depends="compile-new,doc,javaCheck" if="Java8OrHigher">
<mkdir dir="build/1.8/jar" />
<jar destfile="sodium.jar" basedir="build/1.8/src">
<manifest>
</manifest>
</jar>
</target>
<target name="jar-old" depends="compile-old,doc">
<mkdir dir="build/1.5/jar" />
<jar destfile="sodium-java1.5.jar" basedir="build/1.5/src">
<manifest>
</manifest>
</jar>
</target>
<target name="check-doc">
<available file="doc/index.html" property="doc-present"/>
</target>
<target name="doc" depends="check-doc" unless="doc-present">
<mkdir dir="doc" />
<javadoc source="1.8" sourcepath="src/main/java" destdir="doc" packagenames="nz.sodium.*,nz.sodium.time.*" public="true">
<!--<exclude name="java/util/*.java"/>-->
</javadoc>
</target>
<target name="run">
<java jar="sodium.jar" fork="true" />
</target>
<target name="tests-classes" depends="jar,resolve">
<mkdir dir="build/tests/java8"/>
<javac includeantruntime="false" debug="true" srcdir="src/test/java" destdir="build/tests/java8">
<classpath>
<path refid="test.classpath"/>
<pathelement location="sodium.jar"/>
<pathelement location="build/java8"/>
</classpath>
</javac>
</target>
<target name="tests" depends="jar,tests-classes">
<junit printsummary="yes" showoutput="yes">
<formatter type="plain" />
<classpath>
<path refid="test.classpath"/>
<pathelement location="sodium.jar"/>
<pathelement location="build/tests/java8"/>
</classpath>
<batchtest>
<fileset dir="build/tests/java8">
<include name="nz/sodium/TestCell.class" />
<include name="nz/sodium/TestStream.class" />
<include name="nz/sodium/TestCommon.class" />
</fileset>
</batchtest>
</junit>
</target>
<property name="ivy.install.version" value="2.3.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="check-ivy-jar">
<available file="${ivy.jar.file}" property="ivy-jar-present"/>
</target>
<target name="download-ivy" depends="check-ivy-jar" unless="ivy-jar-present">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
</project>