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AAH,CAAY,cAAZ,CAAhD,CAAP;AACD,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, deepAssign, InvalidConfigurationError, log } from \"builder-util\"\nimport { copyOrLinkFile, walk } from \"builder-util/out/fs\"\nimport { emptyDir, readdir, readFile, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { AppXOptions } from \"../\"\nimport { getSignVendorPath, isOldWin6 } from \"../codeSign/windowsCodeSign\"\nimport { Target } from \"../core\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WinPackager } from \"../winPackager\"\nimport { createStageDir } from \"./targetUtil\"\n\nconst APPX_ASSETS_DIR_NAME = \"appx\"\n\nconst vendorAssetsForDefaultAssets: { [key: string]: string; } = {\n \"StoreLogo.png\": \"SampleAppx.50x50.png\",\n \"Square150x150Logo.png\": \"SampleAppx.150x150.png\",\n \"Square44x44Logo.png\": \"SampleAppx.44x44.png\",\n \"Wide310x150Logo.png\": \"SampleAppx.310x150.png\",\n}\n\nconst DEFAULT_RESOURCE_LANG = \"en-US\"\n\nexport default class AppXTarget extends Target {\n readonly options: AppXOptions = deepAssign({}, this.packager.platformSpecificBuildOptions, this.packager.config.appx)\n\n constructor(private readonly packager: WinPackager, readonly outDir: string) {\n super(\"appx\")\n\n if (process.platform !== \"darwin\" && (process.platform !== \"win32\" || isOldWin6())) {\n throw new Error(\"AppX is supported only on Windows 10 or Windows Server 2012 R2 (version number 6.3+)\")\n }\n }\n\n // https://docs.microsoft.com/en-us/windows/uwp/packaging/create-app-package-with-makeappx-tool#mapping-files\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"appx\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"AppX\",\n file: artifactPath,\n arch,\n })\n\n const vendorPath = await getSignVendorPath()\n const vm = await packager.vm.value\n\n const stageDir = await createStageDir(this, packager, arch)\n\n const mappingFile = stageDir.getTempFile(\"mapping.txt\")\n const makeAppXArgs = [\"pack\", \"/o\" /* overwrite the output file if it exists */,\n \"/f\", vm.toVmFile(mappingFile),\n \"/p\", vm.toVmFile(artifactPath),\n ]\n if (packager.compression === \"store\") {\n makeAppXArgs.push(\"/nc\")\n }\n\n const mappingList: Array<Array<string>> = []\n mappingList.push(await BluebirdPromise.map(walk(appOutDir), file => {\n let appxPath = file.substring(appOutDir.length + 1)\n if (path.sep !== \"\\\\\") {\n appxPath = appxPath.replace(/\\//g, \"\\\\\")\n }\n return `\"${vm.toVmFile(file)}\" \"app\\\\${appxPath}\"`\n }))\n\n const userAssetDir = await this.packager.getResource(undefined, APPX_ASSETS_DIR_NAME)\n const assetInfo = await AppXTarget.computeUserAssets(vm, vendorPath, userAssetDir)\n const userAssets = assetInfo.userAssets\n\n const manifestFile = stageDir.getTempFile(\"AppxManifest.xml\")\n await this.writeManifest(manifestFile, arch, await this.computePublisherName(), userAssets)\n mappingList.push(assetInfo.mappings)\n mappingList.push([`\"${vm.toVmFile(manifestFile)}\" \"AppxManifest.xml\"`])\n\n if (isScaledAssetsProvided(userAssets)) {\n const outFile = vm.toVmFile(stageDir.getTempFile(\"resources.pri\"))\n const makePriPath = vm.toVmFile(path.join(vendorPath, \"windows-10\", Arch[arch], \"makepri.exe\"))\n\n const assetRoot = stageDir.getTempFile(\"appx/assets\")\n await emptyDir(assetRoot)\n await BluebirdPromise.map(assetInfo.allAssets, it => copyOrLinkFile(it, path.join(assetRoot, path.basename(it))))\n\n await vm.exec(makePriPath, [\"new\",\n \"/Overwrite\",\n \"/Manifest\", vm.toVmFile(manifestFile),\n \"/ProjectRoot\", vm.toVmFile(path.dirname(assetRoot)),\n \"/ConfigXml\", vm.toVmFile(path.join(getTemplatePath(\"appx\"), \"priconfig.xml\")),\n \"/OutputFile\", outFile,\n ])\n\n // in addition to resources.pri, resources.scale-140.pri and other such files will be generated\n for (const resourceFile of (await readdir(stageDir.dir)).filter(it => it.startsWith(\"resources.\")).sort()) {\n mappingList.push([`\"${vm.toVmFile(stageDir.getTempFile(resourceFile))}\" \"${resourceFile}\"`])\n }\n makeAppXArgs.push(\"/l\")\n }\n\n let mapping = \"[Files]\"\n for (const list of mappingList) {\n mapping += \"\\r\\n\" + list.join(\"\\r\\n\")\n }\n await writeFile(mappingFile, mapping)\n packager.debugLogger.add(\"appx.mapping\", mapping)\n\n if (this.options.makeappxArgs != null) {\n makeAppXArgs.push(...this.options.makeappxArgs)\n }\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"windows-10\", Arch[arch], \"makeappx.exe\")), makeAppXArgs)\n await packager.sign(artifactPath)\n\n await stageDir.cleanup()\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"appx\"),\n target: this,\n isWriteUpdateInfo: this.options.electronUpdaterAware,\n })\n }\n\n private static async computeUserAssets(vm: VmManager, vendorPath: string, userAssetDir: string | null) {\n const mappings: Array<string> = []\n let userAssets: Array<string>\n const allAssets: Array<string> = []\n if (userAssetDir == null) {\n userAssets = []\n }\n else {\n userAssets = (await readdir(userAssetDir)).filter(it => !it.startsWith(\".\") && !it.endsWith(\".db\") && it.includes(\".\"))\n for (const name of userAssets) {\n mappings.push(`\"${vm.toVmFile(userAssetDir)}${vm.pathSep}${name}\" \"assets\\\\${name}\"`)\n allAssets.push(path.join(userAssetDir, name))\n }\n }\n\n for (const defaultAsset of Object.keys(vendorAssetsForDefaultAssets)) {\n if (userAssets.length === 0 || !isDefaultAssetIncluded(userAssets, defaultAsset)) {\n const file = path.join(vendorPath, \"appxAssets\", vendorAssetsForDefaultAssets[defaultAsset])\n mappings.push(`\"${vm.toVmFile(file)}\" \"assets\\\\${defaultAsset}\"`)\n allAssets.push(file)\n }\n }\n\n // we do not use process.arch to build path to tools, because even if you are on x64, ia32 appx tool must be used if you build appx for ia32\n return {userAssets, mappings, allAssets}\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711\n private async computePublisherName() {\n if (await this.packager.cscInfo.value == null) {\n log.info({reason: \"Windows Store only build\"}, \"AppX is not signed\")\n return this.options.publisher || \"CN=ms\"\n }\n\n const certInfo = await this.packager.lazyCertInfo.value\n const publisher = certInfo == null ? null : certInfo.bloodyMicrosoftSubjectDn\n if (publisher == null) {\n throw new Error(\"Internal error: cannot compute subject using certificate info\")\n }\n return publisher\n }\n\n private async writeManifest(outFile: string, arch: Arch, publisher: string, userAssets: Array<string>) {\n const appInfo = this.packager.appInfo\n const options = this.options\n const executable = `app\\\\${appInfo.productFilename}.exe`\n const displayName = options.displayName || appInfo.productName\n const manifest = (await readFile(path.join(getTemplatePath(\"appx\"), \"appxmanifest.xml\"), \"utf8\"))\n .replace(/\\${([a-zA-Z0-9]+)}/g, (match, p1): string => {\n switch (p1) {\n case \"publisher\":\n return publisher\n\n case \"publisherDisplayName\":\n const name = options.publisherDisplayName || appInfo.companyName\n if (name == null) {\n throw new InvalidConfigurationError(`Please specify \"author\" in the application package.json — it is required because \"appx.publisherDisplayName\" is not set.`)\n }\n return name\n\n case \"version\":\n return appInfo.getVersionInWeirdWindowsForm(options.setBuildNumber === true)\n\n case \"applicationId\":\n const result = options.applicationId || options.identityName || appInfo.name\n if (!isNaN(parseInt(result[0], 10))) {\n let message = `AppX Application.Id can’t start with numbers: \"${result}\"`\n if (options.applicationId == null) {\n message += `\\nPlease set appx.applicationId (or correct appx.identityName or name)`\n }\n throw new InvalidConfigurationError(message)\n }\n return result\n\n case \"identityName\":\n return options.identityName || appInfo.name\n\n case \"executable\":\n return executable\n\n case \"displayName\":\n return displayName\n\n case \"description\":\n return appInfo.description || appInfo.productName\n\n case \"backgroundColor\":\n return options.backgroundColor || \"#464646\"\n\n case \"logo\":\n return \"assets\\\\StoreLogo.png\"\n\n case \"square150x150Logo\":\n return \"assets\\\\Square150x150Logo.png\"\n\n case \"square44x44Logo\":\n return \"assets\\\\Square44x44Logo.png\"\n\n case \"lockScreen\":\n return lockScreenTag(userAssets)\n\n case \"defaultTile\":\n return defaultTileTag(userAssets, options.showNameOnTiles || false)\n\n case \"splashScreen\":\n return splashScreenTag(userAssets)\n\n case \"arch\":\n return arch === Arch.ia32 ? \"x86\" : \"x64\"\n\n case \"resourceLanguages\":\n return resourceLanguageTag(asArray(options.languages))\n\n case \"extensions\":\n return this.getExtensions(executable, displayName)\n\n default:\n throw new Error(`Macro ${p1} is not defined`)\n }\n })\n await writeFile(outFile, manifest)\n }\n\n private getExtensions(executable: string, displayName: string): string {\n const uriSchemes = asArray(this.packager.config.protocols)\n .concat(asArray(this.packager.platformSpecificBuildOptions.protocols))\n\n let isAddAutoLaunchExtension = this.options.addAutoLaunchExtension\n if (isAddAutoLaunchExtension === undefined) {\n const deps = this.packager.info.metadata.dependencies\n isAddAutoLaunchExtension = deps != null && deps[\"electron-winstore-auto-launch\"] != null\n }\n\n if (!isAddAutoLaunchExtension && uriSchemes.length === 0) {\n return \"\"\n }\n\n let extensions = \"<Extensions>\"\n\n if (isAddAutoLaunchExtension) {\n extensions += `\n <desktop:Extension Category=\"windows.startupTask\" Executable=\"${executable}\" EntryPoint=\"Windows.FullTrustApplication\">\n <desktop:StartupTask TaskId=\"SlackStartup\" Enabled=\"true\" DisplayName=\"${displayName}\" />\n </desktop:Extension>`\n }\n\n for (const protocol of uriSchemes) {\n for (const scheme of asArray(protocol.schemes)) {\n extensions += `\n <uap:Extension Category=\"windows.protocol\">\n <uap:Protocol Name=\"${scheme}\">\n <uap:DisplayName>${protocol.name}</uap:DisplayName>\n </uap:Protocol>\n </uap:Extension>`\n }\n }\n\n extensions += \"</Extensions>\"\n return extensions\n }\n}\n\n// get the resource - language tag, see https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest\nfunction resourceLanguageTag(userLanguages: Array<string> | null | undefined): string {\n if (userLanguages == null || userLanguages.length === 0) {\n userLanguages = [DEFAULT_RESOURCE_LANG]\n }\n return userLanguages.map(it => `<Resource Language=\"${it.replace(/_/g, \"-\")}\" />`).join(\"\\n\")\n}\n\nfunction lockScreenTag(userAssets: Array<string>): string {\n if (isDefaultAssetIncluded(userAssets, \"BadgeLogo.png\")) {\n return '<uap:LockScreen Notification=\"badgeAndTileText\" BadgeLogo=\"assets\\\\BadgeLogo.png\" />'\n }\n else {\n return \"\"\n }\n}\n\nfunction defaultTileTag(userAssets: Array<string>, showNameOnTiles: boolean): string {\n const defaultTiles: Array<string> = [\"<uap:DefaultTile\", 'Wide310x150Logo=\"assets\\\\Wide310x150Logo.png\"']\n\n if (isDefaultAssetIncluded(userAssets, \"LargeTile.png\")) {\n defaultTiles.push('Square310x310Logo=\"assets\\\\LargeTile.png\"')\n }\n if (isDefaultAssetIncluded(userAssets, \"SmallTile.png\")) {\n defaultTiles.push('Square71x71Logo=\"assets\\\\SmallTile.png\"')\n }\n\n if (showNameOnTiles) {\n defaultTiles.push(\">\")\n defaultTiles.push(\"<uap:ShowNameOnTiles>\")\n defaultTiles.push(\"<uap:ShowOn\", 'Tile=\"wide310x150Logo\"', \"/>\")\n defaultTiles.push(\"<uap:ShowOn\", 'Tile=\"square150x150Logo\"', \"/>\")\n defaultTiles.push(\"</uap:ShowNameOnTiles>\")\n defaultTiles.push(\"</uap:DefaultTile>\")\n } else {\n defaultTiles.push(\"/>\")\n }\n return defaultTiles.join(\" \")\n}\n\nfunction splashScreenTag(userAssets: Array<string>): string {\n if (isDefaultAssetIncluded(userAssets, \"SplashScreen.png\")) {\n return '<uap:SplashScreen Image=\"assets\\\\SplashScreen.png\" />'\n }\n else {\n return \"\"\n }\n}\n\nfunction isDefaultAssetIncluded(userAssets: Array<string>, defaultAsset: string) {\n const defaultAssetName = defaultAsset.substring(0, defaultAsset.indexOf(\".\"))\n return userAssets.some(it => it.includes(defaultAssetName))\n}\n\nfunction isScaledAssetsProvided(userAssets: Array<string>) {\n return userAssets.some(it => it.includes(\".scale-\") || it.includes(\".targetsize-\"))\n}\n"],"sourceRoot":""}
|