@@ -73,13 +73,13 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
73
73
let nonMasPromise : Promise < any > | null = null
74
74
75
75
const hasMas = targets . length !== 0 && targets . some ( it => it . name === "mas" || it . name === "mas-dev" )
76
- const prepackaged = this . packagerOptions . prepackaged
76
+ const prepackaged = this . info . prepackaged
77
77
78
- if ( prepackaged == null && ( ! hasMas || targets . length > 1 ) ) {
79
- const appOutDir = this . computeAppOutDir ( outDir , arch )
80
- nonMasPromise = this . doPack ( outDir , appOutDir , this . platform . nodeName , arch , this . platformSpecificBuildOptions )
81
- . then ( ( ) => this . sign ( appOutDir , null ) )
82
- . then ( ( ) => this . packageInDistributableFormat ( appOutDir , Arch . x64 , targets , postAsyncTasks ) )
78
+ if ( ! hasMas || targets . length > 1 ) {
79
+ const appPath = prepackaged == null ? path . join ( this . computeAppOutDir ( outDir , arch ) , ` ${ this . appInfo . productFilename } .app` ) : prepackaged
80
+ nonMasPromise = ( prepackaged ? BluebirdPromise . resolve ( ) : this . doPack ( outDir , path . dirname ( appPath ) , this . platform . nodeName , arch , this . platformSpecificBuildOptions ) )
81
+ . then ( ( ) => this . sign ( appPath , null ) )
82
+ . then ( ( ) => this . packageInDistributableFormat ( appPath , Arch . x64 , targets , postAsyncTasks ) )
83
83
}
84
84
85
85
for ( const target of targets ) {
@@ -98,15 +98,15 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
98
98
if ( prepackaged == null ) {
99
99
await this . doPack ( outDir , appOutDir , "mas" , arch , masBuildOptions )
100
100
}
101
- await this . sign ( appOutDir , masBuildOptions )
101
+ await this . sign ( path . join ( appOutDir , ` ${ this . appInfo . productFilename } .app` ) , masBuildOptions )
102
102
}
103
103
104
104
if ( nonMasPromise != null ) {
105
105
await nonMasPromise
106
106
}
107
107
}
108
108
109
- private async sign ( appOutDir : string , masOptions : MasBuildOptions | null ) : Promise < void > {
109
+ private async sign ( appPath : string , masOptions : MasBuildOptions | null ) : Promise < void > {
110
110
if ( process . platform !== "darwin" ) {
111
111
warn ( "macOS application code signing is supported only on macOS, skipping." )
112
112
return
@@ -155,7 +155,6 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
155
155
}
156
156
}
157
157
158
- const appPath = path . join ( appOutDir , `${ this . appInfo . productFilename } .app` )
159
158
const signOptions : any = {
160
159
skipIdentityValidation : true ,
161
160
identity : name ! ,
@@ -199,7 +198,7 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
199
198
await task ( `Signing app (identity: ${ name } )` , this . doSign ( signOptions ) )
200
199
201
200
if ( masOptions != null ) {
202
- const pkg = path . join ( appOutDir , `${ this . appInfo . productFilename } -${ this . appInfo . version } .pkg` )
201
+ const pkg = path . join ( path . dirname ( appPath ) , `${ this . appInfo . productFilename } -${ this . appInfo . version } .pkg` )
203
202
const certType = "3rd Party Mac Developer Installer"
204
203
const masInstallerIdentity = await findIdentity ( certType , masOptions . identity , keychainName )
205
204
if ( masInstallerIdentity == null ) {
0 commit comments