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jC,CAAV,EAAkD,IAAlD,EAAwD,IAAxD,CAAP;AACD;;AACD,aAAO,IAAP;AACD,KALK,CAAN;;AAOA,QAAI,CAAC,MAAL,EAAa;AACX;AACD;;AAED,UAAM,eAAe,GAAG,IAAI,CAAC,IAAL,CAAU,WAAW,CAAC,SAAtB,EAAiC,WAAjC,EAA8C,mBAA9C,CAAxB;AACA,UAAM,uBAAgB,GAAhB,CAAoB,iCAAiB,wBAAQ,eAAR,CAAjB,EAA2C,EAA3C,CAApB,EAAqE,IAAD,IAAsB;AAC9F,UAAI,IAAI,CAAC,QAAL,CAAc,MAAd,CAAJ,EAA2B;AACzB,eAAO,KAAK,IAAL,CAAU,IAAI,CAAC,IAAL,CAAU,eAAV,EAA2B,IAA3B,CAAV,EAA4C,IAA5C,EAAkD,IAAlD,CAAP;AACD,OAFD,MAGK;AACH,eAAO,IAAP;AACD;AACF,KAPK,CAAN;AAQD;;AApUwE;;;;AAuU3E,SAAS,kBAAT,CAA4B,KAA5B,EAA4C,aAA5C,EAAkE;AAChE,MAAI,aAAJ,EAAmB;AACjB,WAAO,eAAP;AACD;;AACD,SAAO,KAAK,GAAG,qCAAH,GAA2C,0BAAvD;AACD,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { deepAssign, Arch, AsyncTaskManager, exec, InvalidConfigurationError, log, use } from \"builder-util\"\nimport { signAsync, SignOptions } from \"../electron-osx-sign\"\nimport { mkdirs, readdir } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { copyFile, unlinkIfExists } from \"builder-util/out/fs\"\nimport { orIfFileNotExist } from \"builder-util/out/promise\"\nimport { AppInfo } from \"./appInfo\"\nimport { CertType, CodeSigningInfo, createKeychain, findIdentity, Identity, isSignAllowed, removeKeychain, reportError } from \"./codeSign/macCodeSign\"\nimport { DIR_TARGET, Platform, Target } from \"./core\"\nimport { AfterPackContext, ElectronPlatformName } from \"./index\"\nimport { MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { Packager } from \"./packager\"\nimport { chooseNotNull, PlatformPackager } from \"./platformPackager\"\nimport { ArchiveTarget } from \"./targets/ArchiveTarget\"\nimport { PkgTarget, prepareProductBuildArgs } from \"./targets/pkg\"\nimport { createCommonTarget, NoOpTarget } from \"./targets/targetFactory\"\nimport { isMacOsHighSierra } from \"./util/macosVersion\"\nimport { getTemplatePath } from \"./util/pathManager\"\n\nexport default class MacPackager extends PlatformPackager {\n readonly codeSigningInfo = new Lazy(() => {\n const cscLink = this.getCscLink()\n if (cscLink == null || process.platform !== \"darwin\") {\n return Promise.resolve({keychainFile: process.env.CSC_KEYCHAIN || null})\n }\n\n return createKeychain({\n tmpDir: this.info.tempDirManager,\n cscLink,\n cscKeyPassword: this.getCscPassword(),\n cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),\n cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),\n currentDir: this.projectDir\n })\n .then(result => {\n const keychainFile = result.keychainFile\n if (keychainFile != null) {\n this.info.disposeOnBuildFinish(() => removeKeychain(keychainFile))\n }\n return result\n })\n })\n\n private _iconPath = new Lazy(() => this.getOrConvertIcon(\"icns\"))\n\n constructor(info: Packager) {\n super(info, Platform.MAC)\n }\n\n get defaultTarget(): Array {\n return this.info.framework.macOsDefaultTargets\n }\n\n protected prepareAppInfo(appInfo: AppInfo): AppInfo {\n return new AppInfo(this.info, this.platformSpecificBuildOptions.bundleVersion, this.platformSpecificBuildOptions)\n }\n\n async getIconPath(): Promise {\n return this._iconPath.value\n }\n\n createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n for (const name of targets) {\n switch (name) {\n case DIR_TARGET:\n break\n\n case \"dmg\":\n const { DmgTarget } = require(\"dmg-builder\")\n mapper(name, outDir => new DmgTarget(this, outDir))\n break\n\n case \"zip\":\n // https://github.com/electron-userland/electron-builder/issues/2313\n mapper(name, outDir => new ArchiveTarget(name, outDir, this, true))\n break\n\n case \"pkg\":\n mapper(name, outDir => new PkgTarget(this, outDir))\n break\n\n default:\n mapper(name, outDir => name === \"mas\" || name === \"mas-dev\" ? new NoOpTarget(name) : createCommonTarget(name, outDir, this))\n break\n }\n }\n }\n\n async pack(outDir: string, arch: Arch, targets: Array, taskManager: AsyncTaskManager): Promise {\n let nonMasPromise: Promise | null = null\n\n const hasMas = targets.length !== 0 && targets.some(it => it.name === \"mas\" || it.name === \"mas-dev\")\n const prepackaged = this.packagerOptions.prepackaged\n\n if (!hasMas || targets.length > 1) {\n const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged\n nonMasPromise = (prepackaged ? Promise.resolve() : this.doPack(outDir, path.dirname(appPath), this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets))\n .then(() => this.packageInDistributableFormat(appPath, Arch.x64, targets, taskManager))\n }\n\n for (const target of targets) {\n const targetName = target.name\n if (!(targetName === \"mas\" || targetName === \"mas-dev\")) {\n continue\n }\n\n const masBuildOptions = deepAssign({}, this.platformSpecificBuildOptions, this.config.mas)\n if (targetName === \"mas-dev\") {\n deepAssign(masBuildOptions, this.config.masDev, {\n type: \"development\",\n })\n }\n\n const targetOutDir = path.join(outDir, targetName)\n if (prepackaged == null) {\n await this.doPack(outDir, targetOutDir, \"mas\", arch, masBuildOptions, [target])\n await this.sign(path.join(targetOutDir, `${this.appInfo.productFilename}.app`), targetOutDir, masBuildOptions)\n }\n else {\n await this.sign(prepackaged, targetOutDir, masBuildOptions)\n }\n }\n\n if (nonMasPromise != null) {\n await nonMasPromise\n }\n }\n\n private async sign(appPath: string, outDir: string | null, masOptions: MasConfiguration | null): Promise {\n if (!isSignAllowed()) {\n return\n }\n\n const isMas = masOptions != null\n const options = masOptions == null ? this.platformSpecificBuildOptions : masOptions\n const qualifier = options.identity\n\n if (!isMas && qualifier === null) {\n if (this.forceCodeSigning) {\n throw new InvalidConfigurationError(\"identity explicitly is set to null, but forceCodeSigning is set to true\")\n }\n log.info({reason: \"identity explicitly is set to null\"}, \"skipped macOS code signing\")\n return\n }\n\n const keychainFile = (await this.codeSigningInfo.value).keychainFile\n const explicitType = options.type\n const type = explicitType || \"distribution\"\n const isDevelopment = type === \"development\"\n const certificateType = getCertificateType(isMas, isDevelopment)\n let identity = await findIdentity(certificateType, qualifier, keychainFile)\n if (identity == null) {\n if (!isMas && !isDevelopment && explicitType !== \"distribution\") {\n identity = await findIdentity(\"Mac Developer\", qualifier, keychainFile)\n if (identity != null) {\n log.warn(\"Mac Developer is used to sign app — it is only for development and testing, not for production\")\n }\n }\n\n if (identity == null) {\n await reportError(isMas, certificateType, qualifier, keychainFile, this.forceCodeSigning)\n return\n }\n }\n\n if (!isMacOsHighSierra()) {\n throw new InvalidConfigurationError(\"macOS High Sierra 10.13.6 is required to sign\")\n }\n\n const signOptions: any = {\n \"identity-validation\": false,\n // https://github.com/electron-userland/electron-builder/issues/1699\n // kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.\n ignore: (file: string) => {\n return file.endsWith(\".kext\") || file.startsWith(\"/Contents/PlugIns\", appPath.length) ||\n // https://github.com/electron-userland/electron-builder/issues/2010\n file.includes(\"/node_modules/puppeteer/.local-chromium\")\n },\n identity: identity!,\n type,\n platform: isMas ? \"mas\" : \"darwin\",\n version: this.config.electronVersion,\n app: appPath,\n keychain: keychainFile || undefined,\n binaries: options.binaries || undefined,\n requirements: isMas || this.platformSpecificBuildOptions.requirements == null ? undefined : await this.getResource(this.platformSpecificBuildOptions.requirements),\n // https://github.com/electron-userland/electron-osx-sign/issues/196\n // will fail on 10.14.5+ because a signed but unnotarized app is also rejected.\n \"gatekeeper-assess\": options.gatekeeperAssess === true,\n hardenedRuntime: options.hardenedRuntime !== false,\n }\n\n await this.adjustSignOptions(signOptions, masOptions)\n log.info({\n file: log.filePath(appPath),\n identityName: identity.name,\n identityHash: identity.hash,\n provisioningProfile: signOptions[\"provisioning-profile\"] || \"none\",\n }, \"signing\")\n await this.doSign(signOptions)\n\n // https://github.com/electron-userland/electron-builder/issues/1196#issuecomment-312310209\n if (masOptions != null && !isDevelopment) {\n const certType = isDevelopment ? \"Mac Developer\" : \"3rd Party Mac Developer Installer\"\n const masInstallerIdentity = await findIdentity(certType, masOptions.identity, keychainFile)\n if (masInstallerIdentity == null) {\n throw new InvalidConfigurationError(`Cannot find valid \"${certType}\" identity to sign MAS installer, please see https://electron.build/code-signing`)\n }\n\n // mas uploaded to AppStore, so, use \"-\" instead of space for name\n const artifactName = this.expandArtifactNamePattern(masOptions, \"pkg\")\n const artifactPath = path.join(outDir!, artifactName)\n await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile)\n await this.dispatchArtifactCreated(artifactPath, null, Arch.x64, this.computeSafeArtifactName(artifactName, \"pkg\"))\n }\n }\n\n private async adjustSignOptions(signOptions: any, masOptions: MasConfiguration | null) {\n const resourceList = await this.resourceList\n const customSignOptions = masOptions || this.platformSpecificBuildOptions\n const entitlementsSuffix = masOptions == null ? \"mac\" : \"mas\"\n\n let entitlements = customSignOptions.entitlements\n if (entitlements == null) {\n const p = `entitlements.${entitlementsSuffix}.plist`\n if (resourceList.includes(p)) {\n entitlements = path.join(this.info.buildResourcesDir, p)\n }\n else {\n entitlements = getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n signOptions.entitlements = entitlements\n\n let entitlementsInherit = customSignOptions.entitlementsInherit\n if (entitlementsInherit == null) {\n const p = `entitlements.${entitlementsSuffix}.inherit.plist`\n if (resourceList.includes(p)) {\n entitlementsInherit = path.join(this.info.buildResourcesDir, p)\n }\n else {\n entitlementsInherit = getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n signOptions[\"entitlements-inherit\"] = entitlementsInherit\n\n if (customSignOptions.provisioningProfile != null) {\n signOptions[\"provisioning-profile\"] = customSignOptions.provisioningProfile\n }\n }\n\n //noinspection JSMethodCanBeStatic\n protected async doSign(opts: SignOptions): Promise {\n return signAsync(opts)\n }\n\n //noinspection JSMethodCanBeStatic\n protected async doFlat(appPath: string, outFile: string, identity: Identity, keychain: string | null | undefined): Promise {\n // productbuild doesn't created directory for out file\n await mkdirs(path.dirname(outFile))\n\n const args = prepareProductBuildArgs(identity, keychain)\n args.push(\"--component\", appPath, \"/Applications\")\n args.push(outFile)\n return await exec(\"productbuild\", args)\n }\n\n public getElectronSrcDir(dist: string) {\n return path.resolve(this.projectDir, dist, this.info.framework.distMacOsAppName)\n }\n\n public getElectronDestinationDir(appOutDir: string) {\n return path.join(appOutDir, this.info.framework.distMacOsAppName)\n }\n\n // todo fileAssociations\n async applyCommonInfo(appPlist: any, contentsPath: string) {\n const appInfo = this.appInfo\n const appFilename = appInfo.productFilename\n\n // https://github.com/electron-userland/electron-builder/issues/1278\n appPlist.CFBundleExecutable = appFilename.endsWith(\" Helper\") ? appFilename.substring(0, appFilename.length - \" Helper\".length) : appFilename\n\n const icon = await this.getIconPath()\n if (icon != null) {\n const oldIcon = appPlist.CFBundleIconFile\n const resourcesPath = path.join(contentsPath, \"Resources\")\n if (oldIcon != null) {\n await unlinkIfExists(path.join(resourcesPath, oldIcon))\n }\n const iconFileName = `${appFilename}.icns`\n appPlist.CFBundleIconFile = iconFileName\n await copyFile(icon, path.join(resourcesPath, iconFileName))\n }\n appPlist.CFBundleName = appInfo.productName\n appPlist.CFBundleDisplayName = appInfo.productName\n\n const minimumSystemVersion = this.platformSpecificBuildOptions.minimumSystemVersion\n if (minimumSystemVersion != null) {\n appPlist.LSMinimumSystemVersion = minimumSystemVersion\n }\n\n appPlist.CFBundleIdentifier = appInfo.macBundleIdentifier\n\n appPlist.CFBundleShortVersionString = this.platformSpecificBuildOptions.bundleShortVersion || appInfo.version\n appPlist.CFBundleVersion = appInfo.buildVersion\n\n use(this.platformSpecificBuildOptions.category || (this.config as any).category, it => appPlist.LSApplicationCategoryType = it)\n appPlist.NSHumanReadableCopyright = appInfo.copyright\n\n if (this.platformSpecificBuildOptions.darkModeSupport) {\n appPlist.NSRequiresAquaSystemAppearance = false\n }\n\n const extendInfo = this.platformSpecificBuildOptions.extendInfo\n if (extendInfo != null) {\n Object.assign(appPlist, extendInfo)\n }\n }\n\n protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise {\n const appFileName = `${this.appInfo.productFilename}.app`\n\n await BluebirdPromise.map(readdir(packContext.appOutDir), (file: string): any => {\n if (file === appFileName) {\n return this.sign(path.join(packContext.appOutDir, file), null, null)\n }\n return null\n })\n\n if (!isAsar) {\n return\n }\n\n const outResourcesDir = path.join(packContext.appOutDir, \"resources\", \"app.asar.unpacked\")\n await BluebirdPromise.map(orIfFileNotExist(readdir(outResourcesDir), []), (file: string): any => {\n if (file.endsWith(\".app\")) {\n return this.sign(path.join(outResourcesDir, file), null, null)\n }\n else {\n return null\n }\n })\n }\n}\n\nfunction getCertificateType(isMas: boolean, isDevelopment: boolean): CertType {\n if (isDevelopment) {\n return \"Mac Developer\"\n }\n return isMas ? \"3rd Party Mac Developer Application\" : \"Developer ID Application\"\n}\n"],"sourceRoot":""}