forked from kbase/groups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
355 lines (329 loc) · 15.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<project name="KBase Groups Service" default="test" basedir="."
xmlns:jacoco="antlib:org.jacoco.ant">
<description>
Build file for the KBase Groups Service
</description>
<!-- TODO ZLATER BUILD switch to gradle or at least ivy -->
<!-- set global properties for this build -->
<property name="package" value="KBase Groups Service"/>
<property name="javapackage" value="groups"/>
<property name="src" location="src"/>
<property name="lib" location="lib"/>
<property name="dist" location="dist"/>
<property name="jardir" location="../jars/lib/jars/"/>
<property name="classes" location="classes"/>
<property name="doc" location="docs/javadoc"/>
<property name="testcfg" location="./test.cfg"/>
<property name="testjar.file" value="KBaseGroupsTest.jar"/>
<property name="jar.file" value="KBaseGroups.jar"/>
<property name="war.file" value="KBaseGroups.war"/>
<property name="war.dir" value="war"/>
<property name="test.dir" location="${src}/us/kbase/test"/>
<property name="test.reports.dir" location="test-reports"/>
<fileset dir="${jardir}" id="lib">
<include name="apache_commons/commons-io-2.4.jar"/>
<include name="google/guava-18.0.jar"/>
<include name="ini4j/ini4j-0.5.2.jar"/>
<!-- <include name="jcommander/jcommander-1.72.jar"/>-->
<include name="mongo/mongo-java-driver-3.8.2.jar"/>
<include name="kafka/kafka-clients-2.1.0.jar"/>
<!--<include name="snakeyaml/snakeyaml-1.18.jar"/>-->
<include name="kbase/workspace/WorkspaceClient-0.8.0.jar"/>
<include name="kbase/catalog/kbase-catalog-client-2.1.3.jar"/>
<include name="kbase/auth/kbase-auth-0.4.4.jar"/>
<include name="jsemver/java-semver-0.9.0.jar"/>
</fileset>
<fileset dir="${jardir}" id="logging">
<include name="kbase/common/kbase-common-0.0.25.jar"/>
<include name="logback/logback-core-1.1.2.jar"/>
<include name="logback/logback-classic-1.1.2.jar"/>
<include name="slf4j/slf4j-api-1.7.25.jar"/>
<include name="syslog4j/syslog4j-0.9.46.jar"/>
<include name="jna/jna-3.4.0.jar"/>
</fileset>
<fileset dir="${jardir}" id="jackson">
<include name="jackson/jackson-annotations-2.5.4.jar"/>
<include name="jackson/jackson-core-2.5.4.jar"/>
<include name="jackson/jackson-databind-2.5.4.jar"/>
<include name="jackson/jackson-jaxrs-base-2.5.4.jar"/>
<include name="jackson/jackson-jaxrs-json-provider-2.5.4.jar"/>
<include name="jackson/jackson-module-jaxb-annotations-2.5.4.jar"/>
<include name="jackson/jackson-datatype-jdk8-2.5.4.jar"/>
</fileset>
<fileset dir="${jardir}" id="jersey">
<include name="jersey/entity-filtering/jersey-entity-filtering-2.23.2.jar"/>
<include name="jersey/entity-filtering/jersey-media-json-jackson-2.23.2.jar"/>
<include name="jersey/jersey-client-2.23.2.jar"/>
<include name="jersey/jersey-common-2.23.2.jar"/>
<include name="jersey/jersey-container-servlet-2.23.2.jar"/>
<include name="jersey/jersey-container-servlet-core-2.23.2.jar"/>
<include name="jersey/jersey-guava-2.23.2.jar"/>
<include name="jersey/jersey-media-jaxb-2.23.2.jar"/>
<include name="jersey/jersey-server-2.23.2.jar"/>
</fileset>
<fileset dir="${jardir}" id="jerseydeps">
<include name="annotation/javax.annotation-api-1.2.jar"/>
<include name="asm/asm-debug-all-5.0.4.jar"/>
<include name="inject/javax.inject-2.5.0-b05.jar"/>
<include name="javassist/javassist-3.20.0-GA.jar"/>
<include name="jaxb/jaxb-api-2.2.7.jar"/>
<include name="jaxrs/javax.ws.rs-api-2.0.1.jar"/>
<include name="osgi/org.osgi.core-4.2.0.jar"/>
<include name="persistence/persistence-api-1.0.jar"/>
<include name="servlet/javax.servlet-api-3.0.1.jar"/>
<include name="validationapi/validation-api-1.1.0.Final.jar"/>
</fileset>
<fileset dir="${jardir}" id="jerseydep_hk2">
<include name="hk2/aopalliance-repackaged-2.5.0-b05.jar"/>
<include name="hk2/hk2-api-2.5.0-b05.jar"/>
<include name="hk2/hk2-locator-2.5.0-b05.jar"/>
<include name="hk2/hk2-utils-2.5.0-b05.jar"/>
<include name="hk2/osgi-resource-locator-1.0.1.jar"/>
</fileset>
<fileset dir="${jardir}" id="testlibs">
<include name="equalsverifier/equalsverifier-2.2.2.jar"/>
<include name="junit/junit-4.12.jar"/>
<include name="hamcrest/hamcrest-core-1.3.jar"/>
<include name="jetty/jetty-all-9.3.11.v20160721-uber.jar"/>
<include name="mockserver/mockserver-netty-5.4.1-jar-with-dependencies.jar"/>
<include name="jacoco/jacocoant.jar"/>
<include name="apache_commons/commons-lang3-3.5.jar"/>
<include name="kbase/auth2/kbase-auth2test-0.2.4.jar"/>
<!-- mockito and dependencies -->
<include name="mockito/mockito-core-2.7.10.jar"/>
<include name="bytebuddy/byte-buddy-1.6.8.jar"/>
<include name="bytebuddy/byte-buddy-agent-1.6.8.jar"/>
<include name="objenesis/objenesis-2.5.1.jar"/>
</fileset>
<union id="applicationjars">
<fileset refid="jerseydeps"/>
<fileset refid="jerseydep_hk2"/>
<fileset refid="jackson"/>
<fileset refid="jersey"/>
<fileset refid="lib"/>
<fileset refid="logging"/>
</union>
<path id="compile.classpath">
<union refid="applicationjars"/>
<fileset refid="testlibs"/>
</path>
<path id="test.classpath">
<path refid="compile.classpath"/>
<fileset file="${dist}/${jar.file}"/>
<fileset file="${dist}/${testjar.file}"/>
</path>
<target name="build" depends="compile,buildwar,javadoc"
description="build everything"/>
<target name="init" description="make directories">
<!-- Create the output directory structure-->
<mkdir dir="${classes}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${test.reports.dir}"/>
<mkdir dir="${test.reports.dir}/html"/>
</target>
<target name="compile" depends="init" description="compile the source">
<!-- Compile class files-->
<javac srcdir="${src}"
destdir="${classes}"
includeantruntime="false"
debug="true"
classpathref="compile.classpath"
target="1.8"
source="1.8">
<compilerarg line="-encoding utf-8"/>
</javac>
<!-- Copy resource files-->
<copy todir="${classes}">
<fileset dir="${src}">
<patternset>
<include name="**/wsjars"/>
</patternset>
</fileset>
</copy>
<!-- add git commit to file -->
<exec executable="git" output="${classes}/us/kbase/${javapackage}/gitcommit">
<arg line="rev-parse HEAD"/>
</exec>
<!-- Make main jar file-->
<jar destfile="${dist}/${jar.file}"
basedir="${classes}"
includes="us/kbase/${javapackage}/**"
/>
<!-- Make test jar file-->
<jar destfile="${dist}/${testjar.file}"
basedir="${classes}"
includes="us/kbase/test/**"
/>
</target>
<target name="buildwar" depends="compile" description="build the WAR file">
<!-- make the war file for the server-->
<mkdir dir="${war.dir}/lib"/>
<copy todir="${war.dir}/lib/" flatten="true">
<union refid="applicationjars"/>
</copy>
<war destfile="${dist}/${war.file}" webxml="${war.dir}/web.xml">
<classes dir="${classes}" includes="us/kbase/${javapackage}/**"/>
<lib dir="${war.dir}/lib/"/>
</war>
<!-- Remove uncompressed class files and libs-->
<delete dir="${war.dir}/lib"/>
<!-- copy war to jettybase -->
<copy tofile="./jettybase/webapps/ROOT.war" file="${dist}/${war.file}" />
</target>
<target name="docker_image" depends="buildwar" description="build the docker image">
<!-- make the docker image that for auth2 -->
<exec executable="./build/build_docker_image.sh" failonerror="true">
</exec>
</target>
<target name="javadoc" description="build javadocs">
<javadoc access="protected"
author="false"
classpathref="compile.classpath"
destdir="${doc}"
sourcepath="${src}"
excludepackagenames="us.kbase.test.*"
nodeprecated="false"
nodeprecatedlist="false"
noindex="false"
nonavbar="false"
notree="false"
source="1.8"
splitindex="true"
use="true"
version="true">
<link href="https://docs.oracle.com/javase/8/docs/api/"/>
<link href="http://api.mongodb.com/java/3.3/"/>
<link href="https://google.github.io/guava/releases/18.0/api/docs/"/>
</javadoc>
</target>
<path id="jacoco.classpath">
<fileset dir="${jardir}">
<include name="jacoco/jacocoant.jar"/>
</fileset>
</path>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"
classpathref="jacoco.classpath"/>
<target name="test"
depends="test_no_mongo_storage,test_mongo_storage"
description="run all tests and generate test report">
<delete file="${test.reports.dir}/merged_jacoco.exec"/>
<jacoco:merge destfile="${test.reports.dir}/merged_jacoco.exec">
<fileset dir="${test.reports.dir}" includes="*.exec"/>
</jacoco:merge>
<jacoco:report>
<executiondata>
<file file="${test.reports.dir}/merged_jacoco.exec"/>
</executiondata>
<structure name="${package} Unit Tests">
<classfiles>
<fileset dir="${classes}">
<exclude name="**/test/**"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src}">
<exclude name="**/test/**"/>
</fileset>
</sourcefiles>
</structure>
<html destdir="${test.reports.dir}/html"/>
<csv destfile="${test.reports.dir}/coverage-report.csv"/>
<xml destfile="${test.reports.dir}/coverage-report.xml"/>
</jacoco:report>
</target>
<target name="test_no_mongo_storage"
depends="compile"
description="run tests without the MongoStorage* tests">
<echo message="starting ${package} tests"/>
<delete file="${test.reports.dir}/no_mongo_storage_jacoco.exec"/>
<jacoco:coverage destfile="${test.reports.dir}/no_mongo_storage_jacoco.exec"
excludes="org/*:junit/*">
<junit printsummary="yes" failureproperty="test.failed" fork="yes">
<classpath refid="test.classpath"/>
<formatter type="plain" usefile="false" />
<sysproperty key="KBASE_GROUPS_TEST_CONFIG" value="${testcfg}"/>
<test name="us.kbase.test.groups.cataloghandler.SDKClientCatalogHandlerTest"/>
<test name="us.kbase.test.groups.config.GroupsConfigTest"/>
<test name="us.kbase.test.groups.core.CreateModExpireTimesTest"/>
<test name="us.kbase.test.groups.core.FieldItemTest"/>
<test name="us.kbase.test.groups.core.GetGroupsParamsTest"/>
<test name="us.kbase.test.groups.core.GetRequestParamsTest"/>
<test name="us.kbase.test.groups.core.GroupTest"/>
<test name="us.kbase.test.groups.core.GroupCreationParamsTest"/>
<test name="us.kbase.test.groups.core.GroupHasRequestsTest"/>
<test name="us.kbase.test.groups.core.GroupIDTest"/>
<test name="us.kbase.test.groups.core.GroupIDAndNameTest"/>
<test name="us.kbase.test.groups.core.GroupIDNameMembershipTest"/>
<test name="us.kbase.test.groups.core.GroupNameTest"/>
<test name="us.kbase.test.groups.core.GroupsTest"/>
<test name="us.kbase.test.groups.core.GroupUpdateParamsTest"/>
<test name="us.kbase.test.groups.core.GroupUserTest"/>
<test name="us.kbase.test.groups.core.GroupViewTest"/>
<test name="us.kbase.test.groups.core.NameTest"/>
<test name="us.kbase.test.groups.core.OptionalGroupFieldsTest"/>
<test name="us.kbase.test.groups.core.OptionalStringTest"/>
<test name="us.kbase.test.groups.core.TokenTest"/>
<test name="us.kbase.test.groups.core.UserNameTest"/>
<test name="us.kbase.test.groups.core.fieldvalidation.CustomFieldTest"/>
<test name="us.kbase.test.groups.core.fieldvalidation.FieldConfigurationTest"/>
<test name="us.kbase.test.groups.core.fieldvalidation.FieldValidatorConfigurationTest"/>
<test name="us.kbase.test.groups.core.fieldvalidation.FieldValidatorsTest"/>
<test name="us.kbase.test.groups.core.fieldvalidation.NumberedCustomFieldTest"/>
<test name="us.kbase.test.groups.core.request.GroupRequestTest"/>
<test name="us.kbase.test.groups.core.request.GroupRequestStatusTest"/>
<test name="us.kbase.test.groups.core.request.GroupRequestStatusTypeTest"/>
<test name="us.kbase.test.groups.core.request.GroupRequestUserActionTest"/>
<test name="us.kbase.test.groups.core.request.GroupRequestWithActionsTest"/>
<test name="us.kbase.test.groups.core.request.RequestIDTest"/>
<test name="us.kbase.test.groups.core.request.RequestTypeTest"/>
<test name="us.kbase.test.groups.core.resource.ResourceIDTest"/>
<test name="us.kbase.test.groups.core.resource.ResourceInformationSetTest"/>
<test name="us.kbase.test.groups.core.resource.ResourceInformationTest"/>
<test name="us.kbase.test.groups.core.resource.ResourceTypeTest"/>
<test name="us.kbase.test.groups.fieldvalidators.EnumFieldValidatorFactoryTest"/>
<test name="us.kbase.test.groups.fieldvalidators.GravatarFieldValidatorFactoryTest"/>
<test name="us.kbase.test.groups.fieldvalidators.SimpleFieldValidatorFactoryTest"/>
<test name="us.kbase.test.groups.integration.ServiceIntegrationTest"/>
<test name="us.kbase.test.groups.notifications.KafkaFeedsNotifierFactoryTest"/>
<test name="us.kbase.test.groups.service.LoggingFilterTest"/>
<test name="us.kbase.test.groups.service.api.APICommonTest"/>
<test name="us.kbase.test.groups.service.api.GroupsAPITest"/>
<test name="us.kbase.test.groups.service.api.MemberAPITest"/>
<test name="us.kbase.test.groups.service.api.NamesAPITest"/>
<test name="us.kbase.test.groups.service.api.RequestAPITest"/>
<test name="us.kbase.test.groups.service.api.RootTest"/>
<test name="us.kbase.test.groups.service.api.IncomingJSONTest"/>
<test name="us.kbase.test.groups.service.exceptions.ErrorMessageTest"/>
<test name="us.kbase.test.groups.service.exceptions.ExceptionHandlerTest"/>
<test name="us.kbase.test.groups.util.UtilTest"/>
<test name="us.kbase.test.groups.workspacehandler.SDKClientWorkspaceHandlerTest"/>
<test name="us.kbase.test.groups.workspacehandler.WorkspacePermissionTest"/>
</junit>
</jacoco:coverage>
<fail message="Test failure detected, check test results." if="test.failed" />
</target>
<target name="test_mongo_storage"
depends="compile"
description="run only the MongoStorage* tests">
<echo message="starting ${package} tests"/>
<delete file="${test.reports.dir}/mongo_storage_jacoco.exec"/>
<jacoco:coverage destfile="${test.reports.dir}/mongo_storage_jacoco.exec"
excludes="org/*:junit/*">
<junit failureproperty="test.failed" fork="yes">
<classpath refid="test.classpath"/>
<formatter type="plain" usefile="false" />
<sysproperty key="KBASE_GROUPS_TEST_CONFIG" value="${testcfg}"/>
<test name="us.kbase.test.groups.storage.mongo.MongoGroupsStorageOpsTest"/>
<test name="us.kbase.test.groups.storage.mongo.MongoGroupsStorageStartupTest"/>
<test name="us.kbase.test.groups.storage.mongo.MongoGroupsStorageDuplicateKeyCheckerTest"/>
</junit>
</jacoco:coverage>
<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="${test.reports.dir}"/>
<delete dir="${dist}"/>
</target>
</project>