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C,OAAO,IAAI,IAAI,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;SAC5F;aAAM,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE;YACnC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAA;YAC1E,MAAM,IAAI,GAAG,MAAM,IAAA,eAAU,EAAC,GAAG,CAAC,CAAA;YAClC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;gBACtC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;aAC5B;SACF;QAED,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;QAE5B,MAAM,IAAA,mBAAI,EAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IAC9B,CAAC;CACF;AA1KD,8BA0KC;AAED,SAAgB,uBAAuB,CAAC,QAAyB,EAAE,QAAmC;IACpG,MAAM,IAAI,GAAkB,EAAE,CAAA;IAC9B,IAAI,QAAQ,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAK,CAAC,CAAA;QACnC,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;SAClC;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AATD,0DASC","sourcesContent":["import { Arch, debug, exec, use } from \"builder-util\"\nimport { statOrNull } from \"builder-util/out/fs\"\nimport { PkgOptions } from \"../options/pkgOptions\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\nimport { readFile, unlink, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { findIdentity, Identity } from \"../codeSign/macCodeSign\"\nimport { Target } from \"../core\"\nimport MacPackager from \"../macPackager\"\n\nconst certType = \"Developer ID Installer\"\n\n// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/\n// to use --scripts, we must build .app bundle separately using pkgbuild\n// productbuild --scripts doesn't work (because scripts in this case not added to our package)\n// https://github.com/electron-userland/@electron/osx-sign/issues/96#issuecomment-274986942\nexport class PkgTarget extends Target {\n readonly options: PkgOptions = {\n allowAnywhere: true,\n allowCurrentUserHome: true,\n allowRootDirectory: true,\n ...this.packager.config.pkg,\n }\n\n constructor(private readonly packager: MacPackager, readonly outDir: string) {\n super(\"pkg\")\n }\n\n async build(appPath: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const options = this.options\n const appInfo = packager.appInfo\n\n // pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg)\n const artifactName = packager.expandArtifactNamePattern(options, \"pkg\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"pkg\",\n file: artifactPath,\n arch,\n })\n\n const keychainFile = (await packager.codeSigningInfo.value).keychainFile\n\n const appOutDir = this.outDir\n // https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html\n const distInfoFile = path.join(appOutDir, \"distribution.xml\")\n\n const innerPackageFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.pkg`)\n const componentPropertyListFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.plist`)\n const identity = (\n await Promise.all([\n findIdentity(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile),\n this.customizeDistributionConfiguration(distInfoFile, appPath),\n this.buildComponentPackage(appPath, componentPropertyListFile, innerPackageFile),\n ])\n )[0]\n\n if (identity == null && packager.forceCodeSigning) {\n throw new Error(`Cannot find valid \"${certType}\" to sign standalone installer, please see https://electron.build/code-signing`)\n }\n\n const args = prepareProductBuildArgs(identity, keychainFile)\n args.push(\"--distribution\", distInfoFile)\n args.push(artifactPath)\n use(options.productbuild, it => args.push(...(it as any)))\n await exec(\"productbuild\", args, {\n cwd: appOutDir,\n })\n await Promise.all([unlink(innerPackageFile), unlink(distInfoFile)])\n\n await packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, \"pkg\", arch))\n }\n\n private async customizeDistributionConfiguration(distInfoFile: string, appPath: string) {\n await exec(\"productbuild\", [\"--synthesize\", \"--component\", appPath, distInfoFile], {\n cwd: this.outDir,\n })\n\n const options = this.options\n let distInfo = await readFile(distInfoFile, \"utf-8\")\n\n if (options.mustClose != null && options.mustClose.length !== 0) {\n const startContent = ` <pkg-ref id=\"${this.packager.appInfo.id}\">\\n <must-close>\\n`\n const endContent = \" </must-close>\\n </pkg-ref>\\n</installer-gui-script>\"\n let mustCloseContent = \"\"\n options.mustClose.forEach(appId => {\n mustCloseContent += ` <app id=\"${appId}\"/>\\n`\n })\n distInfo = distInfo.replace(\"</installer-gui-script>\", `${startContent}${mustCloseContent}${endContent}`)\n }\n\n const insertIndex = distInfo.lastIndexOf(\"</installer-gui-script>\")\n distInfo =\n distInfo.substring(0, insertIndex) +\n ` <domains enable_anywhere=\"${options.allowAnywhere}\" enable_currentUserHome=\"${options.allowCurrentUserHome}\" enable_localSystem=\"${options.allowRootDirectory}\" />\\n` +\n distInfo.substring(insertIndex)\n\n if (options.background != null) {\n const background = await this.packager.getResource(options.background.file)\n if (background != null) {\n const alignment = options.background.alignment || \"center\"\n // noinspection SpellCheckingInspection\n const scaling = options.background.scaling || \"tofit\"\n distInfo = distInfo.substring(0, insertIndex) + ` <background file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n distInfo =\n distInfo.substring(0, insertIndex) + ` <background-darkAqua file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n }\n }\n\n const welcome = await this.packager.getResource(options.welcome)\n if (welcome != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <welcome file=\"${welcome}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const license = await getNotLocalizedLicenseFile(options.license, this.packager)\n if (license != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <license file=\"${license}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const conclusion = await this.packager.getResource(options.conclusion)\n if (conclusion != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <conclusion file=\"${conclusion}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n debug(distInfo)\n await writeFile(distInfoFile, distInfo)\n }\n\n private async buildComponentPackage(appPath: string, propertyListOutputFile: string, packageOutputFile: string) {\n const options = this.options\n const rootPath = path.dirname(appPath)\n\n // first produce a component plist template\n await exec(\"pkgbuild\", [\"--analyze\", \"--root\", rootPath, propertyListOutputFile])\n\n // process the template plist\n const plistInfo = (await executeAppBuilderAsJson<Array<any>>([\"decode-plist\", \"-f\", propertyListOutputFile]))[0].filter(\n (it: any) => it.RootRelativeBundlePath !== \"Electron.dSYM\"\n )\n if (plistInfo.length > 0) {\n const packageInfo = plistInfo[0]\n\n // ChildBundles lists all of electron binaries within the .app.\n // There is no particular reason for removing that key, except to be as close as possible to\n // the PackageInfo generated by previous versions of electron-builder.\n delete packageInfo.ChildBundles\n\n if (options.isRelocatable != null) {\n packageInfo.BundleIsRelocatable = options.isRelocatable\n }\n\n if (options.isVersionChecked != null) {\n packageInfo.BundleIsVersionChecked = options.isVersionChecked\n }\n\n if (options.hasStrictIdentifier != null) {\n packageInfo.BundleHasStrictIdentifier = options.hasStrictIdentifier\n }\n\n if (options.overwriteAction != null) {\n packageInfo.BundleOverwriteAction = options.overwriteAction\n }\n\n await executeAppBuilderAndWriteJson([\"encode-plist\"], { [propertyListOutputFile]: plistInfo })\n }\n\n // now build the package\n const args = [\"--root\", rootPath, \"--identifier\", this.packager.appInfo.id, \"--component-plist\", propertyListOutputFile]\n\n use(this.options.installLocation || \"/Applications\", it => args.push(\"--install-location\", it))\n if (options.scripts != null) {\n args.push(\"--scripts\", path.resolve(this.packager.info.buildResourcesDir, options.scripts))\n } else if (options.scripts !== null) {\n const dir = path.join(this.packager.info.buildResourcesDir, \"pkg-scripts\")\n const stat = await statOrNull(dir)\n if (stat != null && stat.isDirectory()) {\n args.push(\"--scripts\", dir)\n }\n }\n\n args.push(packageOutputFile)\n\n await exec(\"pkgbuild\", args)\n }\n}\n\nexport function prepareProductBuildArgs(identity: Identity | null, keychain: string | null | undefined): Array<string> {\n const args: Array<string> = []\n if (identity != null) {\n args.push(\"--sign\", identity.hash!)\n if (keychain != null) {\n args.push(\"--keychain\", keychain)\n }\n }\n return args\n}\n"]}
|