-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbuild.xml
202 lines (145 loc) · 6.86 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Bundle the Java into Mac App" default="build" >
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<property name="AppVersion" value="1.3"/>
<property name="repository.dir" value="~/repository"/>
<!-- 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>
<property environment="env"/>
<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} -T 1C -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 -T 1C -P dev -Ddev=true -ff"/>
</exec>
</sequential>
</macrodef>
<target name="build" description="make the full build ">
<maven dir="." argline="clean" />
<maven dir="." argline="-P fastcopy-ui package"/>
<maven dir="." argline="-P fastcopy-console package"/>
<!--copy the jar to the dist folder -->
<!--copy the jar to the dist folder -->
<copy file="target/fastcopy-ui.jar" todir="dist" overwrite="true"/>
<copy file="target/fastcopy-console.jar" todir="dist" overwrite="true"/>
<antcall target="package"/>
</target>
<target name="package">
<if>
<equals arg1="${isWindows}" arg2="true"/>
<then>
<antcall target="package-fastcopy-console"/>
<antcall target="package-fastcopy-ui"/>
</then>
</if>
<antcall target="bundle-mac-app"/>
<delete dir="${launch4j.dir}"/>
</target>
<target name="release">
<delete dir="dist" includes="*.jar, *.exe"/>
<antcall target="build"/>
<delete file="mhisoft-fastcopy-v${AppVersion}-binaries.zip"/>
<zip destfile="mhisoft-fastcopy-v${AppVersion}-binaries.zip" basedir="dist"/>
</target>
<target name="bundle-mac-app">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="dist/Fastcopy(${AppVersion}).app" includes="**"/>
</delete>
<property name="sourceJar" value="fastcopy-ui.jar"/>
<property name="launch4jFinalJar" value="fastcopy-ui-combined.jar"/>
<property name="AppMainClass" value="org.mhisoft.fc.ui.FastCopyMainForm"/>
<antcall target="_make-one-jar"/>
<bundleapp outputdirectory="./dist"
name="Fastcopy(${AppVersion})"
displayname="Fastcopy UI"
identifier="${AppMainClass}"
mainclassname="${AppMainClass}">
<classpath dir="dist" includes="fastcopy-ui.jar,lib/*.jar"/>
</bundleapp>
</target>
<!-- =======================================
launch 4j package the exe
======================================= -->
<property name="application.title" value="FastCopy"/>
<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-fastcopy-ui">
<property name="sourceJar" value="fastcopy-ui.jar"/>
<property name="launch4jFinalJar" value="fastcopy-ui-combined.jar"/>
<property name="AppMainClass" value="org.mhisoft.fc.ui.FastCopyMainForm"/>
<antcall target="_make-one-jar"/>
<launch4j configFile="launch4j/fastcopy-ui-launch4j-config.xml" />
<!--clean up-->
<!--<delete dir="${launch4j.dir}" failonerror="false"/>-->
</target>
<target name="package-fastcopy-console">
<property name="sourceJar" value="fastcopy-console.jar"/>
<property name="launch4jFinalJar" value="fastcopy-console-combined.jar"/>
<property name="AppMainClass" value="org.mhisoft.fc.FastCopy"/>
<antcall target="_make-one-jar"/>
<launch4j configFile="launch4j/fastcopy-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="fastcopy-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>