-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
executable file
·286 lines (266 loc) · 10.7 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<?xml version="1.0" encoding="utf-8"?>
<project name="feathers-sdk-manager" default="build" basedir=".">
<!-- build.local.properties and sdk.local.proprties are optional files that
can be used to override the default properties. -->
<property file="./sdk.local.properties"/>
<property file="./sdk.properties"/>
<property file="./build.local.properties"/>
<property file="./build.properties"/>
<loadfile srcFile="${source.root}/FeathersSDKManager-app.xml" property="version">
<filterchain>
<linecontains>
<contains value="<versionNumber>"/>
</linecontains>
<striplinebreaks/>
<trim/>
<replacestring from="<versionNumber>" to=""/>
<replacestring from="</versionNumber>" to=""/>
</filterchain>
</loadfile>
<loadfile srcFile="${source.root}/FeathersSDKManager-app.xml" property="appid">
<filterchain>
<linecontains>
<contains value="<id>"/>
</linecontains>
<striplinebreaks/>
<trim/>
<replacestring from="<id>" to=""/>
<replacestring from="</id>" to=""/>
</filterchain>
</loadfile>
<condition property="is.mac" value="true">
<os family="mac" />
</condition>
<condition property="bundle.extension" value=".app">
<os family="mac" />
</condition>
<condition property="bundle.extension" value="">
<os family="windows" />
</condition>
<!-- required properties that will cause the build to fail if missing -->
<fail unless="air.certificate.path" message="Must define air.certificate.path in build.local.properties to sign AIR application (on Mac, this may be a self-signed certificate because we will re-sign with an Apple certificate later)"/>
<fail unless="air.certificate.password" message="Must define air.certificate.password in build.local.properties to sign AIR application (on Mac, this may be a self-signed certificate because we will re-sign with an Apple certificate later)"/>
<fail message="Must define mac.application.certificate.name in build.local.properties to sign Mac application (this must be an Apple-issued certificate)">
<condition>
<and>
<os family="mac" />
<not>
<isset property="mac.application.certificate.name"/>
</not>
</and>
</condition>
</fail>
<fail message="Must define mac.installer.certificate.name in build.local.properties to sign Mac installer (this must be an Apple-issued certificate)">
<condition>
<and>
<os family="mac" />
<not>
<isset property="mac.installer.certificate.name"/>
</not>
</and>
</condition>
</fail>
<fail unless="analytics.id" message="Must define analytics.id in build.local.properties for analytics"/>
<target name="build" depends="-build-win,-build-mac" description="Builds the Feathers SDK Manager for the current platform"/>
<target name="-build-win" depends="-build-air-bundle,-prepare-bundle-win,-package-win" unless="is.mac"/>
<target name="-build-mac" depends="-build-air-bundle,-prepare-bundle-mac,-sign-mac,-package-mac" if="is.mac"/>
<target name="-prepare">
<delete dir="${output.path}"/>
</target>
<target name="-build-swf" depends="-prepare">
<echo message="Building FeathersSDKManager.swf"/>
<java jar="${mxmlc}" dir="${basedir}" fork="true" failonerror="true">
<arg value="+flexlib"/>
<arg value="${frameworks.root}"/>
<arg value="+configname=air"/>
<arg value="-define"/>
<arg value="CONFIG::USE_ANALYTICS"/>
<arg value="true"/>
<arg value="-define"/>
<arg value="CONFIG::ANALYTICS_TRACKING_ID"/>
<arg value="'${analytics.id}'"/>
<arg value="-swf-version=${swf.version}"/>
<arg value="-source-path+=${source.root}"/>
<arg value="-library-path+=${library.root}"/>
<arg value="-library-path+=${theme.root}"/>
<arg value="${source.root}/FeathersSDKManager.mxml"/>
<arg value="-output=${output.path}/FeathersSDKManager.swf"/>
</java>
</target>
<target name="-build-air-bundle" depends="-build-swf">
<echo message="Packaging ${bundle.name}${bundle.extension}"/>
<java jar="${adt}" dir="${basedir}" fork="true" failonerror="true">
<arg value="-package"/>
<arg value="-tsa"/>
<arg value="http://sha256timestamp.ws.symantec.com/sha256/timestamp"/>
<arg value="-storetype"/>
<arg value="pkcs12"/>
<arg value="-keystore"/>
<arg value="${air.certificate.path}"/>
<arg value="-storepass"/>
<arg value="${air.certificate.password}"/>
<arg value="-target"/>
<arg value="bundle"/>
<arg value="${output.path}/${bundle.name}${bundle.extension}"/>
<arg value="${source.root}/FeathersSDKManager-app.xml"/>
<arg value="-C"/>
<arg value="${icon.path}"/>
<arg line="icon16.png"/>
<arg line="icon32.png"/>
<arg line="icon48.png"/>
<arg line="icon128.png"/>
<arg line="icon512.png"/>
<arg value="-C"/>
<arg value="${output.path}"/>
<arg value="FeathersSDKManager.swf"/>
</java>
<!-- we no longer need the SWF -->
<delete file="${output.path}/FeathersSDKManager.swf"/>
</target>
<target name="-prepare-bundle-mac" if="is.mac">
<!-- these files are not required for this app -->
<delete dir="${output.path}/${bundle.name}${bundle.extension}/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/Flash Player.plugin"/>
<delete file="${output.path}/${bundle.name}${bundle.extension}/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/WebKit.dylib"/>
<delete file="${output.path}/${bundle.name}${bundle.extension}/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/Adobe AIR.vch"/>
<delete dir="${output.path}/${bundle.name}${bundle.extension}/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/AdobeCP15.plugin"/>
</target>
<target name="-sign-mac" if="is.mac">
<echo message="Signing ${bundle.name}${bundle.extension}"/>
<exec executable="${mac.codesign}">
<arg value="-f"/>
<arg value="-v"/>
<arg value="--deep"/>
<arg value="-s"/>
<arg value="${mac.application.certificate.name}"/>
<arg value="${output.path}/${bundle.name}${bundle.extension}"/>
</exec>
<echo message="Verifying signature for ${bundle.name}${bundle.extension}"/>
<exec executable="${mac.spctl}">
<arg value="--assess"/>
<arg value="--verbose"/>
<arg value="--type"/>
<arg value="execute"/>
<arg value="${output.path}/${bundle.name}${bundle.extension}"/>
</exec>
</target>
<target name="-package-mac" if="is.mac">
<echo message="Creating and signing FeathersSDKManagerInstaller-${version}.pkg"/>
<exec executable="${mac.pkgbuild}">
<arg value="--component"/>
<arg value="${output.path}/${bundle.name}${bundle.extension}"/>
<arg value="--version"/>
<arg value="${version}"/>
<arg value="--install-location"/>
<arg value="/Applications"/>
<arg value="--sign"/>
<arg value="${mac.installer.certificate.name}"/>
<arg value="${output.path}/FeathersSDKManagerInstaller-${version}.pkg"/>
</exec>
<echo message="Verifying signature for FeathersSDKManagerInstaller-${version}.pkg"/>
<exec executable="${mac.spctl}">
<arg value="--assess"/>
<arg value="--verbose"/>
<arg value="--type"/>
<arg value="install"/>
<arg value="${output.path}/FeathersSDKManagerInstaller-${version}.pkg"/>
</exec>
<!-- clean up -->
<delete includeemptydirs="true" removeNotFollowedSymlinks="true">
<fileset dir="${output.path}" casesensitive="false" followsymlinks="false">
<exclude name="FeathersSDKManagerInstaller-${version}.pkg"/>
</fileset>
</delete>
</target>
<target name="-prepare-bundle-win" unless="is.mac">
<!-- remove unneeded WebKit and DRM files -->
<delete dir="${output.path}/${bundle.name}/Adobe AIR/Versions/1.0/Resources/WebKit"/>
<delete file="${output.path}/${bundle.name}/Adobe AIR/Versions/1.0/Resources/WebKit.dll"/>
<delete file="${output.path}/${bundle.name}/Adobe AIR/Versions/1.0/Resources/NPSWF32.dll"/>
<delete file="${output.path}/${bundle.name}/Adobe AIR/Versions/1.0/Resources/AdobeCP15.dll"/>
<delete file="${output.path}/${bundle.name}/Adobe AIR/Versions/1.0/Resources/adobecp.vch"/>
<delete file="${output.path}/${bundle.name}/Adobe AIR/Versions/1.0/Resources/AdobeCP.dll"/>
<delete file="${output.path}/${bundle.name}/Adobe AIR/Versions/1.0/Resources/Adobe AIR.vch"/>
</target>
<target name="-package-win" unless="is.mac">
<!-- copy installer build scripts to output so that we can build from
that location. -->
<copy todir="${output.path}">
<fileset dir="${basedir}/nsis">
<include name="feathers-sdk-manager.nsi"/>
<include name="*.nsh"/>
<include name="*.bmp"/>
</fileset>
</copy>
<exec executable="${win.nsis}" dir="${output.path}" failonerror="true">
<arg value="/DVERSION=${version}"/>
<arg value="feathers-sdk-manager.nsi"/>
</exec>
<!-- the installer should be signed too -->
<exec executable="${win.signtool}" dir="${output.path}" failonerror="true">
<arg value="sign"/>
<arg value="/f"/>
<arg value="${air.certificate.path}"/>
<arg value="/p"/>
<arg value="${air.certificate.password}"/>
<arg value="FeathersSDKManagerInstaller-${version}.exe"/>
</exec>
<!-- clean up -->
<delete includeemptydirs="true" removeNotFollowedSymlinks="true">
<fileset dir="${output.path}" casesensitive="false" followsymlinks="false">
<exclude name="FeathersSDKManagerInstaller-${version}.exe"/>
</fileset>
</delete>
</target>
<target name="notarize-mac">
<fail message="Must define mac.notarize.username in build.local.properties to notarize macOS application">
<condition>
<and>
<os family="mac" />
<not>
<isset property="mac.notarize.username"/>
</not>
</and>
</condition>
</fail>
<fail message="Must define mac.notarize.password in build.local.properties to notarize macOS application">
<condition>
<and>
<os family="mac" />
<not>
<isset property="mac.notarize.password"/>
</not>
</and>
</condition>
</fail>
<exec executable="${mac.xcrun}" failonerror="true">
<arg value="altool"/>
<arg value="--notarize-app"/>
<arg value="--primary-bundle-id"/>
<arg value="${appid}"/>
<arg value="--username"/>
<arg value="${mac.notarize.username}"/>
<arg value="--password"/>
<arg value="${mac.notarize.password}"/>
<arg value="--file"/>
<arg value="${output.path}/FeathersSDKManagerInstaller-${version}.pkg"/>
</exec>
</target>
<target name="notarize-mac-status">
<exec executable="${mac.xcrun}" failonerror="true">
<arg value="altool"/>
<arg value="--notarization-history"/>
<arg value="0"/>
<arg value="--username"/>
<arg value="${mac.notarize.username}"/>
<arg value="--password"/>
<arg value="${mac.notarize.password}"/>
</exec>
</target>
<target name="notarize-mac-staple">
<exec executable="${mac.xcrun}" failonerror="true">
<arg value="stapler"/>
<arg value="staple"/>
<arg value="${output.path}/FeathersSDKManagerInstaller-${version}.pkg"/>
</exec>
</target>
</project>