forked from jog/datasphere
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
148 lines (121 loc) · 4.97 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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="tar" name="answertree-server-library">
<description>Builds a specific Datasphere Catalog application jar</description>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<property file="build.override.properties" description="User overrides for build properties" />
<property file="build.properties" description="Build properties" />
<tstamp />
<buildnumber/>
<property name="build.version" value="${target.dist.version}.${build.number}" />
<property name="tar.dir" value="${target.tar.name}-${build.version}" />
<!--=============================================================================-->
<target name="tar">
<antcall target="initialize" />
<antcall target="install_dependencies" />
<antcall target="compile_source" />
<antcall target="create_readme" />
<antcall target="create_tar" />
</target>
<!--=============================================================================-->
<target name="initialize">
<!-- setup required directories -->
<trycatch>
<try><delete dir="${dist.dir}" /></try>
<catch></catch>
</trycatch>
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir}/classes" />
</target>
<!--=============================================================================-->
<target name="install_dependencies">
<!-- install required dependencies -->
<foreach list="${target.dependencies}" param="dependency" target="copy_dependency" />
</target>
<!--=============================================================================-->
<target name="copy_dependency">
<!--rebuild any jar we're dependent on if required -->
<if>
<equals arg1="${target.dependency.rebuild}" arg2="true" />
<then>
<echo>attempting to rebuild dependency: ${dependency}...</echo>
<ant
antfile="${target.dependency.base}/${dependency}/build.xml"
inheritall="false"
target="jar" />
<echo>successfully rebuilt dependency: ${dependency}...</echo>
<!-- copy the jar we're dependent on to the lib directory -->
<copy todir="${lib.dir}" overwrite="true">
<fileset dir="${target.dependency.base}/${dependency}/dist">
<include name="*" />
</fileset>
</copy>
<echo>successfully copied files for ${dependency}...</echo>
</then>
</if>
</target>
<!--=============================================================================-->
<target name="compile_source">
<!-- compile source code -->
<javac
srcdir="${src.dir}"
destdir="${build.dir}/classes"
target="${target.java.version}"
debug="${target.java.debug}" >
<classpath>
<fileset dir="${lib.dir}" includes="*.jar" />
</classpath>
</javac>
<echo>successfully compiled source files...</echo>
</target>
<!--=============================================================================-->
<target name="create_jar">
<!-- create the jar file and manifest -->
<!-- jar destfile="${dist.dir}/${target.jar.name}-${build.version}.jar" -->
<jar destfile="${dist.dir}/${target.jar.name}.jar">
<zipgroupfileset dir="lib" includes="*.jar" />
<fileset dir="${build.dir}/classes" />
<manifest>
<attribute name="Created-By" value="${target.author}" />
<attribute name="Main-Class" value="${target.main.class}" />
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
<echo>successfully created executable jar file...</echo>
</target>
<!--=============================================================================-->
<target name="create_tar">
<mkdir dir="${tar.dir}" />
<mkdir dir="${tar.dir}/${bin.dir}" />
<mkdir dir="${tar.dir}/${logs.dir}" />
<copy todir="${tar.dir}/${bin.dir}/classes"><fileset dir="${build.dir}/classes"/></copy>
<copy todir="${tar.dir}/${lib.dir}"><fileset dir="${lib.dir}"/></copy>
<copy todir="${tar.dir}/${conf.dir}"><fileset dir="${conf.dir}"/></copy>
<copy todir="${tar.dir}/${resources.dir}"><fileset dir="${resources.dir}"/></copy>
<copy file="startup.sh" tofile="${tar.dir}/startup.sh"/>
<tar
destfile="${dist.dir}/${tar.dir}.tar"
basedir="" includes="${tar.dir}/**" />
<trycatch>
<try><delete dir="${tar.dir}" /></try>
<catch></catch>
</trycatch>
<echo>successfully created distributable tar file...</echo>
</target>
<!--=============================================================================-->
<target name="create_readme">
<echo file="${build.dir}/classes/version.info">
version: ${build.version}
build-time: ${TODAY} at ${TSTAMP}
java-version: ${target.java.version}
debug: ${target.java.debug}
compiled-by: ${target.author}
</echo>
<echo>successfully created readme...</echo>
</target>
<!--=============================================================================-->
<target name="clean" description="Returns the build directory to a clean state">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
</project>