-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
130 lines (121 loc) · 5.15 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
<project name="DomainAnnotation" default="compile" basedir=".">
<description>
Build JAR and WAR files for DomainAnnotation
</description>
<!-- set global properties for this build -->
<property name="src" location="lib/src"/>
<property name="test.src" location="test/src"/>
<property name="dist" location="dist"/>
<property name="classes" location="classes"/>
<property name="bin" location="bin"/>
<property name="jar.file" value="DomainAnnotation.jar"/>
<property name="jars.dir" value="/kb/deployment/lib/jars"/>
<property name="war.file" value="DomainAnnotation.war"/>
<property name="scripts" location="scripts"/>
<property name="web.xml" location="${scripts}/web.xml"/>
<property name="exec.cmd.file" value="run_DomainAnnotation_async_job.sh"/>
<property name="startup.cmd.file" value="start_server.sh"/>
<fileset dir="${jars.dir}" id="lib">
<include name="ini4j/ini4j-0.5.2.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="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="kbase/auth/kbase-auth-0.3.1.jar"/>
<include name="kbase/common/kbase-common-0.0.17.jar"/>
<include name="logback/logback-core-1.1.2.jar"/>
<include name="logback/logback-classic-1.1.2.jar"/>
<include name="servlet/servlet-api-2.5.jar"/>
<include name="slf4j/slf4j-api-1.7.7.jar"/>
<include name="syslog4j/syslog4j-0.9.46.jar"/>
<include name="kbase/workspace/WorkspaceClient-0.2.0.jar"/>
<include name="kbase/shock/shock-client-0.0.10.jar" />
<include name="kbase/genomes/kbase-genomes-20140411.jar"/>
<include name="strbio/strbio-1.3.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="apache_commons/commons-logging-1.1.1.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"/>
</fileset>
<path id="compile.classpath">
<fileset refid="lib"/>
</path>
<path id="src.path">
<pathelement location="${src}" />
<pathelement location="${test.src}" />
</path>
<target name="compile" description="compile the source">
<mkdir dir="${classes}"/>
<mkdir dir="${dist}"/>
<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}/git.properties">giturl=${git.url}
branch=${git.branch}
commit=${git.commit}</echo>
<!-- Compile class files-->
<javac destdir="${classes}" includeantruntime="false" target="1.7" source="1.7" debug="true" classpathref="compile.classpath">
<src refid="src.path"/>
</javac>
<!-- Copy resource files-->
<copy todir="${classes}">
<fileset dir="${src}">
</fileset>
</copy>
<!-- Copy dependencies-->
<unzip dest="${classes}">
<fileset refid="lib"/>
</unzip>
<jar destfile="${dist}/${jar.file}" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="domainannotation.DomainModelLibPreparation"/>
</manifest>
</jar>
<delete dir="${classes}"/>
</target>
<target name="war" depends="compile" description="build the WAR file. Assumes compile has been run">
<!-- make the war file for the server-->
<mkdir dir="${dist}/lib"/>
<copy todir="${dist}/lib/" flatten="true">
<fileset refid="lib"/>
<resources>
<file file="${dist}/${jar.file}"/>
</resources>
</copy>
<war destfile="${dist}/${war.file}" webxml="${web.xml}">
<lib dir="${dist}/lib/"/>
</war>
<delete dir="${dist}/lib"/>
<mkdir dir="${scripts}/webapps"/>
<copy file="${dist}/${war.file}" tofile="${scripts}/webapps/root.war"/>
</target>
<target name="build-executable-script" description="create command-line script">
<mkdir dir="${bin}"/>
<property name="jar.absolute.path" location="${dist}/${jar.file}"/>
<pathconvert targetos="unix" property="lib.classpath" refid="compile.classpath"/>
<echo file="${bin}/${exec.cmd.file}">#!/bin/bash
java -cp ${jar.absolute.path}:${lib.classpath} domainannotation.DomainAnnotationServer $1 $2 $3
</echo>
<chmod file="${bin}/${exec.cmd.file}" perm="a+x"/>
</target>
<target name="test" description="run all tests">
<junit printsummary="yes" haltonfailure="yes" fork="true">
<classpath>
<pathelement location="${dist}/${jar.file}"/>
<path refid="compile.classpath"/>
</classpath>
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="${test.src}">
<include name="**/test/**Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>