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A+D;AAC7D,QAAM,QAAQ,IAAI,MAAJ,CAAW,cAAc,CAAzB,CAAd;AACA,SAAO,KAAK,IAAL,CAAU,KAAK,KAAK,EAApB,CAAP;AACD,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, log, deepAssign } from \"builder-util\"\nimport { UUID } from \"builder-util-runtime\"\nimport { getBinFromGithub } from \"builder-util/out/binDownload\"\nimport { walk } from \"builder-util/out/fs\"\nimport { createHash } from \"crypto\"\nimport * as ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs-extra-p\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { MsiOptions } from \"../\"\nimport { Target } from \"../core\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WineVmManager } from \"../vm/WineVm\"\nimport { WinPackager } from \"../winPackager\"\nimport { createStageDir, getWindowsInstallationDirName } from \"./targetUtil\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\nconst ASSISTED_UI_FILE_NAME = \"WixUI_Assisted.wxs\"\n\nconst projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(\"msi\"), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n})\n\n// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)\nexport default class MsiTarget extends Target {\n private readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager()\n\n readonly options: MsiOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi)\n\n constructor(private readonly packager: WinPackager, readonly outDir: string) {\n super(\"msi\")\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n this.logBuilding(\"MSI\", artifactPath, arch)\n\n const stageDir = await createStageDir(this, packager, arch)\n const vm = this.vm\n\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n\n if (commonOptions.isAssisted) {\n // F*** *** *** *** *** *** *** *** *** *** *** *** *** WiX *** *** *** *** *** *** *** *** ***\n // cannot understand how to set MSIINSTALLPERUSER on radio box change. In any case installed per user.\n log.warn(`MSI DOESN'T SUPPORT assisted installer. Please use NSIS instead.`)\n }\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n const uiFile = commonOptions.isAssisted ? stageDir.getTempFile(ASSISTED_UI_FILE_NAME) : null\n await writeFile(projectFile, await this.writeManifest(appOutDir, arch, commonOptions))\n if (uiFile !== null) {\n await writeFile(uiFile, await readFile(path.join(getTemplatePath(\"msi\"), ASSISTED_UI_FILE_NAME), \"utf8\"))\n objectFiles.push(ASSISTED_UI_FILE_NAME.replace(\".wxs\", \".wixobj\"))\n }\n\n // noinspection SpellCheckingInspection\n const vendorPath = await getBinFromGithub(\"wix\", \"4.0.0.5512.2\", \"/X5poahdCc3199Vt6AP7gluTlT1nxi9cbbHhZhCMEu+ngyP1LiBMn+oZX7QAZVaKeBMc2SjVp7fJqNLqsUnPNQ==\")\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\n \"-arch\", arch === Arch.ia32 ? \"x86\" : (arch === Arch.armv7l ? \"arm\" : \"x64\"),\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n ].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n if (uiFile !== null) {\n candleArgs.push(ASSISTED_UI_FILE_NAME)\n }\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n\n await stageDir.cleanup()\n\n await packager.sign(artifactPath)\n\n packager.info.dispatchArtifactCreated({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"msi\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n }\n\n private async light(objectFiles: Array<string>, vm: VmManager, artifactPath: string, appOutDir: string, vendorPath: string, tempDir: string) {\n // noinspection SpellCheckingInspection\n const lightArgs = [\n \"-out\", vm.toVmFile(artifactPath),\n \"-v\",\n // https://github.com/wixtoolset/issues/issues/5169\n \"-spdb\",\n // https://sourceforge.net/p/wix/bugs/2405/\n // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42)\n \"-sw1076\",\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n // \"-dcl:high\",\n ].concat(this.getCommonWixArgs())\n\n // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html\n if (process.platform !== \"win32\") {\n // noinspection SpellCheckingInspection\n lightArgs.push(\"-sval\")\n }\n\n if (this.options.oneClick === false) {\n lightArgs.push(\"-ext\", \"WixUIExtension\")\n }\n\n // objectFiles - only filenames, we set current directory to our temp stage dir\n lightArgs.push(...objectFiles)\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"light.exe\")), lightArgs, {\n cwd: tempDir,\n })\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n return args\n }\n\n private async writeManifest(appOutDir: string, arch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const {files, dirs} = await this.computeFileDeclaration(appOutDir)\n\n const companyName = appInfo.companyName\n if (!companyName) {\n log.warn(`Manufacturer is not set for MSI — please set \"author\" in the package.json`)\n }\n\n const compression = this.packager.compression\n const options = this.options\n const iconPath = await this.packager.getIconPath()\n return (await projectTemplate.value)({\n ...commonOptions,\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.versionInWeirdWindowsForm,\n productName: appInfo.productName,\n upgradeCode: (options.upgradeCode || UUID.v5(appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase(),\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: arch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set<string>()\n const dirs: Array<string> = []\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n const files = await BluebirdPromise.map(walk(appOutDir), file => {\n const packagePath = file.substring(appOutDir.length + 1)\n\n const lastSlash = packagePath.lastIndexOf(path.sep)\n const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath\n let directoryId: string | null = null\n let dirName = \"\"\n // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion\n if (lastSlash > 0) {\n // This Name attribute may also define multiple directories using the inline directory syntax.\n // For example, \"ProgramFilesFolder:\\My Company\\My Product\\bin\" would create a reference to a Directory element with Id=\"ProgramFilesFolder\" then create directories named \"My Company\" then \"My Product\" then \"bin\" nested beneath each other.\n // This syntax is a shortcut to defining each directory in an individual Directory element.\n dirName = packagePath.substring(0, lastSlash)\n // https://github.com/electron-userland/electron-builder/issues/3027\n directoryId = \"d\" + createHash(\"md5\").update(dirName).digest(\"base64\").replace(/\\//g, \"_\").replace(/\\+/g, \".\").replace(/=+$/, \"\")\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(`<Directory Id=\"${directoryId}\" Name=\"${ROOT_DIR_ID}:\\\\${dirName.replace(/\\//g, \"\\\\\")}\\\\\"/>`)\n }\n }\n else if (!isRootDirAddedToRemoveTable) {\n isRootDirAddedToRemoveTable = true\n }\n\n // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid\n // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix\n let result = `<Component${directoryId === null ? \"\" : ` Directory=\"${directoryId}\"`}>`\n result += `\\n${fileSpace} <File Name=\"${fileName}\" Source=\"$(var.appDir)${path.sep}${packagePath}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\n }\n else if (directoryId === null) {\n result += ` Id=\"${path.basename(packagePath)}_f\"`\n }\n\n const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER\n if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {\n result += `>\\n`\n const shortcutName = commonOptions.shortcutName\n if (isCreateDesktopShortcut) {\n result += `${fileSpace} <Shortcut Id=\"desktopShortcut\" Directory=\"DesktopFolder\" Name=\"${shortcutName}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"icon.ico\"/>\\n`\n }\n\n const hasMenuCategory = commonOptions.menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (hasMenuCategory) {\n dirs.push(`<Directory Id=\"${startMenuShortcutDirectoryId}\" Name=\"ProgramMenuFolder:\\\\${commonOptions.menuCategory}\\\\\"/>`)\n }\n result += `${fileSpace} <Shortcut Id=\"startMenuShortcut\" Directory=\"${startMenuShortcutDirectoryId}\" Name=\"${shortcutName}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"icon.ico\">\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${this.packager.appInfo.id}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n }\n else {\n result += `/>`\n }\n\n return `${result}\\n${fileSpace}</Component>`\n })\n\n return {dirs: listToString(dirs, 2), files: listToString(files, 3)}\n }\n}\n\nfunction listToString(list: Array<string>, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}"],"sourceRoot":""}