-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathbuild.xml
193 lines (156 loc) · 9.01 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
<project name="SKY Profiler" default="build" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<description>SKY Profiler build file</description>
<property file="build.properties" />
<property environment="env" />
<path id="classpath">
<fileset dir="${skyprofiler.lib.dir}" includes="**/*.jar" />
</path>
<!-- Maven task Initialization -->
<target name="init.maven">
<property name="mvn_home" value="${env.MAVEN_HOME}" />
<property name="mvn_home" value="${env.M2_HOME}" />
<property name="mvn_home" value="${maven.home}" />
<fail message="Path to "maven_home" must be set. You can set it in application build.properties or in either MAVEN_HOME or M2_HOME environment variable.">
<condition>
<and>
<equals arg1="${mvn_home}" arg2="" trim="true" />
</and>
</condition>
</fail>
<mkdir dir="${skyprofiler.lib.dir}" />
<get src="https://repo.maven.apache.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar"
dest="${skyprofiler.lib.dir}/maven-ant-tasks-2.1.3.jar" usetimestamp="true" />
<path id="maven-ant-tasks.classpath" path="${skyprofiler.lib.dir}/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
</target>
<!-- Initialization -->
<target name="init" description="Generic initialization steps for the project">
<mkdir dir="${skyprofiler.target.dir}" />
</target>
<!-- Initialization for IS package -->
<target name="runtime.init" description="Initialization steps for runtime" depends="init">
<copy todir="${skyprofiler.runtime.dir}/lib">
<fileset dir="${skyprofiler.lib.dir}" includes="wm-is*.jar" casesensitive="yes" />
</copy>
</target>
<!-- Initialization for SKY Profiler server -->
<target name="server.init" description="Initialization steps for server" depends="init">
<mkdir dir="${skyprofiler.server.dir}/src/main/resources/static/fonts" />
<get src="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/fonts/glyphicons-halflings-regular.woff2"
dest="${skyprofiler.server.dir}/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2" usetimestamp="true" />
</target>
<!-- Clean SKY Profiler runtime -->
<target name="runtime.clean" description="Cleaning SKY Profiler server and runtime projects" depends="init.maven, runtime.init">
<artifact:mvn pom="${skyprofiler.runtime.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
<arg value="clean" />
</artifact:mvn>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${skyprofiler.runtime.dir}/lib" includes="wm-is*.jar" />
<fileset dir="${skyprofiler.target.dir}" includes="*.zip" />
</delete>
</target>
<!-- Clean SKY Profiler server -->
<target name="server.clean" description="Cleaning SKY Profiler server and runtime projects" depends="init.maven">
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
<arg value="clean" />
</artifact:mvn>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${skyprofiler.server.dir}/src/main/resources/static/fonts" />
<fileset dir="${skyprofiler.target.dir}" includes="*.jar" />
</delete>
</target>
<!-- Clean all -->
<target name="clean" depends="runtime.clean, server.clean">
<echo message="Cleaning completed for SKY Profiler runtime and server." />
</target>
<!-- update pom version based on the build property version -->
<target name="server.version" description="Update the versions on the maven submodules" depends="init.maven">
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
<jvmarg value="-DnewVersion=${skyprofiler.version}" />
<arg value="versions:set" />
</artifact:mvn>
</target>
<!-- update pom version based on the build property version -->
<target name="runtime.version" description="Update the versions on the maven submodules" depends="init.maven">
<artifact:mvn pom="${skyprofiler.runtime.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
<jvmarg value="-DnewVersion=${skyprofiler.version}" />
<arg value="versions:set" />
</artifact:mvn>
</target>
<!-- Compile and build SKY Profiler runtime -->
<target name="runtime.jar" description="Compiles the sources and creates SKY Profiler runtime jar" depends="runtime.version, runtime.clean, runtime.init">
<artifact:mvn pom="${skyprofiler.runtime.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
<arg value="package" />
<arg value="-DskipTests" />
</artifact:mvn>
</target>
<!-- Compile and build SKY Profiler server -->
<target name="server.jar" description="Compiles the sources and creates SKY Profiler server jar" depends="server.version, server.clean, server.init">
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
<arg value="package" />
<arg value="-DskipTests" />
</artifact:mvn>
</target>
<target name="server.docker.build" description="Build the SKY Profiler docker image" depends="server.jar">
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
<arg value="docker:build" />
<arg value="-DskipTests" />
</artifact:mvn>
</target>
<target name="server.docker.push" description="Deploy the docker image to docker-hub" depends="server.docker.build">
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
<arg value="docker:push" />
<arg value="-DskipTests" />
</artifact:mvn>
</target>
<!-- Building ISPackage -->
<target name="runtime.build" description="Builds runtime jar, Copy IS package files, place the jar and zip them together to create IS package" depends="runtime.jar">
<copy todir="${skyprofiler.target.dir}">
<fileset dir="${skyprofiler.runtime.package}" />
</copy>
<exec executable="cmd" dir="${basedir}/${skyprofiler.target.dir}/SKYProfiler/pub" osfamily="windows">
<arg value="/c"/>
<arg value="bower update"/>
</exec>
<exec executable="/bin/bash" dir="${basedir}/${skyprofiler.target.dir}/SKYProfiler/pub" osfamily="unix">
<arg value="-c"/>
<arg value="bower update"/>
</exec>
<mkdir dir="${skyprofiler.target.dir}/SKYProfiler/code/jars" />
<get src="https://repo1.maven.org/maven2/org/apache/kafka/kafka-clients/0.9.0.1/kafka-clients-0.9.0.1.jar"
dest="${skyprofiler.target.dir}/SKYProfiler/code/jars/kafka-clients-0.9.0.1.jar" usetimestamp="true" />
<get src="https://repo1.maven.org/maven2/com/github/dblock/oshi-core/3.3/oshi-core-3.3.jar"
dest="${skyprofiler.target.dir}/SKYProfiler/code/jars/oshi-core-3.3.jar" usetimestamp="true" />
<get src="https://repo1.maven.org/maven2/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar"
dest="${skyprofiler.target.dir}/SKYProfiler/code/jars/jna-4.4.0.jar" usetimestamp="true" />
<get src="https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/4.4.0/jna-platform-4.4.0.jar"
dest="${skyprofiler.target.dir}/SKYProfiler/code/jars/jna-platform-4.4.0.jar" usetimestamp="true" />
<copy tofile="${skyprofiler.target.dir}/SKYProfiler/code/jars/skyprofiler-${skyprofiler.version}.jar">
<fileset file="${skyprofiler.runtime.dir}/target/*.jar" />
</copy>
<zip destfile="${skyprofiler.target.dir}/SKYProfiler-${skyprofiler.version}.zip">
<zipfileset dir="${skyprofiler.target.dir}/SKYProfiler" />
</zip>
<delete dir="${skyprofiler.target.dir}/SKYProfiler" />
</target>
<!-- Building SKY Profiler Server -->
<target name="server.build" description="Creates SKY Profiler server jar" depends="server.jar">
<copy todir="${skyprofiler.target.dir}">
<fileset file="${skyprofiler.server.dir}/target/*.jar" />
</copy>
</target>
<!-- Complete build [IS Package and Server jar] -->
<target name="build" depends="runtime.build, server.build">
<echo message="Build execution completed for SKY Profiler runtime and server. The binaries are placed at - ${skyprofiler.target.dir}" />
</target>
</project>