-
Notifications
You must be signed in to change notification settings - Fork 178
/
build.xml
146 lines (124 loc) · 5.2 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
<?xml version="1.0"?>
<project name="azkaban" basedir="." default="package">
<property file="build.properties" />
<property name="base.dir" value="${basedir}" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="dist.jar.dir" value="${basedir}/dist/jars" />
<property name="dist.classes.dir" value="${basedir}/dist/classes" />
<property name="dist.packages.dir" value="${basedir}/dist/packages" />
<property name="version.file" value="${basedir}/dist/package.version" />
<property environment="env" />
<path id="main.classpath">
<fileset dir="${extlib.dir}">
<include name="*.jar" />
</fileset>
<pathelement path="${dist.classes.dir}" />
</path>
<!-- create dist folder if it doesn't exist-->
<available file="${dist.dir}" type="dir" property="dist.present"/>
<target name="createDist" description="Create dist dir if it doesn't exist" unless="dist.present" >
<mkdir dir="${dist.dir}" />
</target>
<!-- set the build number based on environment variable, otherwise blank -->
<property environment="env" description="System environment variables (including those set by Hudson)" />
<target name="clean" description="Delete generated files.">
<echo message="Deleting generated files in dist" />
<delete dir="${dist.jar.dir}" />
<delete dir="${dist.classes.dir}" />
</target>
<available file=".git" type="dir" property="git.present"/>
<target name="git.info" description="Store git info" if="git.present">
<exec executable="git" outputproperty="git.commithash" failifexecutionfails="false" errorproperty="">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" outputproperty="git.repo" failifexecutionfails="false" errorproperty="">
<arg value="config"/>
<arg value="--get"/>
<arg value="remote.origin.url"/>
</exec>
<exec executable="git" outputproperty="git.tag" failifexecutionfails="false" errorproperty="">
<arg value="describe"/>
<arg value="--abbrev=0"/>
<arg value="--tags"/>
</exec>
<condition property="git.tag" value="${git.tag}" else="${version}">
<and>
<isset property="git.tag"/>
<length string="${git.tag}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<echo>Git tag found to be ${git.commithash} with tag ${git.tag} from repo ${git.repo}</echo>
</target>
<target name="repo.file" depends="git.info" description="Create a file to reference the git commit">
<delete file="azkaban.version" />
<tstamp>
<format timezone="UTC" property="current.time" pattern="yyyy-MM-dd hh:mm zzz"/>
</tstamp>
<!-- Need to remove indents of the echo contents, because echo into file includes the tabs -->
<echo file="${version.file}">
${git.tag}
${git.commithash}
${git.repo}
${current.time}
</echo>
</target>
<target name="package-dep" depends="createDist,clean,repo.file" description="Create azkaban jar">
<subant target="package">
<property name="version" value="${git.tag}" />
<fileset dir="plugins/hadoopsecuritymanager" includes="build.xml" />
</subant>
<subant target="package">
<property name="version" value="${git.tag}" />
<fileset dir="plugins/hadoopsecuritymanager-yarn" includes="build.xml" />
</subant>
<subant target="package">
<property name="version" value="${git.tag}" />
<fileset dir="plugins/crypto" includes="build.xml" />
</subant>
<subant target="package">
<property name="version" value="${git.tag}" />
<fileset dir="plugins/jobtype" includes="build.xml" />
</subant>
</target>
<target name="package-dep-yarn" depends="createDist,clean,repo.file" description="Create azkaban jar">
<subant target="package">
<property name="version" value="${git.tag}" />
<fileset dir="plugins/hadoopsecuritymanager-yarn" includes="build.xml" />
</subant>
<subant target="package">
<property name="version" value="${git.tag}" />
<fileset dir="plugins/jobtype" includes="build.xml" />
</subant>
<subant target="package">
<property name="version" value="${git.tag}" />
<fileset dir="plugins/crypto" includes="build.xml" />
</subant>
</target>
<target name="package" depends="package-dep" description="Creates plugin packages">
<delete dir="${dist.packages.dir}" />
<mkdir dir="${dist.packages.dir}" />
<!-- Copy Azkaban jars and libs-->
<copy todir="${dist.packages.dir}/jobtypes" >
<fileset dir="${dist.dir}/jobtype/packages" >
<exclude name="azkaban-jobtype-*.gz"/>
</fileset>
</copy>
<tar destfile="${dist.packages.dir}/${name}-${git.tag}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset dir="${dist.packages.dir}" prefix="" filemode="755" />
</tar>
</target>
<target name="package-yarn" depends="package-dep-yarn" description="Creates plugin packages">
<delete dir="${dist.packages.dir}" />
<mkdir dir="${dist.packages.dir}" />
<!-- Copy Azkaban jars and libs-->
<copy todir="${dist.packages.dir}/jobtypes" >
<fileset dir="${dist.dir}/jobtype/packages" >
<exclude name="azkaban-jobtype-*.gz"/>
</fileset>
</copy>
<tar destfile="${dist.packages.dir}/${name}-${git.tag}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset dir="${dist.packages.dir}" prefix="" filemode="755" />
</tar>
</target>
</project>