-
-
Notifications
You must be signed in to change notification settings - Fork 297
/
codesign.xml
171 lines (162 loc) · 7.74 KB
/
codesign.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
<?xml version="1.0" encoding="UTF-8"?>
<!--
* $Revision: 6757 $
* $Date: 2010-08-25 13:25:44 0200 (Mi, 25 Aug 2010) $
*
* Copyright (c) 2005-2012 David Kocher. All rights reserved.
* http://cyberduck.io/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.package
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Bug fixes, suggestions and comments should be sent to:
-->
<project name="Codesign" basedir=".">
<property name="installer.certificate" value=""/>
<condition property="installer.keychain" value="${env.KEYCHAIN_PATH}"
else="${user.home}/Library/Keychains/codesign.keychain">
<isset property="env.KEYCHAIN_PATH"/>
</condition>
<property name="codesign.certificate" value=""/>
<condition property="codesign.keychain" value="${env.KEYCHAIN_PATH}"
else="${user.home}/Library/Keychains/codesign.keychain">
<isset property="env.KEYCHAIN_PATH"/>
</condition>
<!-- Designated requirement -->
<property name="codesign.requirement.source" value="${setup}/app/codesign-requirement.txt"/>
<property name="codesign.requirement" value="${setup}/app/codesign-requirement.bin"/>
<!-- Enable hardened runtime -->
<property name="codesign.options" value="--force --options runtime"/>
<property name="codesign.arg" value="--entitlements ${setup}/app/default.entitlements"/>
<target name="codesign" depends="dotclean,compile-codesign-requirement">
<echo
message="Code signing ${bundle} with certificate ${codesign.certificate} and entitlements ${codesign.arg} from ${codesign.keychain}"/>
<apply executable="/usr/bin/xcrun" failonerror="true"
type="both"
parallel="false" spawn="false" force="true">
<arg
line="codesign ${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
<fileset dir="${bundle}/${bundle.spotlight}" erroronmissingdir="false">
<include name="*.mdimporter"/>
</fileset>
<srcfile/>
</apply>
<apply executable="/usr/bin/xcrun" failonerror="true"
type="both"
parallel="false" spawn="false" force="true">
<arg
line="codesign ${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
<fileset dir="${bundle}/${bundle.frameworks}">
<include name="*.dylib"/>
</fileset>
<srcfile/>
</apply>
<apply executable="/usr/bin/xcrun" failonerror="true"
type="both"
parallel="false" spawn="false" force="true">
<arg
line="codesign ${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
<fileset dir="${bundle}/${bundle.runtime}">
<include name="**/*.dylib"/>
</fileset>
<fileset dir="${bundle}/${bundle.plugins}">
<include name="*.jre"/>
</fileset>
<srcfile/>
</apply>
<apply executable="/usr/bin/xcrun" failonerror="true"
type="both"
parallel="false" spawn="false" force="true">
<arg
line="codesign ${codesign.options} --entitlements ${setup}/app/org.sparkle-project.Downloader.entitlements --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
<fileset dir="${bundle}/${bundle.frameworks}">
<include name="Sparkle.framework/Versions/*/XPCServices/Downloader.xpc"/>
</fileset>
<srcfile/>
</apply>
<apply executable="/usr/bin/xcrun" failonerror="true"
type="both"
parallel="false" spawn="false" force="true">
<arg
line="codesign ${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
<fileset dir="${bundle}/${bundle.frameworks}">
<include name="Sparkle.framework/Versions/*/XPCServices/Installer.xpc"/>
<include name="Sparkle.framework/Versions/*/Autoupdate"/>
<include name="Sparkle.framework/Versions/*/*.app"/>
</fileset>
<srcfile/>
</apply>
<apply executable="/usr/bin/xcrun" failonerror="true"
type="both"
parallel="false" spawn="false" force="true">
<arg
line="codesign ${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
<fileset dir="${bundle}/${bundle.frameworks}">
<include name="*.framework"/>
</fileset>
<srcfile/>
</apply>
<apply executable="/usr/bin/xcrun" failonerror="true"
type="both"
parallel="false" spawn="false" force="true">
<arg
line="codesign ${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} ${codesign.arg} -v"/>
<file name="${bundle}"/>
<srcfile/>
</apply>
<antcall target="verify-signature">
<param name="bundle" value="${bundle}"/>
</antcall>
</target>
<target name="compile-codesign-requirement">
<echo message="Compile codesign requirement ${codesign.requirement}..."/>
<exec executable="/usr/bin/csreq" failonerror="true">
<arg line="-r ${codesign.requirement.source} -b ${codesign.requirement}"/>
</exec>
</target>
<target name="verify-signature">
<echo message="Verify code signature of ${bundle}..."/>
<apply executable="/usr/bin/xcrun" failonerror="true"
type="both" parallel="false" spawn="false" force="true" verbose="true">
<arg line="codesign --verbose=4 --deep --strict"/>
<file name="${bundle}"/>
<srcfile/>
</apply>
</target>
<target name="verify-spctl">
<echo message="Print system policy verification for ${bundle}..."/>
<apply executable="/usr/sbin/spctl" failonerror="true"
type="both" parallel="false" spawn="false" force="true" verbose="true">
<arg line="-v --assess --type execute --raw"/>
<file name="${bundle}"/>
<srcfile/>
</apply>
</target>
<target name="dotclean">
<apply executable="/usr/sbin/dot_clean" failonerror="true"
type="both" parallel="false" spawn="false" force="true" verbose="true">
<arg line="-m --keep=native"/>
<file name="${bundle}"/>
<srcfile/>
</apply>
</target>
<target name="notarize">
<echo message="Start notarizing '${notarize.archive.upload}'"/>
<exec dir="${home}" executable="/usr/bin/xcrun" spawn="false" failonerror="true">
<arg line="notarytool submit --apple-id '${env.NOTARIZATION_USER}' --password '${env.NOTARIZATION_PW}' --team-id G69SCX94XU --verbose '${notarize.archive.upload}' --wait --timeout 2h --output-format plist"/>
</exec>
<echo message="Start stapling '${notarize.archive.staple}'"/>
<exec dir="${home}" executable="/usr/bin/xcrun" spawn="false" failonerror="true">
<arg line="stapler staple -v '${notarize.archive.staple}'"/>
</exec>
<echo message="Stapling was successful"/>
</target>
</project>