forked from kbaseattic/trees
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
166 lines (151 loc) · 6.34 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
<project name="Tree Service" default="war" basedir=".">
<description>
Build war-file for the Tree Service
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="dist" location="dist"/>
<property name="classes" location="classes"/>
<property name="jar.file" value="KBaseTrees.jar"/>
<property name="war.file" value="KBaseTreesService.war"/>
<property name="war" value="war"/>
<property name="war.lib" value="${war}/lib"/>
<property name="prop.file.path" value="us/kbase/kbasetrees/config_path.properties"/>
<property name="jarsdir" value=""/>
<property name="deploycfg" value=""/>
<property environment="env"/>
<condition property="commonjar" value="kbase/common/kbase-common-0.0.3.jar">
<or>
<equals arg1="${env.JENKINS_JAVA_COMMON_JARFILE}" arg2=""/>
<not>
<isset property="env.JENKINS_JAVA_COMMON_JARFILE"/>
</not>
</or>
</condition>
<!-- Properties in ant are immutable, so the following assignment will only take place if jardir was not set above. -->
<property name="commonjar" value="${env.JENKINS_JAVA_COMMON_JARFILE}"/>
<fileset dir="${jarsdir}" id="serverlib">
<include name="ini4j/ini4j-0.5.2.jar"/>
<include name="jetty/jetty-all-7.0.0.jar"/>
<include name="jna/jna-3.4.0.jar"/>
<include name="servlet/servlet-api-2.5.jar"/>
<include name="syslog4j/syslog4j-0.9.46.jar"/>
<include name="junit/junit-4.9.jar"/>
<include name="kbase/auth/kbase-auth-1398468950-3552bb2.jar"/>
<include name="jackson/jackson-annotations-2.2.3.jar"/>
<include name="jackson/jackson-core-2.2.3.jar"/>
<include name="jackson/jackson-databind-2.2.3.jar"/>
<include name="${commonjar}"/>
<include name="forester/forester_1030.jar"/>
<!-- jars for workspace integration tests -->
<include name="kbase/workspace/WorkspaceService-0.2.0.jar"/>
<include name="joda/joda-time-2.2.jar"/>
<include name="kbase/shock/shock-client-0.0.6.jar"/>
<include name="apache_commons/commons-logging-1.1.1.jar"/>
<include name="apache_commons/http/httpclient-4.3.1.jar"/>
<include name="apache_commons/http/httpcore-4.3.jar"/>
<include name="apache_commons/http/httpmime-4.3.1.jar"/>
<include name="kbase/kidl/kbase-kidl-parser2.jar"/>
<include name="apache_commons/commons-codec-1.8.jar"/>
<include name="apache_commons/commons-io-2.4.jar"/>
<include name="apache_commons/commons-lang3-3.1.jar"/>
<include name="mongo/mongo-java-driver-2.11.2.jar"/>
<include name="jongo/jongo-0.5-early-20130912-1506.jar"/>
<include name="bson4jackson/bson4jackson-2.2.0-2.2.0.jar"/>
<include name="easystream/easystream-1.2.13.jar"/>
<include name="slf4j/slf4j-api-1.7.7.jar"/>
<include name="logback/logback-core-1.1.2.jar"/>
<include name="logback/logback-classic-1.1.2.jar"/>
<include name="google/guava-14.0.1.jar"/>
<include name="derby/derby-10.10.1.1.jar"/>
</fileset>
<path id="compile.classpath">
<fileset refid="serverlib"/>
</path>
<path id="test.classpath">
<path refid="compile.classpath"/>
<pathelement path="${classes}"/>
</path>
<target name="init" description="make directories">
<!-- Create the output directory structure-->
<delete dir="${classes}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${dist}"/>
</target>
<target name="compile" depends="init" description="compile the source">
<!-- Compile class files-->
<fail message="Property "jarsdir" needs to be set">
<condition>
<equals arg1="${jarsdir}" arg2=""/>
</condition>
</fail>
<javac destdir="${classes}" includeantruntime="false" target="1.6" source="1.6" debug="true" classpathref="compile.classpath">
<src path="${src}"/>
</javac>
<!-- Copy resource files-->
<copy todir="${classes}">
<fileset dir="${src}">
<patternset>
<include name="**/*.properties"/>
<include name="**/*.spec"/>
<include name="**/*.instance.*"/>
<include name="**/*.instance"/>
</patternset>
</fileset>
</copy>
<!-- Make main jar file (includes dependencies, might want to make a stripped down version)-->
<jar destfile="${dist}/${jar.file}" basedir="${classes}"/>
<!-- ################################# temp ################################# -->
<unzip dest="${classes}">
<fileset refid="serverlib"/>
</unzip>
<jar destfile="${dist}/SpeciesTreePreparation.jar" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="us.kbase.kbasetrees.prepare.SpeciesTreePreparation"/>
</manifest>
</jar>
</target>
<target name="war" depends="compile" description="build the WAR file. Assumes compile has been run">
<!-- Copy resource files-->
<fail message="Property "deploycfg" needs to be set">
<condition>
<equals arg1="${deploycfg}" arg2=""/>
</condition>
</fail>
<echo file="${classes}/${prop.file.path}">config_path=${deploycfg}</echo>
<!-- make the war file for the server-->
<mkdir dir="${war.lib}"/>
<copy todir="${war.lib}/" flatten="true">
<fileset refid="serverlib"/>
</copy>
<war destfile="${dist}/${war.file}" webxml="${war}/web.xml">
<classes dir="${classes}"/>
<lib dir="${war.lib}"/>
</war>
<delete dir="${war.lib}"/>
<delete dir="${classes}"/>
</target>
<target name="preparejunitreportdir" if="env.JENKINS_REPORT_DIR">
<delete dir="${env.JENKINS_REPORT_DIR}"/>
<mkdir dir="${env.JENKINS_REPORT_DIR}"/>
</target>
<target name="test" depends="compile, preparejunitreportdir" description="Testing tree service">
<junit fork="yes" maxmemory="3G" haltonfailure="yes">
<classpath refid="test.classpath"/>
<formatter type="plain" usefile="false" />
<formatter type="xml" usefile="true" if="env.JENKINS_REPORT_DIR"/>
<batchtest todir="${env.JENKINS_REPORT_DIR}">
<fileset dir="${src}">
<include name="**/test/**/**Test.java"/>
</fileset>
</batchtest>
</junit>
<fail message="Test failure detected, check test results." if="test.failed" />
</target>
<target name="clean" description="clean up" >
<!-- Clean up internal temporary files and folders-->
<delete dir="${classes}"/>
<delete dir="${dist}"/>
<!--<delete dir="${test}"/>-->
</target>
</project>