-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
204 lines (189 loc) · 8.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
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
<project name="KBase Module Builder" default="compile_and_bin" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<description>
Java Build file for the KBase Module Builder
</description>
<!-- set global properties for this build -->
<property name="src" location="src/java"/>
<property name="dist" location="dist"/>
<property name="bin.local" location="bin"/>
<property name="classes" location="classes"/>
<property name="jardir" location="../jars/lib/jars"/>
<property name="report.dir" location="reports"/>
<!-- define the output jar and shell script filenames -->
<property name="kidl.jar.file" value="kbase-kidl-parser.jar"/>
<property name="module_builder.jar.file" value="kbase_module_builder2.jar"/>
<property name="module_builder.sh.file" value="kb-sdk"/>
<fileset dir="${jardir}" id="lib">
<!-- TODO GRADLE try to organize this list a bit when converting to Gradle-->
<!-- transitive dependency --><include name="apache_commons/commons-collections-3.2.1.jar"/>
<include name="apache_commons/commons-io-2.4.jar"/>
<!-- transitive dependency --><include name="apache_commons/commons-lang-2.4.jar"/>
<include name="apache_commons/commons-lang3-3.1.jar"/>
<include name="apache_commons/velocity-1.7.jar"/>
<include name="annotation/javax.annotation-api-1.3.2.jar"/>
<include name="codemodel/codemodel-2.4.1.jar"/>
<include name="google/guava-18.0.jar"/>
<include name="google/jsonschema2pojo-core-0.3.6.jar"/>
<include name="ini4j/ini4j-0.5.2.jar"/>
<include name="j2html/j2html-0.7.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="jcommander/jcommander-1.48.jar"/>
<include name="jetty/jetty-all-7.0.0.jar"/>
<include name="jna/jna-3.4.0.jar"/>
<include name="joda/joda-time-2.2.jar"/>
<include name="junit/junit-4.9.jar"/>
<include name="logback/logback-classic-1.1.2.jar"/>
<include name="logback/logback-core-1.1.2.jar"/>
<include name="servlet/servlet-api-2.5.jar"/>
<include name="slf4j/slf4j-api-1.7.7.jar"/>
<include name="snakeyaml/snakeyaml-1.11.jar"/>
<include name="syslog4j/syslog4j-0.9.46.jar"/>
<include name="kbase/common/kbase-common-0.0.23.jar"/>
<include name="kbase/auth/kbase-auth-0.4.4.jar"/>
<!--
TODO DEPS see if this can be removed after switching to the python callback server
Provenance classes are used in various callback server related classes and tests
-->
<include name="kbase/workspace/WorkspaceClient-0.6.0.jar"/>
</fileset>
<path id="compile.classpath">
<fileset refid="lib"/>
</path>
<target name="init">
<!-- Create the output directory structure-->
<mkdir dir="${classes}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${bin.local}"/>
</target>
<target name="compile" depends="init" description="compile the source">
<!-- Compile class files-->
<exec executable="git" outputproperty="git.url"><arg line="config --get remote.origin.url"/></exec>
<exec executable="git" outputproperty="git.branch"><arg line="rev-parse --abbrev-ref HEAD"/></exec>
<exec executable="git" outputproperty="git.commit"><arg line="rev-parse HEAD"/></exec>
<echo file="${src}/us/kbase/mobu/git.properties">### PLEASE DO NOT CHANGE THIS FILE MANUALLY! ###
giturl=${git.url}
branch=${git.branch}
commit=${git.commit}</echo>
<echo>Compiling with jar directory: ${jardir}</echo>
<javac destdir="${classes}" srcdir="${src}" includeantruntime="false" debug="true" classpathref="compile.classpath" target="1.7" source="1.7" />
<!-- Copy resource files-->
<copy todir="${classes}">
<fileset dir="${src}">
<patternset>
<include name="**/*.properties"/>
<include name="**/*.py"/>
<include name="**/*.css"/>
<include name="**/*.spec"/>
<include name="**/*.html"/>
</patternset>
</fileset>
</copy>
<!-- Make main jar file-->
<jar destfile="${dist}/${module_builder.jar.file}" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="us.kbase.mobu.ModuleBuilder"/>
</manifest>
</jar>
<copy todir="${classes}">
<fileset dir="${src}">
<patternset>
<include name="us/kbase/kidl/**/*.java"/>
<include name="us/kbase/jkidl/**/*.java"/>
</patternset>
</fileset>
</copy>
<jar destfile="${dist}/${kidl.jar.file}">
<fileset dir="${classes}">
<include name="us/kbase/kidl/**"/>
<include name="us/kbase/jkidl/**"/>
</fileset>
</jar>
<!-- Remove uncompressed class files-->
<delete dir="${classes}"/>
</target>
<target name="sh_bin" description="create shell file wrappers">
<!-- Define absolute path to main jar file-->
<property name="jar.absolute.path" location="${dist}/${module_builder.jar.file}"/>
<!-- Define classpath string with : delimiter from list of lib-jar files-->
<pathconvert targetos="unix" property="lib.classpath" refid="compile.classpath"/>
<!-- Create main shell script-->
<echo file="${bin.local}/${module_builder.sh.file}">#!/bin/bash
java -cp ${lib.classpath}:${jar.absolute.path} us.kbase.mobu.ModuleBuilder $@
</echo>
<chmod file="${bin.local}/${module_builder.sh.file}" perm="a+x"/>
</target>
<target name="compile_and_bin" depends="compile, sh_bin" description="compile and create shell file in the local bin directory" >
</target>
<path id="jacoco.classpath">
<fileset dir="${jardir}">
<include name="jacoco/org.jacoco.ant-0.8.4.jar"/>
<include name="jacoco/org.jacoco.core-0.8.4.jar"/>
<include name="jacoco/org.jacoco.report-0.8.4.jar"/>
<include name="jacoco/org.jacoco.agent-0.8.4.jar"/>
<include name="asm/asm-7.1.jar"/>
<include name="asm/asm-commons-7.1.jar"/>
<include name="asm/asm-analysis-7.1.jar"/>
<include name="asm/asm-tree-7.1.jar"/>
</fileset>
</path>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpathref="jacoco.classpath"/>
<target name="test" depends="compile" description="create test script">
<delete dir="${report.dir}"/>
<mkdir dir="${report.dir}"/>
<mkdir dir="${report.dir}/html"/>
<unzip src="${dist}/${module_builder.jar.file}" dest="${report.dir}/classes"/>
<!-- Define absolute path to main jar file-->
<jacoco:coverage destfile="${report.dir}/jacoco.exec" excludes="org/*:junit/*">
<junit printsummary="yes" failureproperty="test.failed" fork="true">
<classpath>
<pathelement location="${dist}/${module_builder.jar.file}"/>
<path refid="compile.classpath"/>
</classpath>
<formatter type="plain" usefile="false"/>
<formatter type="xml" usefile="true" if="env.JENKINS_REPORT_DIR"/>
<batchtest todir="${report.dir}">
<fileset dir="${report.dir}/classes">
<include name="us/kbase/test/**/**Test.class"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<fail message="Test failure detected, check test results." if="test.failed" />
<jacoco:report>
<executiondata>
<file file="${report.dir}/jacoco.exec"/>
</executiondata>
<structure name="SDK">
<classfiles>
<fileset dir="${report.dir}/classes">
<exclude name="**/test/**"/>
<exclude name="**/fraser/neil/**"/>
<exclude name="**/common/executionengine/**"/>
<exclude name="**/common/service/**"/>
<exclude name="**/catalog/**"/>
<exclude name="**/narrativemethodstore/**"/>
<exclude name="**/kbasejobservice/**"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src}"/>
</sourcefiles>
</structure>
<html destdir="${report.dir}/html"/>
<csv destfile="${report.dir}/coverage-report.csv"/>
<xml destfile="${report.dir}/coverage-report.xml"/>
</jacoco:report>
<delete dir="${report.dir}/classes"/>
<exec executable="bash">
<arg value="./test_scripts/print_test_coverage.sh" />
</exec>
</target>
<target name="clean" description="clean up" >
<!-- Clean up internal temporary files and folders-->
<delete dir="${classes}"/>
<delete dir="${dist}"/>
<delete dir="${bin.local}"/>
</target>
</project>