1 <?xml version="1.0" encoding="UTF-8"?>
3 * Simple Ant (http://jakarta.apache.org/ant) build script for Cyberduck
6 * $Date: 2010-08-25 13:25:44 +0200 (Mi, 25 Aug 2010) $
8 * Copyright (c) 2005-2012 David Kocher. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.package
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * Bug fixes, suggestions and comments should be sent to:
22 * dkocher@cyberduck.io
24 <project name="Cyberduck for Mac" basedir=".">
26 <import file="build.xml"/>
28 <property name="app.bundle" value="${build}/${app.name}.app"/>
29 <property name="cli.bundle" value="${build}/duck.bundle"/>
31 <property name="bundle.contents" value="Contents"/>
32 <property name="bundle.home" value="${bundle.contents}/Home"/>
33 <property name="bundle.macos" value="${bundle.contents}/MacOS"/>
34 <property name="bundle.library" value="${bundle.contents}/Library"/>
35 <property name="bundle.frameworks" value="${bundle.contents}/Frameworks"/>
36 <property name="bundle.resources" value="${bundle.contents}/Resources"/>
37 <property name="bundle.spotlight" value="${bundle.library}/Spotlight"/>
38 <property name="bundle.profiles" value="${bundle.resources}/Profiles"/>
39 <property name="bundle.bookmarks" value="${bundle.resources}/Bookmarks"/>
40 <property name="bundle.runtime" value="${bundle.macos}/Runtime.jre"/>
41 <property name="bundle.runtime.lib"
42 value="@executable_path/../MacOS/Runtime.jre/Contents/Home/lib/server/libjvm.dylib"/>
44 <property name="app.runtime.system.min" value="10.6"/>
46 <property name="jvm.runtime.home" value="${lib}/1.7.0-u40-b30.jre"/>
47 <property name="jvm.runtime.bin" value="${jvm.runtime.home}/${bundle.home}/bin"/>
49 <property name="codesign.certificate" value="Developer ID Application: David Kocher"/>
50 <property name="codesign.keychain" value="${user.home}/Library/Keychains/codesign.keychain"/>
51 <property name="codesign.entitlements" value="${home}/sandbox.plist"/>
52 <!-- Designated requirement -->
53 <property name="codesign.requirement.source" value="${home}/codesign-requirement.txt"/>
54 <property name="codesign.requirement" value="${home}/codesign-requirement.bin"/>
55 <property name="codesign.options" value="--timestamp=none --force"/>
56 <property name="codesign.arg"
57 value="--entitlements ${codesign.entitlements} --requirements ${codesign.requirement}"/>
59 <property name="keychain.password" value=""/>
61 <property name="installer.certificate" value="3rd Party Mac Developer Installer: David Kocher (G69SCX94XU)"/>
62 <property name="installer.keychain" value="${user.home}/Library/Keychains/codesign.keychain"/>
64 <property name="sparkle.feed" value="/dev/null"/>
66 <property name="spotlight" value="${home}/Spotlight Importer"/>
67 <property name="build.spotlight" value="${spotlight}/build/${configuration}"/>
69 <property name="build.xcodeoptions" value="SDKROOT=macosx10.9 MACOSX_DEPLOYMENT_TARGET=${app.runtime.system.min}"/>
71 <property name="build.lipo.binaries" value="**/Contents/MacOS/*,**/*.framework/Versions/Current/*,**/*.dylib"/>
72 <property name="build.lipo.arch.remove" value=""/>
74 <target name="spotlight">
75 <property name="build.settings"
76 value="${build.xcodeoptions} VERSION=${version} REVISION=${revision} SPARKLEFEED=${sparkle.feed} COPYRIGHT='${copyright}'"/>
77 <exec dir="${spotlight}" executable="/usr/bin/xcrun" spawn="false" failonerror="true">
78 <arg line="--verbose xcodebuild -project 'Spotlight Importer.xcodeproj' -configuration Release ${build.settings}"/>
80 <copy todir="${app.bundle}/${bundle.spotlight}">
81 <fileset dir="${build.spotlight}">
82 <include name="*.mdimporter/**"/>
85 <chmod perm="a+x" type="file">
86 <fileset dir="${app.bundle}/${bundle.spotlight}">
87 <include name="**/MacOS/*"/>
90 <apply executable="/usr/bin/codesign" failonerror="true"
92 parallel="false" spawn="false" force="true">
93 <arg line="${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
94 <fileset dir="${app.bundle}/${bundle.spotlight}">
95 <include name="*.mdimporter"/>
101 <target name="_build" depends="spotlight">
102 <echo message="Building ${app.bundle}"/>
103 <property name="build.settings"
104 value="${build.xcodeoptions} VERSION=${version} REVISION=${revision} SPARKLEFEED=${sparkle.feed} COPYRIGHT='${copyright}'"/>
105 <exec dir="${home}" executable="/usr/bin/xcrun" spawn="false" failonerror="true">
106 <arg line="--verbose xcodebuild -project ${app.name}.xcodeproj -configuration Release -target app ${build.settings}"/>
108 <copy todir="${app.bundle}/${bundle.frameworks}">
109 <!-- Dynamic libraries built with xcodebuild -->
110 <fileset dir="${build}">
111 <include name="*.dylib"/>
113 <fileset dir="${lib}">
114 <!-- Include libjnidispatch.dylib -->
115 <include name="*.dylib"/>
118 <copy todir="${app.bundle}/${bundle.resources}">
119 <fileset dir="${build}">
120 <include name="*.jar"/>
122 <fileset dir="${lib}">
123 <include name="*.jar"/>
126 <mkdir dir="${app.bundle}/${bundle.runtime}/${bundle.home}"/>
127 <!-- Copy runtime -->
128 <echo message="Copy runtime from ${jvm.runtime.home} to ${app.bundle}/${bundle.runtime}..."/>
129 <copy todir="${app.bundle}/${bundle.runtime}" preservelastmodified="true">
130 <fileset followsymlinks="false" dir="${jvm.runtime.home}" excludesfile="runtime-excludes.properties"/>
132 <antcall target="shared-library-install-name">
133 <param name="oldname" value="/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM"/>
134 <param name="newname" value="${bundle.runtime.lib}"/>
135 <param name="directory" value="${app.bundle}/${bundle.frameworks}"/>
137 <!-- Remove architectures -->
138 <foreach target="lipo" param="arch" list="${build.lipo.arch.remove}">
139 <param name="directory" value="${app.bundle}"/>
144 <echo message="Building ${cli.bundle}"/>
145 <property name="build.settings"
146 value="MACOSX_DEPLOYMENT_TARGET=${app.runtime.system.min} VERSION=${version} REVISION=${revision} COPYRIGHT='${copyright}'"/>
147 <exec dir="${home}" executable="/usr/bin/xcrun" spawn="false" failonerror="true">
148 <arg line="--verbose xcodebuild -project ${app.name}.xcodeproj -configuration Release -target cli ${build.settings}"/>
150 <copy todir="${cli.bundle}/${bundle.frameworks}">
151 <!-- Dynamic libraries built with xcodebuild -->
152 <fileset dir="${build}">
153 <include name="*.dylib"/>
155 <fileset dir="${lib}">
156 <!-- Include libjnidispatch.dylib -->
157 <include name="*.dylib"/>
160 <copy todir="${cli.bundle}/${bundle.resources}">
161 <fileset dir="${build}">
162 <include name="*.jar"/>
164 <fileset dir="${lib}">
165 <include name="*.jar"/>
168 <mkdir dir="${app.bundle}/${bundle.runtime}/${bundle.home}"/>
169 <!-- Copy runtime -->
170 <echo message="Copy runtime from ${jvm.runtime.home} to ${cli.bundle}/${bundle.runtime}..."/>
171 <copy todir="${cli.bundle}/${bundle.runtime}" preservelastmodified="true">
172 <fileset followsymlinks="false" dir="${jvm.runtime.home}" excludesfile="runtime-excludes.properties"/>
174 <symlink link="${cli.bundle}/${bundle.runtime}/Contents/MacOS/libjli.dylib" resource="../Home/lib/jli/libjli.dylib"
176 <antcall target="shared-library-install-name">
177 <param name="oldname" value="/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM"/>
178 <param name="newname" value="${bundle.runtime.lib}"/>
179 <param name="directory" value="${cli.bundle}/${bundle.frameworks}"/>
181 <!-- Remove architectures -->
182 <foreach target="lipo" param="arch" list="${build.lipo.arch.remove}">
183 <param name="directory" value="${cli.bundle}"/>
185 <antcall target="codesign">
186 <param name="bundle" value="${cli.bundle}"/>
187 <param name="codesign.options" value="--force"/>
188 <!-- No sandboxing enabled -->
189 <param name="codesign.arg"
190 value="--requirements ${codesign.requirement}"/>
191 <param name="codesign.certificate" value="Developer ID Application: David Kocher"/>
193 <antcall target="verify-spctl">
194 <param name="bundle" value="${cli.bundle}"/>
196 <antcall target="tar">
197 <param name="directory" value="${build}"/>
198 <param name="source" value="duck.bundle"/>
199 <param name="target" value="duck-${svn.revision}.tar.gz"/>
201 <checksum file="${build.deploy}/duck-${svn.revision}.tar.gz"
202 algorithm="sha1" property="sha1"/>
203 <copy todir="${build.deploy}" overwrite="true">
204 <fileset dir="${www.update}">
205 <include name="duck.rb"/>
208 <replace dir="${build.deploy}" summary="true" encoding="UTF-8">
209 <include name="duck.rb"/>
210 <replacefilter token="${SHA1}" value="${sha1}"/>
211 <replacefilter token="${REVISION}" value="${svn.revision}"/>
212 <replacefilter token="${VERSION}" value="${version}"/>
216 <target name="deploy-sparkle" depends="timestamp, revision">
217 <antcall target="codesign">
218 <param name="bundle" value="${app.bundle}"/>
219 <param name="codesign.options" value="--force"/>
220 <!-- No sandboxing enabled -->
221 <param name="codesign.arg"
222 value="--requirements ${codesign.requirement}"/>
223 <param name="codesign.certificate" value="Developer ID Application: David Kocher"/>
225 <antcall target="verify-spctl">
226 <param name="bundle" value="${app.bundle}"/>
228 <antcall target="tar">
229 <param name="directory" value="${build}"/>
230 <param name="target" value="${app.name}-${revision}.tar.gz"/>
231 <param name="source" value="${app.name}.app"/>
233 <antcall target="zip">
234 <param name="directory" value="${build}"/>
235 <param name="target" value="${app.name}-${version}.zip"/>
236 <param name="source" value="${app.name}.app"/>
238 <checksum file="${build.deploy}/${app.name}-${revision}.tar.gz"
239 algorithm="md5" property="md5sum"/>
240 <echo message="Calculating DSA signature..."/>
241 <exec dir="${home}" executable="sh" outputproperty="signature.dsa" failonerror="true">
243 <arg value="pipefail"/>
245 <arg value="openssl dgst -sha1 -binary '${build.deploy}/${app.name}-${revision}.tar.gz' | openssl dgst -dss1 -sign ${www.update}/private.pem | openssl enc -base64"/>
247 <echo message="DSASIGNATURE=${signature.dsa}"/>
248 <echo message="MD5SUM=${md5sum}"/>
249 <copy todir="${build.deploy}" overwrite="true">
250 <fileset dir="${www.update}">
251 <include name="changelog.rss"/>
252 <include name="changelog.html"/>
255 <replace dir="${build.deploy}" summary="true" encoding="UTF-8">
256 <include name="changelog.rss"/>
257 <replacefilter token="${TIMESTAMP}" value="${touch.time}"/>
258 <replacefilter token="${ARCHIVE}" value="${url.archive}"/>
259 <replacefilter token="${CHANGELOG}" value="${url.changelog}"/>
260 <replacefilter token="${REVISION}" value="${revision}"/>
261 <replacefilter token="${VERSION}" value="${version}"/>
262 <replacefilter token="${DSASIGNATURE}" value="${signature.dsa}"/>
263 <replacefilter token="${COPYRIGHT}" value="'${copyright}"/>
264 <replacefilter token="${MACOSX_DEPLOYMENT_TARGET}" value="${app.runtime.system.min}"/>
268 <target name="deploy-mas">
269 <replace dir="${app.bundle}/${bundle.contents}" summary="true" encoding="UTF-8">
270 <include name="Info.plist"/>
271 <!-- Disable Sparkle Keys -->
272 <replacefilter token="SU" value="None"/>
274 <delete dir="${app.bundle}/${bundle.frameworks}/Sparkle.framework"/>
275 <antcall target="codesign">
276 <param name="bundle" value="${app.bundle}"/>
277 <param name="codesign.options" value="--force"/>
278 <param name="codesign.arg"
279 value="--entitlements ${codesign.entitlements}"/>
280 <param name="codesign.certificate" value="3rd Party Mac Developer Application: David Kocher (G69SCX94XU)"/>
282 <echo message="Building ${build.deploy}/${app.name}-${version}.pkg"/>
283 <exec dir="${build.deploy}" executable="/usr/bin/productbuild" spawn="false" failonerror="true">
284 <arg line="--component ${app.bundle} /Applications --version ${version} --sign '${installer.certificate}' --keychain ${installer.keychain} ${build.deploy}/${app.name}-${version}.pkg"/>
286 <checksum file="${build.deploy}/${app.name}-${version}.pkg"
291 <echo message="Remove ${arch} slice from ${build.lipo.binaries}"/>
292 <apply executable="/usr/bin/lipo" failonerror="false" dest="${directory}"
293 parallel="false" spawn="false" force="true">
294 <!--Remove from executables-->
295 <!--Remove from frameworks-->
296 <!--Remove from shared libraries-->
297 <fileset dir="${directory}" includes="${build.lipo.binaries}"/>
298 <arg line="-remove ${arch} -output"/>
305 <target name="shared-library-install-name">
306 <echo message="Change dynamic shared library install names to ${newname}"/>
307 <apply executable="/usr/bin/install_name_tool" failonerror="true"
309 parallel="false" spawn="false" force="true">
310 <arg line="-change ${oldname} ${newname}"/>
311 <fileset dir="${directory}">
312 <include name="*.dylib"/>
318 <target name="codesign" depends="unlock-keychain, compile-codesign-requirement">
319 <echo message="Code signing ${bundle} with certificate ${codesign.certificate} and entitlements ${codesign.arg}..."/>
320 <apply executable="/usr/bin/codesign" failonerror="true"
322 parallel="false" spawn="false" force="true">
323 <arg line="${codesign.options} --identifier ch.sudo.cyberduck --sign '${codesign.certificate}' --keychain ${codesign.keychain} ${codesign.arg} -v"/>
324 <fileset dir="${bundle}/${bundle.frameworks}">
325 <include name="*.dylib"/>
326 <include name="*.jar"/>
330 <apply executable="/usr/bin/codesign" failonerror="true"
332 parallel="false" spawn="false" force="true">
333 <arg line="${codesign.options} --identifier net.java.openjdk.jre --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
334 <fileset dir="${bundle}/${bundle.runtime}" erroronmissingdir="false">
335 <include name="**/*.dylib"/>
336 <include name="**/*.jar"/>
338 <fileset dir="${bundle}/${bundle.macos}">
339 <include name="*.jre"/>
343 <apply executable="/usr/bin/codesign" failonerror="true"
345 parallel="false" spawn="false" force="true">
346 <arg line="${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
347 <fileset dir="${bundle}/${bundle.frameworks}">
348 <include name="*.framework/Versions/A"/>
352 <apply executable="/usr/bin/codesign" failonerror="true"
354 parallel="false" spawn="false" force="true">
355 <arg line="${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} ${codesign.arg} -v"/>
356 <file name="${bundle}"/>
359 <antcall target="verify-signature">
360 <param name="bundle" value="${bundle}"/>
364 <target name="unlock-keychain">
365 <exec executable="/usr/bin/security" failonerror="true">
366 <arg line="unlock-keychain -p ${keychain.password} ${codesign.keychain}"/>
370 <target name="compile-codesign-requirement">
371 <echo message="Compile codesign requirement ${codesign.requirement}..."/>
372 <exec executable="/usr/bin/csreq" failonerror="true">
373 <arg line="-r ${codesign.requirement.source} -b ${codesign.requirement}"/>
377 <target name="verify-signature">
378 <echo message="Print codesign requirement for ${bundle}..."/>
379 <exec executable="/usr/bin/codesign" failonerror="true">
380 <arg line="-d -r- --deep-verify ${bundle}"/>
384 <target name="verify-spctl">
385 <echo message="Print system policy verification for ${bundle}..."/>
386 <exec executable="/usr/sbin/spctl" failonerror="true">
387 <arg line="-v --assess --type execute ${bundle}"/>
392 <echo message="Creating tar.gz archive from ${directory}/${source}"/>
393 <exec dir="${directory}" executable="tar" spawn="false" failonerror="true">
394 <arg line="-czf ${build.deploy}/${target} ${source}"/>
396 <echo message="Calculating MD5 sum..."/>
397 <checksum file="${build.deploy}/${target}" algorithm="md5"/>
401 <echo message="Creating ZIP archive from ${directory}/${source}"/>
402 <exec dir="${directory}" executable="ditto" spawn="false" failonerror="true">
403 <arg line="-c -k --sequesterRsrc --keepParent ${source} ${build.deploy}/${target}"/>
405 <checksum file="${build.deploy}/${target}" algorithm="md5"/>
408 <target name="nightly" depends="revision">
409 <antcall target="build">
410 <param name="app.runtime.system.min" value="10.6"/>
411 <param name="sparkle.feed" value="https://version.cyberduck.io/nightly/changelog.rss"/>
413 <antcall target="deploy-sparkle">
414 <param name="url.archive" value="https://update.cyberduck.io/nightly/Cyberduck-${revision}.tar.gz"/>
415 <param name="url.changelog" value="https://version.cyberduck.io/nightly/changelog.html"/>
419 <target name="beta" depends="revision">
420 <antcall target="build">
421 <param name="app.runtime.system.min" value="10.6"/>
422 <param name="sparkle.feed" value="https://version.cyberduck.io/beta/changelog.rss"/>
424 <antcall target="deploy-sparkle">
425 <param name="url.archive" value="https://update.cyberduck.io/beta/Cyberduck-${revision}.tar.gz"/>
426 <param name="url.changelog" value="https://version.cyberduck.io/beta/changelog.html"/>
430 <target name="release" depends="revision">
431 <antcall target="build">
432 <param name="app.runtime.system.min" value="10.6"/>
433 <param name="sparkle.feed" value="https://version.cyberduck.io/changelog.rss"/>
435 <antcall target="deploy-sparkle">
436 <param name="url.archive" value="https://update.cyberduck.io/Cyberduck-${revision}.tar.gz"/>
437 <param name="url.changelog" value="https://version.cyberduck.io/changelog.html"/>
442 <antcall target="build">
443 <param name="app.runtime.system.min" value="10.7.3"/>
445 <antcall target="deploy-mas"/>