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CAAC,CAAA;IACJ,CAAC;IAEO,SAAS,CAAC,MAAc;QAC9B,UAAG,CAAC,+BAA+B,CAAC,CAAA;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAA;QAElC,MAAM,UAAU,GAAG,GAAG,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,UAAU,CAAA;QAChE,MAAM,CAAC,YAAK,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC,EAAE;YAC3D,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,SAAS;SACjB,CAAC;aACC,UAAU,CAAC,MAAM,GAAG,GAAG,GAAG,UAAU,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC;AAnGD;6BAmGC,CAAA","sourcesContent":["import { PlatformPackager, BuildInfo } from \"./platformPackager\"\nimport * as path from \"path\"\nimport { Promise as BluebirdPromise } from \"bluebird\"\nimport { tsAwaiter } from \"./awaiter\"\nimport { log, spawn } from \"./util\"\nimport { createKeychain, deleteKeychain, CodeSigningInfo, generateKeychainName, sign } from \"./codeSign\"\n\nconst __awaiter = tsAwaiter\nArray.isArray(__awaiter)\n\nexport default class MacPackager extends PlatformPackager<appdmg.Specification> {\n codeSigningInfo: Promise<CodeSigningInfo>\n\n constructor(info: BuildInfo, cleanupTasks: Array<() => Promise<any>>) {\n super(info)\n\n if (this.options.cscLink != null && this.options.cscKeyPassword != null) {\n const keychainName = generateKeychainName()\n cleanupTasks.push(() => deleteKeychain(keychainName))\n this.codeSigningInfo = createKeychain(keychainName, this.options.cscLink, this.options.cscKeyPassword)\n }\n else {\n this.codeSigningInfo = BluebirdPromise.resolve(null)\n }\n }\n\n getBuildConfigurationKey() {\n return \"osx\"\n }\n\n async pack(platform: string, arch: string, outDir: string): Promise<any> {\n await super.pack(platform, arch, outDir)\n let codeSigningInfo = await this.codeSigningInfo\n return await this.signMac(path.join(outDir, this.metadata.name + \".app\"), codeSigningInfo)\n }\n\n private signMac(distPath: string, codeSigningInfo: CodeSigningInfo): Promise<any> {\n if (codeSigningInfo == null) {\n codeSigningInfo = {cscName: this.options.sign || process.env.CSC_NAME}\n }\n\n if (codeSigningInfo.cscName == null) {\n log(\"App is not signed: CSC_LINK or CSC_NAME are not specified\")\n return BluebirdPromise.resolve()\n }\n else {\n log(\"Signing app\")\n return sign(distPath, codeSigningInfo)\n }\n }\n\n packageInDistributableFormat(outDir: string, arch: string): Promise<any> {\n const artifactPath = path.join(outDir, this.metadata.name + \"-\" + this.metadata.version + \".dmg\")\n return BluebirdPromise.all([\n new BluebirdPromise<any>((resolve, reject) => {\n log(\"Creating DMG\")\n\n const specification: appdmg.Specification = {\n title: this.metadata.name,\n icon: \"build/icon.icns\",\n \"icon-size\": 80,\n background: \"build/background.png\",\n contents: [\n {\n \"x\": 410, \"y\": 220, \"type\": \"link\", \"path\": \"/Applications\"\n },\n {\n \"x\": 130, \"y\": 220, \"type\": \"file\"\n }\n ]\n }\n\n if (this.customDistOptions != null) {\n Object.assign(specification, this.customDistOptions)\n }\n\n if (specification.title == null) {\n specification.title = this.metadata.name\n }\n\n specification.contents[1].path = path.join(outDir, this.metadata.name + \".app\")\n\n const appDmg = require(\"appdmg\")\n const emitter = appDmg({\n target: artifactPath,\n basepath: this.projectDir,\n specification: specification\n })\n emitter.on(\"error\", reject)\n emitter.on(\"finish\", () => resolve())\n })\n .then(() => this.dispatchArtifactCreated(artifactPath)),\n\n this.zipMacApp(outDir)\n .then(it => this.dispatchArtifactCreated(it))\n ])\n }\n\n private zipMacApp(outDir: string): Promise<string> {\n log(\"Creating ZIP for Squirrel.Mac\")\n const appName = this.metadata.name\n // -y param is important - \"store symbolic links as the link instead of the referenced file\"\n const resultPath = `${appName}-${this.metadata.version}-mac.zip`\n return spawn(\"zip\", [\"-ryXq\", resultPath, appName + \".app\"], {\n cwd: outDir,\n stdio: \"inherit\",\n })\n .thenReturn(outDir + \"/\" + resultPath)\n }\n}"]}
\No newline at end of file