-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
222 lines (161 loc) · 7.69 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?xml version="1.0" encoding="UTF-8"?>
<project name="Bundle the Java into Mac App" default="build-and-package">
<property environment="env"/>
<property name="version" value="v1.3.13"/>
<property name="AppVersion" value="RdPro${version}"/>
<property name="src.dir" value="src"/>
<property environment="env"/>
<property name="jre_bundle_dir" value="/Users/i831964/bin/jdk1.8.0_91.jdk/Contents/Home"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<!-- set the operating system test properties -->
<condition property="isMac">
<os family="mac"/>
</condition>
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isUnix">
<os family="unix"/>
</condition>
<macrodef name="maven">
<attribute name="argline"/>
<attribute name="dir"/>
<sequential>
<echo message="****************************************************************************************** @{dir} @{argline}"/>
<echo message="MAVEN_HOME=${env.MAVEN_HOME}"/>
<exec executable="${env.MAVEN_HOME}/bin/mvn.cmd" osfamily="windows" dir="@{dir}" failonerror="true">
<arg line="@{argline} -P dev -Ddev=true -ff"/>
</exec>
<!--<exec executable="/Users/i831964/bin/maven/bin/mvn" dir="@{dir}" failonerror="true">-->
<exec executable="${env.MAVEN_HOME}/bin/mvn" osfamily="mac" dir="@{dir}" failonerror="true">
<arg line="@{argline} -o -P dev -Ddev=true -ff"/>
</exec>
</sequential>
</macrodef>
<target name="build-and-package" description="package and distribute">
<antcall target="update-version"/>
<maven dir="." argline="clean"/>
<maven dir="." argline="-P rdproui package -DskipTests=true"/>
<maven dir="." argline="-P rdpro-console package -DskipTests=true"/>
<!--copy the jar to the dist folder -->
<!--copy the jar to the dist folder -->
<copy file="target/rdpro-ui.jar" todir="dist" overwrite="true"/>
<copy file="target/rdpro-console.jar" todir="dist" overwrite="true"/>
<if>
<equals arg1="${isWindows}" arg2="true"/>
<then>
<antcall target="package-rdpro-console"/>
<antcall target="package-rdpro-ui"/>
</then>
</if>
<if>
<equals arg1="${isMac}" arg2="true"/>
<then>
<antcall target="bundle-mac-app"/>
</then>
</if>
<delete dir="${launch4j.dir}"/>
</target>
<target name="release" description="make the release zip">
<delete dir="dist" includes="*.jar"/>
<antcall target="build-and-package"/>
<delete file="mhisoft-RapiDdeletePro-${version}-binaries.zip"/>
<zip destfile="mhisoft-RapiDdeletePro-${version}-binaries.zip" basedir="dist"/>
</target>
<target name="update-version">
<echo message="Updating version to ${version}"/>
<property name="version.match" value="String\s*version\s*=\s*"(.*)";"/>
<property name="version.replace" value="String version = "${version}";"/>
<replaceregexp encoding="UTF-8" flags="g" match="${version.match}" replace="${version.replace}">
<fileset dir="${src.dir}/main/java/org/mhisoft/rdpro/ui">
<include name="RdProUI.java"/>
</fileset>
</replaceregexp>
</target>
<target name="bundle-mac-app">
<delete file="dist/${AppVersion}.app"/>
<property name="sourceJar" value="rdpro-ui.jar"/>
<property name="launch4jFinalJar" value="rdpro-ui-combined.jar"/>
<property name="AppMainClass" value="org.mhisoft.rdpro.ui.ReproMainForm"/>
<antcall target="_make-one-jar"/>
<bundleapp outputdirectory="./dist"
name="${AppVersion}"
displayname="RdPro UI"
identifier="org.mhisoft.rdpro.ui.ReproMainForm"
mainclassname="org.mhisoft.rdpro.ui.ReproMainForm">
<runtime dir="${jre_bundle_dir}"/>
<classpath file="${launch4j.dir}/rdpro-ui-combined.jar"/>
<!--<option value="-Ddebug=true"/>-->
</bundleapp>
</target>
<!-- =======================================
launch 4j package the exe
======================================= -->
<property name="application.title" value="RdPro"/>
<property name="launch4j.dir" value="dist/tmp_make_exe"/>
<property name="launch4jexe.dir" location="s:\bin\Launch4j"/>
<if>
<equals arg1="${isWindows}" arg2="true"/>
<then>
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4jexe.dir}/launch4j.jar:${launch4jexe.dir}/lib/xstream.jar"/>
</then>
</if>
<!--https://java.net/downloads/appbundler/appbundler.html-->
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="lib/ant/appbundler-1.0.jar"/>
<target name="package-rdpro-ui">
<property name="sourceJar" value="rdpro-ui.jar"/>
<property name="launch4jFinalJar" value="rdpro-ui-combined.jar"/>
<property name="AppMainClass" value="org.mhisoft.rdpro.ui.ReproMainForm"/>
<antcall target="_make-one-jar"/>
<launch4j configFile="launch4j/rdpro-ui-launch4j-config.xml"/>
<!--clean up-->
<!--<delete dir="${launch4j.dir}" failonerror="false"/>-->
</target>
<target name="package-rdpro-console">
<property name="sourceJar" value="rdpro-console.jar"/>
<property name="launch4jFinalJar" value="rdpro-console-combined.jar"/>
<property name="AppMainClass" value="org.mhisoft.rdpro.RdPro"/>
<antcall target="_make-one-jar"/>
<launch4j configFile="launch4j/rdpro-console-launch4j-config.xml"/>
<!--clean up-->
<!--<delete dir="${launch4j.dir}" failonerror="false"/>-->
</target>
<target name="_make-one-jar" description="make the Win Exe Bundle">
<property name="launch4j.jar" value="${launch4j.dir}/${launch4jFinalJar}"/>
<echo message=" --> Packaging ${application.title} into a single JAR at ${launch4j.jar}"/>
<delete dir="${launch4j.dir}" failonerror="false"/>
<mkdir dir="${launch4j.dir}"/>
<!--make the temp_final.jar-->
<if>
<equals arg1="${sourceJar}" arg2="rdpro-ui.jar"/>
<then>
<jar destfile="${launch4j.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="${sourceJar}"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="${AppMainClass}"/>
</manifest>
</jar>
</then>
<else>
<echo message=" -->use source jar: ${sourceJar}"/>
<jar destfile="${launch4j.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="${sourceJar}"/>
<manifest>
<attribute name="Main-Class" value="${AppMainClass}"/>
</manifest>
</jar>
</else>
</if>
<!--make the combined jar-->
<echo message=" --> make the ${launch4j.jar}}"/>
<zip destfile="${launch4j.jar}">
<zipfileset src="${launch4j.dir}/temp_final.jar"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA, META-INF/maven/*, META-INF/jb/*"/>
</zip>
</target>
</project>