@@ -6,10 +6,11 @@ import BluebirdPromise from "bluebird-lst-c"
6
6
import { log , warn , task } from "./util/log"
7
7
import { createKeychain , CodeSigningInfo , findIdentity } from "./codeSign"
8
8
import { deepAssign } from "./util/deepAssign"
9
- import { signAsync , flatAsync , BaseSignOptions , SignOptions , FlatOptions } from "electron-osx-sign-tf"
9
+ import { signAsync , BaseSignOptions , SignOptions } from "electron-osx-sign-tf"
10
10
import { DmgTarget } from "./targets/dmg"
11
11
import { createCommonTarget , DEFAULT_TARGET } from "./targets/targetFactory"
12
12
import { AppInfo } from "./appInfo"
13
+ import { flatApplication } from "./targets/pkg"
13
14
14
15
export default class MacPackager extends PlatformPackager < MacOptions > {
15
16
codeSigningInfo : Promise < CodeSigningInfo >
@@ -133,13 +134,13 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
133
134
134
135
const baseSignOptions : BaseSignOptions = {
135
136
app : path . join ( appOutDir , `${ this . appInfo . productFilename } .app` ) ,
136
- platform : isMas ? "mas" : "darwin" ,
137
137
keychain : keychainName || undefined ,
138
- version : this . info . electronVersion
139
138
}
140
139
141
140
const signOptions = Object . assign ( {
142
141
identity : name ,
142
+ platform : isMas ? "mas" : "darwin" ,
143
+ version : this . info . electronVersion ,
143
144
} , ( < any > this . devMetadata . build ) [ "osx-sign" ] , baseSignOptions )
144
145
145
146
const resourceList = await this . resourceList
@@ -151,35 +152,31 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
151
152
}
152
153
153
154
const customSignOptions = masOptions || this . platformSpecificBuildOptions
154
- if ( customSignOptions . entitlements != null ) {
155
- signOptions . entitlements = customSignOptions . entitlements
156
- }
157
- else {
155
+ if ( customSignOptions . entitlements == null ) {
158
156
const p = `entitlements.${ isMas ? "mas" : "mac" } .plist`
159
157
if ( resourceList . includes ( p ) ) {
160
158
signOptions . entitlements = path . join ( this . buildResourcesDir , p )
161
159
}
162
160
}
163
-
164
- if ( customSignOptions . entitlementsInherit != null ) {
165
- signOptions [ "entitlements-inherit" ] = customSignOptions . entitlementsInherit
166
- }
167
161
else {
162
+ signOptions . entitlements = customSignOptions . entitlements
163
+ }
164
+
165
+ if ( customSignOptions . entitlementsInherit == null ) {
168
166
const p = `entitlements.${ isMas ? "mas" : "mac" } .inherit.plist`
169
167
if ( resourceList . includes ( p ) ) {
170
168
signOptions [ "entitlements-inherit" ] = path . join ( this . buildResourcesDir , p )
171
169
}
172
170
}
171
+ else {
172
+ signOptions [ "entitlements-inherit" ] = customSignOptions . entitlementsInherit
173
+ }
173
174
174
175
await task ( `Signing app (identity: ${ name } )` , this . doSign ( signOptions ) )
175
176
176
177
if ( masOptions != null ) {
177
- await task ( `Signing app (identity: ${ name } )` , this . doSign ( signOptions ) )
178
178
const pkg = path . join ( appOutDir , `${ this . appInfo . productFilename } -${ this . appInfo . version } .pkg` )
179
- await this . doFlat ( Object . assign ( {
180
- pkg : pkg ,
181
- identity : installerName ,
182
- } , baseSignOptions ) )
179
+ await this . doFlat ( baseSignOptions , pkg , installerName ! ! )
183
180
this . dispatchArtifactCreated ( pkg , `${ this . appInfo . name } -${ this . appInfo . version } .pkg` )
184
181
}
185
182
}
@@ -190,8 +187,8 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
190
187
}
191
188
192
189
//noinspection JSMethodCanBeStatic
193
- protected async doFlat ( opts : FlatOptions ) : Promise < any > {
194
- return flatAsync ( opts )
190
+ protected async doFlat ( opts : BaseSignOptions , outFile : string , identity : string ) : Promise < any > {
191
+ return flatApplication ( opts , outFile , identity )
195
192
}
196
193
197
194
protected packageInDistributableFormat ( appOutDir : string , targets : Array < Target > , promises : Array < Promise < any > > ) : void {
0 commit comments