-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
169 lines (142 loc) · 5.6 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!--
From Ant Tutorial
http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html
-->
<project name="odutils-web" basedir="." default="jar">
<property name="src.dir" value="./src"/>
<property name="test.src.dir" value="./src/test/java"/>
<property name="lib.dir" value="./lib"/>
<property name="build.dir" value="build"/>
<property name="main.build.dir" value="build"/>
<property name="test.build.dir" value="build/test"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="lib.dir" value="lib"/>
<path id="classpath">
<dirset dir="${classes.dir}" />
<fileset dir="${lib.dir}">
<include name="*.jar" />
<include name="**/*.jar" />
</fileset>
</path>
<path id="classpath.test">
<pathelement location="lib/junit/junit-4.12.jar"/>
<pathelement location="lib/junit/hamcrest-core-1.3.jar"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${test.build.dir}"/>
</path>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="doc"/>
</target>
<target name="compile" depends="buildodutils">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" target="1.8" source="1.8" debug="true" compiler="modern">
<classpath>
<path refid="classpath"/>
<path location="${odutils.dir}/build/classes" />
</classpath>
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}"
compress="true" duplicate="preserve">
<fileset dir="." includes="${data.dir}/**,images/**"/>
</jar>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="test-compile" depends="compile">
<mkdir dir="${test.build.dir}"/>
<javac srcdir="${test.src.dir}" destdir="${test.build.dir}" includeantruntime="false">
<classpath refid="classpath.test"/>
</javac>
</target>
<target name="test" depends="test-compile">
<junit printsummary="on" haltonfailure="yes" fork="true">
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test.build.dir}"/>
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test.src.dir}" includes="**/*Test.java" />
<fileset dir="${test.src.dir}" includes="**/*Tests.java" />
</batchtest>
</junit>
</target>
<target name="checkproj">
<available file="../odutils" property="odutils.dir" value="../odutils" />
<available file="../odutils-master" property="odutils.dir" value="../odutils-master" />
<available file="../odutils-main" property="odutils.dir" value="../odutils-main" />
<path id="odutils.classpath">
<dirset dir="${odutils.dir}/${classes.dir}" />
<fileset dir="${odutils.dir}/${lib.dir}">
<include name="*.jar" />
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="buildodutils" depends="checkproj">
<ant antfile="${odutils.dir}/build.xml" dir="${odutils.dir}" target="jar" />
</target>
<!-- see: http://stackoverflow.com/q/453170 -->
<condition property="isWindows" else="false">
<os family="windows" />
</condition>
<condition property="isMac" else="false">
<os family="mac" />
</condition>
<condition property="isUnix" else="false">
<os family="unix" />
</condition>
<target name="setbinaries" depends="checkproj">
<available file="lib/Linux64" property="sgp4lib.dir" value="lib/Linux64" />
<available file="lib/Win64" property="sgp4lib.dir" value="lib/Win64" />
</target>
<target name="checklicense">
<copy file="${odutils.dir}/lib/ussfsgp4/SGP4_Open_License.txt" tofile="./SGP4_Open_License.txt" />
</target>
<target name="runserver" depends="compile,checklicense,setbinaries">
<java dir="."
classname="odutils.web.ODUtilsServer"
error="server_error.log"
fork="true">
<arg value="browser"/>
<arg value="true"/>
<jvmarg value="-Djava.library.path=${sgp4lib.dir}" />
<env key="LD_LIBRARY_PATH" value="${sgp4lib.dir}" />
<classpath>
<path refid="classpath"/>
<path refid="odutils.classpath"/>
<path location="${odutils.dir}/build/classes" />
<path location="${sgp4lib.dir}" />
</classpath>
</java>
</target>
<target name="dist" depends="jar">
<mkdir dir="${build.dir}/dist" />
<zip destfile="${build.dir}/dist/odutils-web-dist.jar">
<zipgroupfileset dir="${build.dir}/jar" includes="*.jar"/>
<zipgroupfileset dir="${odutils.dir}/build/jar" includes="*.jar"/>
<zipgroupfileset dir="${odutils.dir}/lib/ussfsgp4" includes="*.jar"/>
<zipgroupfileset dir="${odutils.dir}/lib/orekit" includes="*.jar"/>
<zipgroupfileset dir="${odutils.dir}/lib/hipparchus" includes="*.jar"/>
<zipgroupfileset dir="lib/jlhttp" includes="*.jar"/>
</zip>
</target>
<target name="docker" depends="dist">
<mkdir dir="containers/docker/target" />
<mkdir dir="containers/docker/target/web" />
<property name="tgt.dir" value="containers/docker/target"/>
<copy file="${build.dir}/dist/odutils-web-dist.jar" tofile="${tgt.dir}/odutils-web-dist.jar" />
<copy todir="${tgt.dir}/web">
<fileset dir="web" />
</copy>
<copy todir="${tgt.dir}">
<fileset dir="${odutils.dir}/lib/ussfsgp4/Linux64/">
<include name="*" />
</fileset>
</copy>
</target>
</project>