app-builder-lib 27.0.0-alpha.4 → 27.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appInfo.d.ts +1 -1
- package/dist/appInfo.d.ts.map +1 -1
- package/dist/appInfo.js +3 -3
- package/dist/appInfo.js.map +1 -1
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +3 -6
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +6 -4
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +31 -21
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/configuration.d.ts +84 -44
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js +11 -1
- package/dist/configuration.js.map +1 -1
- package/dist/electron/ElectronFramework.d.ts +2 -1
- package/dist/electron/ElectronFramework.d.ts.map +1 -1
- package/dist/electron/ElectronFramework.js +32 -28
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/electronArchSupport.d.ts +12 -0
- package/dist/electron/electronArchSupport.d.ts.map +1 -0
- package/dist/electron/electronArchSupport.js +58 -0
- package/dist/electron/electronArchSupport.js.map +1 -0
- package/dist/electron/electronVersion.d.ts.map +1 -1
- package/dist/electron/electronVersion.js +1 -11
- package/dist/electron/electronVersion.js.map +1 -1
- package/dist/electron/mac/electronMac.js +12 -21
- package/dist/electron/mac/electronMac.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +24 -0
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
- package/dist/electron/mac/electronMacUtils.js +42 -0
- package/dist/electron/mac/electronMacUtils.js.map +1 -0
- package/dist/fileMatcher.d.ts +27 -2
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +204 -16
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +8 -5
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +8 -4
- package/dist/indexInternal.js.map +1 -1
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +15 -3
- package/dist/macPackager.js.map +1 -1
- package/dist/node-module-collector/moduleManager.d.ts +3 -1
- package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
- package/dist/node-module-collector/moduleManager.js +9 -1
- package/dist/node-module-collector/moduleManager.js.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts +17 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.js +67 -1
- package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js +5 -5
- package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/types.d.ts +2 -0
- package/dist/node-module-collector/types.d.ts.map +1 -1
- package/dist/node-module-collector/types.js.map +1 -1
- package/dist/options/MsixOptions.d.ts +126 -0
- package/dist/options/MsixOptions.d.ts.map +1 -0
- package/dist/options/MsixOptions.js +2 -0
- package/dist/options/MsixOptions.js.map +1 -0
- package/dist/options/PlatformSpecificBuildOptions.d.ts +0 -6
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +15 -13
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +4 -4
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +166 -36
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +2 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +26 -21
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +2 -0
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +6 -0
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +1 -0
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +20 -6
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +20 -22
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/archive.d.ts +11 -0
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +40 -22
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +3 -3
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +5 -6
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
- package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
- package/dist/targets/linux/snap/SnapTarget.js +23 -1
- package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts +1 -1
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +3 -2
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreCustom.js +2 -2
- package/dist/targets/linux/snap/coreCustom.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +2 -1
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
- package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapcraft.js +11 -0
- package/dist/targets/linux/snap/snapcraft.js.map +1 -0
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +6 -0
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +22 -1
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/targetFactory.d.ts +7 -0
- package/dist/targets/targetFactory.d.ts.map +1 -1
- package/dist/targets/targetFactory.js +28 -0
- package/dist/targets/targetFactory.js.map +1 -1
- package/dist/targets/win/AppxTarget.d.ts +0 -2
- package/dist/targets/win/AppxTarget.d.ts.map +1 -1
- package/dist/targets/win/AppxTarget.js +37 -317
- package/dist/targets/win/AppxTarget.js.map +1 -1
- package/dist/targets/win/MsixTarget.d.ts +22 -0
- package/dist/targets/win/MsixTarget.d.ts.map +1 -0
- package/dist/targets/win/MsixTarget.js +214 -0
- package/dist/targets/win/MsixTarget.js.map +1 -0
- package/dist/targets/win/nsis/NsisTarget.d.ts +3 -2
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +28 -46
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js +2 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.d.ts +5 -2
- package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.js +46 -22
- package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
- package/dist/targets/win/nsis/progId.d.ts +21 -0
- package/dist/targets/win/nsis/progId.d.ts.map +1 -0
- package/dist/targets/win/nsis/progId.js +60 -0
- package/dist/targets/win/nsis/progId.js.map +1 -0
- package/dist/targets/win/winAppUtil.d.ts +115 -0
- package/dist/targets/win/winAppUtil.d.ts.map +1 -0
- package/dist/targets/win/winAppUtil.js +407 -0
- package/dist/targets/win/winAppUtil.js.map +1 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +3 -1
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/appimage.d.ts +3 -3
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +9 -6
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/custom.d.ts +1 -3
- package/dist/toolsets/custom.d.ts.map +1 -1
- package/dist/toolsets/custom.js +4 -133
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/fpm.d.ts.map +1 -1
- package/dist/toolsets/fpm.js +11 -5
- package/dist/toolsets/fpm.js.map +1 -1
- package/dist/toolsets/icons.d.ts.map +1 -1
- package/dist/toolsets/icons.js +4 -1
- package/dist/toolsets/icons.js.map +1 -1
- package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
- package/dist/toolsets/linuxToolsMac.js +4 -1
- package/dist/toolsets/linuxToolsMac.js.map +1 -1
- package/dist/toolsets/nsis.d.ts.map +1 -1
- package/dist/toolsets/nsis.js +6 -3
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/version.d.ts +12 -0
- package/dist/toolsets/version.d.ts.map +1 -0
- package/dist/toolsets/version.js +13 -0
- package/dist/toolsets/version.js.map +1 -0
- package/dist/toolsets/winCodeSign.d.ts +20 -3
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +56 -27
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wine.d.ts +2 -1
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +15 -13
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/NodeModuleCopyHelper.js +3 -3
- package/dist/util/NodeModuleCopyHelper.js.map +1 -1
- package/dist/util/appFileCopier.d.ts +39 -0
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +88 -22
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/config/config.d.ts +1 -0
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +4 -1
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/load.d.ts +2 -2
- package/dist/util/config/load.d.ts.map +1 -1
- package/dist/util/config/load.js +3 -12
- package/dist/util/config/load.js.map +1 -1
- package/dist/util/config/schemaValidator.js +1 -1
- package/dist/util/config/schemaValidator.js.map +1 -1
- package/dist/util/electronGet.d.ts +6 -3
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +40 -20
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts +0 -2
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +0 -6
- package/dist/util/flags.js.map +1 -1
- package/dist/util/hash.d.ts +1 -1
- package/dist/util/hash.d.ts.map +1 -1
- package/dist/util/hash.js +1 -15
- package/dist/util/hash.js.map +1 -1
- package/dist/util/packageMetadata.js +0 -10
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/vm/ParallelsVm.d.ts.map +1 -1
- package/dist/vm/ParallelsVm.js +18 -5
- package/dist/vm/ParallelsVm.js.map +1 -1
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +3 -0
- package/dist/winPackager.js.map +1 -1
- package/package.json +8 -8
- package/scheme.json +556 -133
- package/templates/appx/appxmanifest.xml +1 -1
- package/templates/msix/appxmanifest.xml +45 -0
- package/templates/nsis/installSection.nsh +14 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Arch, asArray, copyOrLinkFile, ensureNotBusy, exec, InvalidConfigurationError, log } from "builder-util";
|
|
2
|
+
import { getPath7za } from "../../toolsets/7zip.js";
|
|
3
|
+
import _fsExtra from "fs-extra";
|
|
4
|
+
const { mkdirs, readFile, remove, writeFile } = _fsExtra;
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
import { isLegacyWinCodeSign, isOldWin6 } from "../../toolsets/winCodeSign.js";
|
|
7
|
+
import { Target } from "../../core.js";
|
|
8
|
+
import { getTemplatePath } from "../../util/pathManager.js";
|
|
9
|
+
import { buildAppxPackage, buildCapabilitiesXml, buildExtensionsXml, buildWindowsServicesXml, defaultTileTag, lockScreenTag, resolvePackageApplicationId, resolvePackageIdentityName, resourceLanguageTag, splashScreenTag, substituteManifestMacros, } from "./winAppUtil.js";
|
|
10
|
+
export default class MsixTarget extends Target {
|
|
11
|
+
constructor(packager, outDir) {
|
|
12
|
+
super("msix");
|
|
13
|
+
this.packager = packager;
|
|
14
|
+
this.outDir = outDir;
|
|
15
|
+
this.options = this.packager.getOptionsForTarget("msix");
|
|
16
|
+
this.isAsyncSupported = false;
|
|
17
|
+
this.builtPackages = new Map();
|
|
18
|
+
this.vendorPathKit = null;
|
|
19
|
+
this.vm = null;
|
|
20
|
+
if (process.platform !== "darwin" && (process.platform !== "win32" || isOldWin6())) {
|
|
21
|
+
throw new Error("MSIX is supported on Windows 10 or Windows Server 2012 R2 (version number 6.3+) and on macOS via Parallels Desktop");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
build(appOutDir, arch) {
|
|
25
|
+
return buildAppxPackage(this, this.packager, this.options, appOutDir, arch, {
|
|
26
|
+
kind: "msix",
|
|
27
|
+
presentableName: "MSIX",
|
|
28
|
+
preflight: () => {
|
|
29
|
+
// unset / null / "latest" and any modern version pin resolve to a modern Windows Kits bundle (with
|
|
30
|
+
// the MSIX SDK); only the explicit legacy "0.0.0" (winCodeSign-2.6.0) pin lacks it. A custom { url }
|
|
31
|
+
// toolset is the user's responsibility.
|
|
32
|
+
if (isLegacyWinCodeSign(this.packager.config.toolsets?.winCodeSign)) {
|
|
33
|
+
throw new InvalidConfigurationError('MSIX packaging requires a modern Windows Kits toolset. The legacy "0.0.0" (winCodeSign-2.6.0) bundle does not include the Windows SDK version required for MSIX. ' +
|
|
34
|
+
'Use the default toolset or pin "toolsets.winCodeSign" to a modern version (e.g. "1.0.0", "1.1.0", or "1.3.0").');
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
writeManifest: (manifestFile, a, publisher, userAssets) => this.writeManifest(manifestFile, a, publisher, userAssets),
|
|
38
|
+
// Record per-arch context so finishBuild can assemble the .msixbundle / .msixupload.
|
|
39
|
+
onBuilt: ({ arch: builtArch, artifactPath, vendorPathKit, vm }) => {
|
|
40
|
+
this.builtPackages.set(builtArch, artifactPath);
|
|
41
|
+
this.vendorPathKit = vendorPathKit;
|
|
42
|
+
this.vm = vm;
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async finishBuild() {
|
|
47
|
+
await super.finishBuild();
|
|
48
|
+
const packagePaths = Array.from(this.builtPackages.values());
|
|
49
|
+
if (packagePaths.length === 0) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
let bundlePath;
|
|
53
|
+
if (this.options.createMsixbundle !== false && packagePaths.length > 1) {
|
|
54
|
+
bundlePath = await this.createMsixBundle(packagePaths);
|
|
55
|
+
}
|
|
56
|
+
if (this.options.createMsixupload === true) {
|
|
57
|
+
await this.createMsixUpload(bundlePath ?? packagePaths[0]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async createMsixBundle(packagePaths) {
|
|
61
|
+
const packager = this.packager;
|
|
62
|
+
const vm = this.vm;
|
|
63
|
+
const kitPath = this.vendorPathKit;
|
|
64
|
+
const bundleName = packager.expandArtifactBeautyNamePattern(this.options, "msixbundle", Arch.x64);
|
|
65
|
+
const bundlePath = path.join(this.outDir, bundleName);
|
|
66
|
+
await packager.emitArtifactBuildStarted({
|
|
67
|
+
targetPresentableName: "MSIX Bundle",
|
|
68
|
+
file: bundlePath,
|
|
69
|
+
arch: null,
|
|
70
|
+
});
|
|
71
|
+
const stagingDir = path.join(this.outDir, ".msixbundle-staging");
|
|
72
|
+
await mkdirs(stagingDir);
|
|
73
|
+
try {
|
|
74
|
+
await Promise.all(packagePaths.map(p => copyOrLinkFile(p, path.join(stagingDir, path.basename(p)))));
|
|
75
|
+
const makeAppxExe = path.join(kitPath, "makeappx.exe");
|
|
76
|
+
await ensureNotBusy(makeAppxExe);
|
|
77
|
+
await vm.exec(vm.toVmFile(makeAppxExe), ["bundle", "/o", "/d", vm.toVmFile(stagingDir), "/p", vm.toVmFile(bundlePath)]);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await remove(stagingDir);
|
|
81
|
+
}
|
|
82
|
+
await packager.signIf(bundlePath);
|
|
83
|
+
await packager.emitArtifactBuildCompleted({
|
|
84
|
+
file: bundlePath,
|
|
85
|
+
packager,
|
|
86
|
+
arch: null,
|
|
87
|
+
safeArtifactName: packager.computeSafeArtifactName(bundleName, "msixbundle"),
|
|
88
|
+
target: this,
|
|
89
|
+
isWriteUpdateInfo: false,
|
|
90
|
+
});
|
|
91
|
+
return bundlePath;
|
|
92
|
+
}
|
|
93
|
+
async createMsixUpload(sourcePath) {
|
|
94
|
+
const packager = this.packager;
|
|
95
|
+
const uploadName = packager.expandArtifactBeautyNamePattern(this.options, "msixupload", Arch.x64);
|
|
96
|
+
const uploadPath = path.join(this.outDir, uploadName);
|
|
97
|
+
await packager.emitArtifactBuildStarted({
|
|
98
|
+
targetPresentableName: "MSIX Upload",
|
|
99
|
+
file: uploadPath,
|
|
100
|
+
arch: null,
|
|
101
|
+
});
|
|
102
|
+
const sevenZa = await getPath7za();
|
|
103
|
+
await exec(sevenZa, ["a", "-tzip", uploadPath, sourcePath]);
|
|
104
|
+
await packager.emitArtifactBuildCompleted({
|
|
105
|
+
file: uploadPath,
|
|
106
|
+
packager,
|
|
107
|
+
arch: null,
|
|
108
|
+
safeArtifactName: packager.computeSafeArtifactName(uploadName, "msixupload"),
|
|
109
|
+
target: this,
|
|
110
|
+
isWriteUpdateInfo: false,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async writeManifest(outFile, arch, publisher, userAssets) {
|
|
114
|
+
const appInfo = this.packager.appInfo;
|
|
115
|
+
const options = this.options;
|
|
116
|
+
const executable = `app\\${appInfo.productFilename}.exe`;
|
|
117
|
+
const displayName = options.displayName || appInfo.productName;
|
|
118
|
+
const capabilities = this.getCapabilities();
|
|
119
|
+
const extensions = await this.getExtensions(executable, displayName);
|
|
120
|
+
const defaultMinVersion = "10.0.17763.0";
|
|
121
|
+
const customManifestPath = await this.packager.getResource(options.customManifestPath);
|
|
122
|
+
if (customManifestPath) {
|
|
123
|
+
log.info({ manifestPath: log.filePath(customManifestPath) }, "custom msix manifest found");
|
|
124
|
+
}
|
|
125
|
+
const manifestFileContent = await readFile(customManifestPath || path.join(getTemplatePath("msix"), "appxmanifest.xml"), "utf8");
|
|
126
|
+
const manifest = substituteManifestMacros(manifestFileContent, (p1) => {
|
|
127
|
+
switch (p1) {
|
|
128
|
+
case "publisher":
|
|
129
|
+
return publisher;
|
|
130
|
+
case "publisherDisplayName": {
|
|
131
|
+
const name = options.publisherDisplayName || appInfo.companyName;
|
|
132
|
+
if (name == null) {
|
|
133
|
+
throw new InvalidConfigurationError(`Please specify "author" in the application package.json — it is required because "msix.publisherDisplayName" is not set.`);
|
|
134
|
+
}
|
|
135
|
+
return name;
|
|
136
|
+
}
|
|
137
|
+
case "version":
|
|
138
|
+
return appInfo.getVersionInWeirdWindowsForm(options.setBuildNumber === true);
|
|
139
|
+
case "applicationId":
|
|
140
|
+
return resolvePackageApplicationId(options.applicationId, options.identityName, appInfo.name, "MSIX");
|
|
141
|
+
case "identityName":
|
|
142
|
+
return resolvePackageIdentityName(options.identityName, appInfo.name, "MSIX");
|
|
143
|
+
case "executable":
|
|
144
|
+
return executable;
|
|
145
|
+
case "displayName":
|
|
146
|
+
return displayName;
|
|
147
|
+
case "description":
|
|
148
|
+
return appInfo.description || appInfo.productName;
|
|
149
|
+
case "backgroundColor":
|
|
150
|
+
return options.backgroundColor || "#464646";
|
|
151
|
+
case "logo":
|
|
152
|
+
return "assets\\StoreLogo.png";
|
|
153
|
+
case "square150x150Logo":
|
|
154
|
+
return "assets\\Square150x150Logo.png";
|
|
155
|
+
case "square44x44Logo":
|
|
156
|
+
return "assets\\Square44x44Logo.png";
|
|
157
|
+
case "lockScreen":
|
|
158
|
+
return lockScreenTag(userAssets);
|
|
159
|
+
case "defaultTile":
|
|
160
|
+
return defaultTileTag(userAssets, options.showNameOnTiles || false);
|
|
161
|
+
case "splashScreen":
|
|
162
|
+
return splashScreenTag(userAssets);
|
|
163
|
+
case "arch":
|
|
164
|
+
return arch === Arch.ia32 ? "x86" : arch === Arch.arm64 ? "arm64" : "x64";
|
|
165
|
+
case "resourceLanguages":
|
|
166
|
+
return resourceLanguageTag(asArray(options.languages));
|
|
167
|
+
case "capabilities":
|
|
168
|
+
return capabilities;
|
|
169
|
+
case "extensions":
|
|
170
|
+
return extensions;
|
|
171
|
+
case "minVersion":
|
|
172
|
+
return options.minVersion || defaultMinVersion;
|
|
173
|
+
case "maxVersionTested":
|
|
174
|
+
return options.maxVersionTested || options.minVersion || defaultMinVersion;
|
|
175
|
+
case "packageIntegrity":
|
|
176
|
+
// uap10:PackageIntegrity belongs inside <Properties>, not <Capabilities>. It takes no
|
|
177
|
+
// attributes; a child <uap10:Content Enforcement="on" /> is required to actually enable
|
|
178
|
+
// runtime integrity checks (a bare/childless element is a no-op).
|
|
179
|
+
// https://learn.microsoft.com/uwp/schemas/appxpackage/uapmanifestschema/element-uap10-packageintegrity
|
|
180
|
+
return options.enforcePackageIntegrity === true ? '<uap10:PackageIntegrity><uap10:Content Enforcement="on" /></uap10:PackageIntegrity>' : "";
|
|
181
|
+
default:
|
|
182
|
+
throw new Error(`Macro ${p1} is not defined`);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
await writeFile(outFile, manifest);
|
|
186
|
+
}
|
|
187
|
+
getCapabilities() {
|
|
188
|
+
const inner = buildCapabilitiesXml(this.options.capabilities);
|
|
189
|
+
return `<Capabilities>\n${inner}\n</Capabilities>`;
|
|
190
|
+
}
|
|
191
|
+
async getExtensions(executable, displayName) {
|
|
192
|
+
const packager = this.packager;
|
|
193
|
+
const options = this.options;
|
|
194
|
+
const baseExtensions = await buildExtensionsXml({
|
|
195
|
+
protocols: asArray(packager.config.protocols).concat(asArray(packager.platformOptions.protocols)),
|
|
196
|
+
fileAssociations: asArray(packager.config.fileAssociations).concat(asArray(packager.platformOptions.fileAssociations)),
|
|
197
|
+
addAutoLaunchExtension: options.addAutoLaunchExtension,
|
|
198
|
+
customExtensionsPath: options.customExtensionsPath,
|
|
199
|
+
appDir: packager.appDir,
|
|
200
|
+
executable,
|
|
201
|
+
displayName,
|
|
202
|
+
dependencyNames: packager.metadata.dependencies,
|
|
203
|
+
});
|
|
204
|
+
const servicesXml = buildWindowsServicesXml(options.windowsServices, executable);
|
|
205
|
+
if (!servicesXml) {
|
|
206
|
+
return baseExtensions;
|
|
207
|
+
}
|
|
208
|
+
if (baseExtensions === "") {
|
|
209
|
+
return `<Extensions>${servicesXml}</Extensions>`;
|
|
210
|
+
}
|
|
211
|
+
return baseExtensions.replace("</Extensions>", `${servicesXml}</Extensions>`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=MsixTarget.js.map
|
|
@@ -0,0 +1 @@
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Arch, asArray, copyOrLinkFile, ensureNotBusy, exec, InvalidConfigurationError, log } from \"builder-util\"\nimport { getPath7za } from \"../../toolsets/7zip.js\"\nimport _fsExtra from \"fs-extra\"\nconst { mkdirs, readFile, remove, writeFile } = _fsExtra\nimport * as path from \"path\"\nimport { MsixOptions } from \"../../options/MsixOptions.js\"\nimport { isLegacyWinCodeSign, isOldWin6 } from \"../../toolsets/winCodeSign.js\"\nimport { Target } from \"../../core.js\"\nimport { getTemplatePath } from \"../../util/pathManager.js\"\nimport type { VmManager } from \"../../vm/vm.js\"\nimport { WinPackager } from \"../../winPackager.js\"\nimport {\n buildAppxPackage,\n buildCapabilitiesXml,\n buildExtensionsXml,\n buildWindowsServicesXml,\n defaultTileTag,\n lockScreenTag,\n resolvePackageApplicationId,\n resolvePackageIdentityName,\n resourceLanguageTag,\n splashScreenTag,\n substituteManifestMacros,\n} from \"./winAppUtil.js\"\n\nexport default class MsixTarget extends Target {\n readonly options: MsixOptions = this.packager.getOptionsForTarget<MsixOptions>(\"msix\")\n\n isAsyncSupported = false\n\n private readonly builtPackages = new Map<Arch, string>()\n private vendorPathKit: string | null = null\n private vm: VmManager | null = null\n\n constructor(\n private readonly packager: WinPackager,\n readonly outDir: string\n ) {\n super(\"msix\")\n\n if (process.platform !== \"darwin\" && (process.platform !== \"win32\" || isOldWin6())) {\n throw new Error(\"MSIX is supported on Windows 10 or Windows Server 2012 R2 (version number 6.3+) and on macOS via Parallels Desktop\")\n }\n }\n\n build(appOutDir: string, arch: Arch): Promise<any> {\n return buildAppxPackage(this, this.packager, this.options, appOutDir, arch, {\n kind: \"msix\",\n presentableName: \"MSIX\",\n preflight: () => {\n // unset / null / \"latest\" and any modern version pin resolve to a modern Windows Kits bundle (with\n // the MSIX SDK); only the explicit legacy \"0.0.0\" (winCodeSign-2.6.0) pin lacks it. A custom { url }\n // toolset is the user's responsibility.\n if (isLegacyWinCodeSign(this.packager.config.toolsets?.winCodeSign)) {\n throw new InvalidConfigurationError(\n 'MSIX packaging requires a modern Windows Kits toolset. The legacy \"0.0.0\" (winCodeSign-2.6.0) bundle does not include the Windows SDK version required for MSIX. ' +\n 'Use the default toolset or pin \"toolsets.winCodeSign\" to a modern version (e.g. \"1.0.0\", \"1.1.0\", or \"1.3.0\").'\n )\n }\n },\n writeManifest: (manifestFile, a, publisher, userAssets) => this.writeManifest(manifestFile, a, publisher, userAssets),\n // Record per-arch context so finishBuild can assemble the .msixbundle / .msixupload.\n onBuilt: ({ arch: builtArch, artifactPath, vendorPathKit, vm }) => {\n this.builtPackages.set(builtArch, artifactPath)\n this.vendorPathKit = vendorPathKit\n this.vm = vm\n },\n })\n }\n\n async finishBuild(): Promise<void> {\n await super.finishBuild()\n\n const packagePaths = Array.from(this.builtPackages.values())\n if (packagePaths.length === 0) {\n return\n }\n\n let bundlePath: string | undefined\n if (this.options.createMsixbundle !== false && packagePaths.length > 1) {\n bundlePath = await this.createMsixBundle(packagePaths)\n }\n\n if (this.options.createMsixupload === true) {\n await this.createMsixUpload(bundlePath ?? packagePaths[0])\n }\n }\n\n private async createMsixBundle(packagePaths: ReadonlyArray<string>): Promise<string> {\n const packager = this.packager\n const vm = this.vm!\n const kitPath = this.vendorPathKit!\n\n const bundleName = packager.expandArtifactBeautyNamePattern(this.options, \"msixbundle\", Arch.x64)\n const bundlePath = path.join(this.outDir, bundleName)\n\n await packager.emitArtifactBuildStarted({\n targetPresentableName: \"MSIX Bundle\",\n file: bundlePath,\n arch: null,\n })\n\n const stagingDir = path.join(this.outDir, \".msixbundle-staging\")\n await mkdirs(stagingDir)\n try {\n await Promise.all(packagePaths.map(p => copyOrLinkFile(p, path.join(stagingDir, path.basename(p)))))\n const makeAppxExe = path.join(kitPath, \"makeappx.exe\")\n await ensureNotBusy(makeAppxExe)\n await vm.exec(vm.toVmFile(makeAppxExe), [\"bundle\", \"/o\", \"/d\", vm.toVmFile(stagingDir), \"/p\", vm.toVmFile(bundlePath)])\n } finally {\n await remove(stagingDir)\n }\n\n await packager.signIf(bundlePath)\n\n await packager.emitArtifactBuildCompleted({\n file: bundlePath,\n packager,\n arch: null,\n safeArtifactName: packager.computeSafeArtifactName(bundleName, \"msixbundle\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n\n return bundlePath\n }\n\n private async createMsixUpload(sourcePath: string): Promise<void> {\n const packager = this.packager\n const uploadName = packager.expandArtifactBeautyNamePattern(this.options, \"msixupload\", Arch.x64)\n const uploadPath = path.join(this.outDir, uploadName)\n\n await packager.emitArtifactBuildStarted({\n targetPresentableName: \"MSIX Upload\",\n file: uploadPath,\n arch: null,\n })\n\n const sevenZa = await getPath7za()\n await exec(sevenZa, [\"a\", \"-tzip\", uploadPath, sourcePath])\n\n await packager.emitArtifactBuildCompleted({\n file: uploadPath,\n packager,\n arch: null,\n safeArtifactName: packager.computeSafeArtifactName(uploadName, \"msixupload\"),\n target: this,\n isWriteUpdateInfo: false,\n })\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 capabilities = this.getCapabilities()\n const extensions = await this.getExtensions(executable, displayName)\n const defaultMinVersion = \"10.0.17763.0\"\n\n const customManifestPath = await this.packager.getResource(options.customManifestPath)\n if (customManifestPath) {\n log.info({ manifestPath: log.filePath(customManifestPath) }, \"custom msix manifest found\")\n }\n const manifestFileContent = await readFile(customManifestPath || path.join(getTemplatePath(\"msix\"), \"appxmanifest.xml\"), \"utf8\")\n const manifest = substituteManifestMacros(manifestFileContent, (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 \"msix.publisherDisplayName\" is not set.`)\n }\n return name\n }\n\n case \"version\":\n return appInfo.getVersionInWeirdWindowsForm(options.setBuildNumber === true)\n\n case \"applicationId\":\n return resolvePackageApplicationId(options.applicationId, options.identityName, appInfo.name, \"MSIX\")\n\n case \"identityName\":\n return resolvePackageIdentityName(options.identityName, appInfo.name, \"MSIX\")\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\" : arch === Arch.arm64 ? \"arm64\" : \"x64\"\n\n case \"resourceLanguages\":\n return resourceLanguageTag(asArray(options.languages))\n\n case \"capabilities\":\n return capabilities\n\n case \"extensions\":\n return extensions\n\n case \"minVersion\":\n return options.minVersion || defaultMinVersion\n\n case \"maxVersionTested\":\n return options.maxVersionTested || options.minVersion || defaultMinVersion\n\n case \"packageIntegrity\":\n // uap10:PackageIntegrity belongs inside <Properties>, not <Capabilities>. It takes no\n // attributes; a child <uap10:Content Enforcement=\"on\" /> is required to actually enable\n // runtime integrity checks (a bare/childless element is a no-op).\n // https://learn.microsoft.com/uwp/schemas/appxpackage/uapmanifestschema/element-uap10-packageintegrity\n return options.enforcePackageIntegrity === true ? '<uap10:PackageIntegrity><uap10:Content Enforcement=\"on\" /></uap10:PackageIntegrity>' : \"\"\n\n default:\n throw new Error(`Macro ${p1} is not defined`)\n }\n })\n await writeFile(outFile, manifest)\n }\n\n private getCapabilities(): string {\n const inner = buildCapabilitiesXml(this.options.capabilities)\n return `<Capabilities>\\n${inner}\\n</Capabilities>`\n }\n\n private async getExtensions(executable: string, displayName: string): Promise<string> {\n const packager = this.packager\n const options = this.options\n\n const baseExtensions = await buildExtensionsXml({\n protocols: asArray(packager.config.protocols).concat(asArray(packager.platformOptions.protocols)),\n fileAssociations: asArray(packager.config.fileAssociations).concat(asArray(packager.platformOptions.fileAssociations)),\n addAutoLaunchExtension: options.addAutoLaunchExtension,\n customExtensionsPath: options.customExtensionsPath,\n appDir: packager.appDir,\n executable,\n displayName,\n dependencyNames: packager.metadata.dependencies,\n })\n\n const servicesXml = buildWindowsServicesXml(options.windowsServices, executable)\n\n if (!servicesXml) {\n return baseExtensions\n }\n\n if (baseExtensions === \"\") {\n return `<Extensions>${servicesXml}</Extensions>`\n }\n\n return baseExtensions.replace(\"</Extensions>\", `${servicesXml}</Extensions>`)\n }\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { Target } from "../../../core.js";
|
|
|
4
4
|
import { WinPackager } from "../../../winPackager.js";
|
|
5
5
|
import { Defines } from "./Defines.js";
|
|
6
6
|
import { NsisOptions } from "./nsisOptions.js";
|
|
7
|
-
import { AppPackageHelper } from "./nsisUtil.js";
|
|
7
|
+
import { AppPackageHelper, CopyElevateHelper } from "./nsisUtil.js";
|
|
8
8
|
export declare class NsisTarget extends Target {
|
|
9
9
|
readonly packager: WinPackager;
|
|
10
10
|
readonly outDir: string;
|
|
@@ -19,10 +19,11 @@ export declare class NsisTarget extends Target {
|
|
|
19
19
|
get isBuildDifferentialAware(): boolean;
|
|
20
20
|
private getPreCompressedFileExtensions;
|
|
21
21
|
/** @private */
|
|
22
|
-
buildAppPackage(appOutDir: string, arch: Arch): Promise<PackageFileInfo>;
|
|
22
|
+
buildAppPackage(appOutDir: string, arch: Arch, elevateHelper?: CopyElevateHelper | null): Promise<PackageFileInfo>;
|
|
23
23
|
protected installerFilenamePattern(primaryArch?: Arch | null, defaultArch?: string): string;
|
|
24
24
|
private get isPortable();
|
|
25
25
|
finishBuild(): Promise<any>;
|
|
26
|
+
get appGuid(): string;
|
|
26
27
|
private buildInstaller;
|
|
27
28
|
private resolveArchPackageFiles;
|
|
28
29
|
protected generateGitHubInstallerName(primaryArch: Arch | null, defaultArch: string | undefined): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NsisTarget.d.ts","sourceRoot":"","sources":["../../../../src/targets/win/nsis/NsisTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,
|
|
1
|
+
{"version":3,"file":"NsisTarget.d.ts","sourceRoot":"","sources":["../../../../src/targets/win/nsis/NsisTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAcL,MAAM,cAAc,CAAA;AACrB,OAAO,EAA8E,eAAe,EAAe,MAAM,sBAAsB,CAAA;AAI/I,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAOzC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAKrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,OAAO,EAAE,WAAW,EAAmB,MAAM,kBAAkB,CAAA;AAI/D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAuC,MAAM,eAAe,CAAA;AASxG,qBAAa,UAAW,SAAQ,MAAM;IAQlC,QAAQ,CAAC,QAAQ,EAAE,WAAW;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM;IAEvB,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,gBAAgB;IAVpD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAE7B,eAAe;IACf,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAY;IAC7C,QAAQ,CAAC,gBAAgB,SAAQ;gBAGtB,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EACC,aAAa,EAAE,gBAAgB;IAwBpD,IAAI,6BAA6B,YAGhC;IAED,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;IAQnC,IAAI,wBAAwB,IAAI,OAAO,CAEtC;IAED,OAAO,CAAC,8BAA8B;IAKtC,eAAe;IACT,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC;IA2CxH,SAAS,CAAC,wBAAwB,CAAC,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM;IAO3F,OAAO,KAAK,UAAU,GAErB;IAEK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAqBjC,IAAI,OAAO,IAAI,MAAM,CAEpB;YAEa,cAAc;YAiLd,uBAAuB;IA+CrC,SAAS,CAAC,2BAA2B,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAOxG,OAAO,KAAK,gBAAgB,GAE3B;IAED,IAAI,cAAc,IAAI,OAAO,CAE5B;YAEa,+BAA+B;IAsD7C,OAAO,CAAC,iBAAiB;IAqBzB,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;YA8E/D,uBAAuB;YAOvB,mBAAmB;YASnB,oBAAoB;YAMpB,mBAAmB;IASjC,OAAO,CAAC,qCAAqC;YA4B/B,eAAe;YAgEf,kCAAkC;YAiDlC,kBAAkB;CAkEjC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Arch, asArray, AsyncTaskManager, exists, spawnAndWriteWithOutput, generateKsuid, getArchSuffix, getPlatformIconFileName, InvalidConfigurationError, log, statOrNull, use, walk, } from "builder-util";
|
|
1
|
+
import { Arch, asArray, AsyncTaskManager, ensureNotBusy, exists, spawnAndWriteWithOutput, generateKsuid, getArchSuffix, getPlatformIconFileName, InvalidConfigurationError, log, statOrNull, use, walk, } from "builder-util";
|
|
2
2
|
import { CURRENT_APP_INSTALLER_FILE_NAME, CURRENT_APP_PACKAGE_FILE_NAME, deepAssign, sleep, UUID } from "builder-util-runtime";
|
|
3
3
|
import _debug from "debug";
|
|
4
|
-
import * as fs from "fs";
|
|
5
4
|
import * as path from "path";
|
|
6
5
|
import { Target } from "../../../core.js";
|
|
7
6
|
import { DesktopShortcutCreationPolicy, getEffectiveOptions } from "../../../options/CommonWindowsInstallerConfiguration.js";
|
|
@@ -16,14 +15,13 @@ import { getWindowsInstallationAppPackageName, getWindowsInstallationDirName } f
|
|
|
16
15
|
import { addCustomMessageFileInclude, createAddLangsMacro, LangConfigurator } from "./nsisLang.js";
|
|
17
16
|
import { computeLicensePage } from "./nsisLicense.js";
|
|
18
17
|
import { NsisScriptGenerator, nsisEscapeString } from "./nsisScriptGenerator.js";
|
|
18
|
+
import { ELECTRON_BUILDER_NS_UUID, ProgIdMaker } from "./progId.js";
|
|
19
19
|
import { getMakeNsisPath, getNsisPluginsPath } from "../../../toolsets/nsis.js";
|
|
20
20
|
import { nsisTemplatesDir, UninstallerReader } from "./nsisUtil.js";
|
|
21
21
|
import { checkMakensisOutput, verifyInstallerSize } from "./nsisValidation.js";
|
|
22
22
|
import _fsExtra from "fs-extra";
|
|
23
23
|
const { readFile, stat, unlink } = _fsExtra;
|
|
24
24
|
const debug = _debug("electron-builder:nsis");
|
|
25
|
-
// noinspection SpellCheckingInspection
|
|
26
|
-
const ELECTRON_BUILDER_NS_UUID = UUID.parse("50e065bc-3134-11e6-9bab-38c9862bdaf3");
|
|
27
25
|
const USE_NSIS_BUILT_IN_COMPRESSOR = false;
|
|
28
26
|
export class NsisTarget extends Target {
|
|
29
27
|
constructor(packager, outDir, targetName, packageHelper) {
|
|
@@ -69,7 +67,7 @@ export class NsisTarget extends Target {
|
|
|
69
67
|
return result == null ? null : asArray(result).map(it => (it.startsWith(".") ? it : `.${it}`));
|
|
70
68
|
}
|
|
71
69
|
/** @private */
|
|
72
|
-
async buildAppPackage(appOutDir, arch) {
|
|
70
|
+
async buildAppPackage(appOutDir, arch, elevateHelper) {
|
|
73
71
|
const options = this.options;
|
|
74
72
|
const packager = this.packager;
|
|
75
73
|
const isBuildDifferentialAware = this.isBuildDifferentialAware;
|
|
@@ -79,11 +77,24 @@ export class NsisTarget extends Target {
|
|
|
79
77
|
const archiveOptions = {
|
|
80
78
|
withoutDir: true,
|
|
81
79
|
compression: packager.compression,
|
|
80
|
+
// The install-time Nsis7z extractor only decodes plain LZMA2/Copy and single-stream BCJ — not
|
|
81
|
+
// the CPU branch converters modern 7za applies to executables (BCJ2 on x86/x64, ARM64 on
|
|
82
|
+
// arm64), which it silently skips, dropping the main exe and every native binary from the
|
|
83
|
+
// install. Pin the payload to a filter it can decode. See #9983.
|
|
84
|
+
installTimeDecodable: true,
|
|
82
85
|
excluded: preCompressedFileExtensions == null ? null : preCompressedFileExtensions.map(it => `*${it}`),
|
|
83
86
|
};
|
|
84
87
|
const timer = time(`nsis package, ${Arch[arch]}`);
|
|
85
88
|
await archive(format, archiveFile, appOutDir, isBuildDifferentialAware ? configureDifferentialAwareArchiveOptions(archiveOptions) : archiveOptions);
|
|
86
89
|
timer.end();
|
|
90
|
+
// Inject elevate.exe into the archive via a temp staging dir, never by mutating appOutDir
|
|
91
|
+
// during packaging. The copy into win-unpacked is deferred until all targets finish, so
|
|
92
|
+
// concurrent targets (Squirrel, ZIP, etc.) never pick up elevate.exe non-deterministically.
|
|
93
|
+
// `archiveOptions` was mutated in place by configureDifferentialAwareArchiveOptions above
|
|
94
|
+
// (when differential-aware), so it already reflects the effective compression settings.
|
|
95
|
+
if (elevateHelper) {
|
|
96
|
+
await elevateHelper.addToArchive(archiveFile, this, format, archiveOptions, appOutDir);
|
|
97
|
+
}
|
|
87
98
|
if (isBuildDifferentialAware && this.isWebInstaller) {
|
|
88
99
|
const data = await appendBlockmap(archiveFile);
|
|
89
100
|
return {
|
|
@@ -125,6 +136,9 @@ export class NsisTarget extends Target {
|
|
|
125
136
|
await this.packageHelper.finishBuild();
|
|
126
137
|
}
|
|
127
138
|
}
|
|
139
|
+
get appGuid() {
|
|
140
|
+
return this.options.guid || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_NS_UUID);
|
|
141
|
+
}
|
|
128
142
|
async buildInstaller(archs) {
|
|
129
143
|
const primaryArch = archs.size === 1 ? (archs.keys().next().value ?? null) : null;
|
|
130
144
|
const packager = this.packager;
|
|
@@ -151,11 +165,10 @@ export class NsisTarget extends Target {
|
|
|
151
165
|
file: installerPath,
|
|
152
166
|
arch: primaryArch,
|
|
153
167
|
}, logFields);
|
|
154
|
-
const
|
|
155
|
-
const uninstallAppKey = guid.replace(/\\/g, " - ");
|
|
168
|
+
const uninstallAppKey = this.appGuid.replace(/\\/g, " - ");
|
|
156
169
|
const defines = {
|
|
157
170
|
APP_ID: appInfo.id,
|
|
158
|
-
APP_GUID:
|
|
171
|
+
APP_GUID: this.appGuid,
|
|
159
172
|
// Windows bug - entry in Software\Microsoft\Windows\CurrentVersion\Uninstall cannot have \ symbols (dir)
|
|
160
173
|
UNINSTALL_APP_KEY: uninstallAppKey,
|
|
161
174
|
PRODUCT_NAME: appInfo.productName,
|
|
@@ -170,8 +183,8 @@ export class NsisTarget extends Target {
|
|
|
170
183
|
if (options.customNsisBinary?.debugLogging) {
|
|
171
184
|
defines.ENABLE_LOGGING_ELECTRON_BUILDER = null;
|
|
172
185
|
}
|
|
173
|
-
if (uninstallAppKey !==
|
|
174
|
-
defines.UNINSTALL_REGISTRY_KEY_2 = `Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${
|
|
186
|
+
if (uninstallAppKey !== this.appGuid) {
|
|
187
|
+
defines.UNINSTALL_REGISTRY_KEY_2 = `Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${this.appGuid}`;
|
|
175
188
|
}
|
|
176
189
|
const { homepage } = this.packager.metadata;
|
|
177
190
|
use(options.uninstallUrlHelp || homepage, it => (defines.UNINSTALL_URL_HELP = it));
|
|
@@ -628,6 +641,7 @@ export class NsisTarget extends Target {
|
|
|
628
641
|
const fileAssociations = packager.fileAssociations;
|
|
629
642
|
if (fileAssociations.length !== 0) {
|
|
630
643
|
scriptGenerator.include(path.join(path.join(nsisTemplatesDir, "include"), "FileAssociation.nsh"));
|
|
644
|
+
const progIdMaker = new ProgIdMaker(this.appGuid, packager.appInfo.productFilename);
|
|
631
645
|
if (isInstaller) {
|
|
632
646
|
const registerFileAssociationsScript = new NsisScriptGenerator();
|
|
633
647
|
for (const item of fileAssociations) {
|
|
@@ -639,10 +653,11 @@ export class NsisTarget extends Target {
|
|
|
639
653
|
installedIconPath = `$INSTDIR\\resources\\${nsisEscapeString(path.basename(customIcon))}`;
|
|
640
654
|
registerFileAssociationsScript.file(installedIconPath, customIcon);
|
|
641
655
|
}
|
|
656
|
+
const progID = progIdMaker.progId(item.name || ext);
|
|
642
657
|
const icon = `"${installedIconPath}"`;
|
|
643
658
|
const commandText = `"Open with ${nsisEscapeString(packager.appInfo.productName)}"`;
|
|
644
659
|
const command = '"$appExe $\\"%1$\\""';
|
|
645
|
-
registerFileAssociationsScript.insertMacro("APP_ASSOCIATE", `"${nsisEscapeString(ext)}" "${
|
|
660
|
+
registerFileAssociationsScript.insertMacro("APP_ASSOCIATE", `"${nsisEscapeString(ext)}" "${progID}" "${nsisEscapeString(item.description || "")}" ${icon} ${commandText} ${command}`);
|
|
646
661
|
}
|
|
647
662
|
}
|
|
648
663
|
scriptGenerator.macro("registerFileAssociations", registerFileAssociationsScript);
|
|
@@ -650,8 +665,8 @@ export class NsisTarget extends Target {
|
|
|
650
665
|
else {
|
|
651
666
|
const unregisterFileAssociationsScript = new NsisScriptGenerator();
|
|
652
667
|
for (const item of fileAssociations) {
|
|
653
|
-
for (const ext of asArray(item.ext)) {
|
|
654
|
-
unregisterFileAssociationsScript.insertMacro("APP_UNASSOCIATE", `"${
|
|
668
|
+
for (const ext of asArray(item.ext).map(normalizeExt)) {
|
|
669
|
+
unregisterFileAssociationsScript.insertMacro("APP_UNASSOCIATE", `"${nsisEscapeString(ext)}" "${progIdMaker.progId(item.name || ext)}"`);
|
|
655
670
|
}
|
|
656
671
|
}
|
|
657
672
|
scriptGenerator.macro("unregisterFileAssociations", unregisterFileAssociationsScript);
|
|
@@ -683,39 +698,6 @@ async function generateForPreCompressed(preCompressedFileExtensions, dir, arch,
|
|
|
683
698
|
scriptGenerator.macro(`customFiles_${Arch[arch]}`, macro);
|
|
684
699
|
}
|
|
685
700
|
}
|
|
686
|
-
async function ensureNotBusy(outFile) {
|
|
687
|
-
function isBusy(wasBusyBefore) {
|
|
688
|
-
return new Promise((resolve, reject) => {
|
|
689
|
-
fs.open(outFile, "r+", (error, fd) => {
|
|
690
|
-
try {
|
|
691
|
-
if (error != null && error.code === "EBUSY") {
|
|
692
|
-
if (!wasBusyBefore) {
|
|
693
|
-
log.info({}, "output file is locked for writing (maybe by virus scanner) => waiting for unlock...");
|
|
694
|
-
}
|
|
695
|
-
resolve(false);
|
|
696
|
-
}
|
|
697
|
-
else if (fd == null) {
|
|
698
|
-
resolve(true);
|
|
699
|
-
}
|
|
700
|
-
else {
|
|
701
|
-
fs.close(fd, () => resolve(true));
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
catch (error) {
|
|
705
|
-
reject(error);
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
}).then(result => {
|
|
709
|
-
if (result) {
|
|
710
|
-
return true;
|
|
711
|
-
}
|
|
712
|
-
else {
|
|
713
|
-
return sleep(2000).then(() => isBusy(true));
|
|
714
|
-
}
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
await isBusy(false);
|
|
718
|
-
}
|
|
719
701
|
async function createPackageFileInfo(file) {
|
|
720
702
|
return {
|
|
721
703
|
path: file,
|