app-builder-lib 27.0.0-alpha.13 → 27.0.0-alpha.14
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/configuration.d.ts +47 -1
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +4 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/packager.d.ts +6 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +14 -3
- package/dist/packager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +7 -5
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/blockmap/blockmap.d.ts +30 -0
- package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
- package/dist/targets/blockmap/blockmap.js +99 -31
- package/dist/targets/blockmap/blockmap.js.map +1 -1
- package/dist/targets/blockmap/blockmapV3.d.ts +36 -0
- package/dist/targets/blockmap/blockmapV3.d.ts.map +1 -0
- package/dist/targets/blockmap/blockmapV3.js +41 -0
- package/dist/targets/blockmap/blockmapV3.js.map +1 -0
- package/dist/targets/blockmap/verbatimRange.d.ts +6 -0
- package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -1
- package/dist/targets/blockmap/verbatimRange.js +11 -0
- package/dist/targets/blockmap/verbatimRange.js.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.d.ts +92 -4
- package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.js +266 -10
- package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +15 -1
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/targetFactory.d.ts +1 -1
- package/dist/targets/targetFactory.d.ts.map +1 -1
- package/dist/targets/targetFactory.js +22 -0
- package/dist/targets/targetFactory.js.map +1 -1
- package/dist/targets/win/MsiTarget.d.ts +7 -0
- package/dist/targets/win/MsiTarget.d.ts.map +1 -1
- package/dist/targets/win/MsiTarget.js +140 -21
- package/dist/targets/win/MsiTarget.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +14 -6
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/toolsets/appimage.d.ts +3 -0
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +4 -1
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/wix.d.ts +44 -0
- package/dist/toolsets/wix.d.ts.map +1 -0
- package/dist/toolsets/wix.js +91 -0
- package/dist/toolsets/wix.js.map +1 -0
- package/dist/util/electronUpdaterCompatibility.d.ts +43 -0
- package/dist/util/electronUpdaterCompatibility.d.ts.map +1 -0
- package/dist/util/electronUpdaterCompatibility.js +53 -0
- package/dist/util/electronUpdaterCompatibility.js.map +1 -0
- package/dist/util/packageMetadata.js +115 -51
- 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/package.json +8 -8
- package/scheme.json +45 -6
- package/templates/msi/template.xml +5 -5
- package/templates/msiWrapped/template.xml +1 -1
- package/templates/nsis/assistedInstaller.nsh +32 -1
|
@@ -8,7 +8,7 @@ import path from "path";
|
|
|
8
8
|
import { Target } from "../../core.js";
|
|
9
9
|
import { DesktopShortcutCreationPolicy, getEffectiveOptions } from "../../options/CommonWindowsInstallerConfiguration.js";
|
|
10
10
|
import { normalizeExt } from "../../platformPackager.js";
|
|
11
|
-
import {
|
|
11
|
+
import { assertNoWix4Namespaces, getCandleArch, getWixArch, getWixNamespace, getWixToolset } from "../../toolsets/wix.js";
|
|
12
12
|
import { getTemplatePath } from "../../util/pathManager.js";
|
|
13
13
|
import { withToolsetLock } from "../../util/toolsetLock.js";
|
|
14
14
|
import { VmManager } from "../../vm/vm.js";
|
|
@@ -16,7 +16,8 @@ import { WineVmManager } from "../../vm/WineVm.js";
|
|
|
16
16
|
import { createStageDir, getWindowsInstallationDirName } from "../targetUtil.js";
|
|
17
17
|
const ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse("d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc");
|
|
18
18
|
const ROOT_DIR_ID = "APPLICATIONFOLDER";
|
|
19
|
-
//
|
|
19
|
+
// candle.exe and light.exe are .NET Framework programs: on macOS and Linux they run under Wine, which runs them with wine-mono (the
|
|
20
|
+
// toolsets.wix notes in toolsets.md), not with a host Mono
|
|
20
21
|
export default class MsiTarget extends Target {
|
|
21
22
|
constructor(packager, outDir, name = "msi", isAsyncSupported = true) {
|
|
22
23
|
super(name, isAsyncSupported);
|
|
@@ -24,6 +25,8 @@ export default class MsiTarget extends Target {
|
|
|
24
25
|
this.outDir = outDir;
|
|
25
26
|
this.vm = process.platform === "win32" ? new VmManager() : new WineVmManager(this.packager.config.toolsets?.wine, this.packager.buildResourcesDir);
|
|
26
27
|
this.options = this.packager.getOptionsForTarget("msi");
|
|
28
|
+
// `toolsets.wix` decides the .wxs namespace (getBaseOptions) and whether arm64 is supported, so it is resolved before the project is written
|
|
29
|
+
this.wixToolset = new Lazy(() => getWixToolset(this.packager.config.toolsets?.wix, this.packager.buildResourcesDir));
|
|
27
30
|
this.projectTemplate = new Lazy(async () => {
|
|
28
31
|
const template = (await readFile(path.join(getTemplatePath(this.name), "template.xml"), "utf8"))
|
|
29
32
|
.replace(/{{/g, "<%")
|
|
@@ -57,23 +60,20 @@ export default class MsiTarget extends Target {
|
|
|
57
60
|
const stageDir = await createStageDir(this, packager, arch);
|
|
58
61
|
const vm = this.vm;
|
|
59
62
|
const commonOptions = getEffectiveOptions(this.options, this.packager);
|
|
60
|
-
// wix 4.0.0.5512.2 doesn't support the arm64 architecture so
|
|
61
|
-
//
|
|
62
|
-
// stopgap until the electron-builder-binaries wix version is upgraded to a version that supports arm64:
|
|
63
|
+
// The legacy wix 4.0.0.5512.2 bundle (`toolsets.wix: "0.0.0"`) doesn't support the arm64 architecture, so with it an arm64 build is
|
|
64
|
+
// packaged as an x64 MSI that installs the arm64 app. The default WiX 3.14.1 bundle builds an arm64 MSI.
|
|
63
65
|
// https://github.com/electron-userland/electron-builder/issues/6077
|
|
64
|
-
const
|
|
66
|
+
const wixToolset = await this.wixToolset.value;
|
|
67
|
+
const wixArch = getWixArch(arch, wixToolset.schema);
|
|
65
68
|
const projectFile = stageDir.getTempFile("project.wxs");
|
|
66
69
|
const objectFiles = ["project.wixobj"];
|
|
67
70
|
await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions));
|
|
68
71
|
await packager.emitMsiProjectCreated(projectFile);
|
|
72
|
+
// an msiProjectCreated hook written for the legacy bundle can add WiX 4 namespaces, which WiX 3 can't compile
|
|
73
|
+
assertNoWix4Namespaces(await readFile(projectFile, "utf8"), wixToolset.schema);
|
|
74
|
+
const vendorPath = wixToolset.path;
|
|
69
75
|
// noinspection SpellCheckingInspection
|
|
70
|
-
const
|
|
71
|
-
releaseName: "wix-4.0.0.5512.2",
|
|
72
|
-
filenameWithExt: "wix-4.0.0.5512.2.7z",
|
|
73
|
-
checksums: { "wix-4.0.0.5512.2.7z": "fe677fcd837b18c9b912985d91636bbd8a1e800c3b3a6a841b6f96e89624e839" },
|
|
74
|
-
});
|
|
75
|
-
// noinspection SpellCheckingInspection
|
|
76
|
-
const candleArgs = ["-arch", wixArch === Arch.ia32 ? "x86" : "x64", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs());
|
|
76
|
+
const candleArgs = ["-arch", getCandleArch(wixArch), `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs());
|
|
77
77
|
candleArgs.push("project.wxs");
|
|
78
78
|
await withToolsetLock(async () => {
|
|
79
79
|
await vm.exec(vm.toVmFile(path.join(vendorPath, "candle.exe")), candleArgs, {
|
|
@@ -143,12 +143,17 @@ export default class MsiTarget extends Target {
|
|
|
143
143
|
const appInfo = this.packager.appInfo;
|
|
144
144
|
const { files, dirs } = await this.computeFileDeclaration(appOutDir);
|
|
145
145
|
const options = this.options;
|
|
146
|
+
const isWix3 = (await this.wixToolset.value).schema === "v3";
|
|
146
147
|
return (await this.projectTemplate.value)({
|
|
147
148
|
...(await this.getBaseOptions(commonOptions)),
|
|
148
149
|
isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,
|
|
149
150
|
isRunAfterFinish: options.runAfterFinish !== false,
|
|
150
151
|
// https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory
|
|
151
|
-
programFilesId: wixArch === Arch.
|
|
152
|
+
programFilesId: wixArch === Arch.ia32 ? "ProgramFilesFolder" : "ProgramFiles64Folder",
|
|
153
|
+
// a WiX 3 component can't override the directory of its ComponentGroup, so there each component names its own (computeFileDeclaration)
|
|
154
|
+
componentGroupDirectoryAttribute: isWix3 ? "" : ` Directory="${ROOT_DIR_ID}"`,
|
|
155
|
+
// the directories between the Program Files folder and APPLICATIONFOLDER, outermost first
|
|
156
|
+
companyDirectories: getCompanyDirectories(commonOptions.menuCategory, isWix3),
|
|
152
157
|
// wix in the name because special wix format can be used in the name
|
|
153
158
|
installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),
|
|
154
159
|
dirs,
|
|
@@ -156,6 +161,7 @@ export default class MsiTarget extends Target {
|
|
|
156
161
|
});
|
|
157
162
|
}
|
|
158
163
|
async getBaseOptions(commonOptions) {
|
|
164
|
+
const wixSchema = (await this.wixToolset.value).schema;
|
|
159
165
|
const appInfo = this.packager.appInfo;
|
|
160
166
|
const iconPath = await this.packager.getIconPath();
|
|
161
167
|
const compression = this.packager.compression;
|
|
@@ -165,6 +171,7 @@ export default class MsiTarget extends Target {
|
|
|
165
171
|
}
|
|
166
172
|
return {
|
|
167
173
|
...commonOptions,
|
|
174
|
+
wixNamespace: getWixNamespace(wixSchema),
|
|
168
175
|
iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),
|
|
169
176
|
iconId: this.iconId,
|
|
170
177
|
compressionLevel: compression === "store" ? "none" : "high",
|
|
@@ -177,11 +184,17 @@ export default class MsiTarget extends Target {
|
|
|
177
184
|
}
|
|
178
185
|
async computeFileDeclaration(appOutDir) {
|
|
179
186
|
const appInfo = this.packager.appInfo;
|
|
187
|
+
// WiX 3 has no inline directory syntax, and a component can't override the directory of its ComponentGroup there
|
|
188
|
+
const isWix3 = (await this.wixToolset.value).schema === "v3";
|
|
180
189
|
let isRootDirAddedToRemoveTable = false;
|
|
181
190
|
const dirNames = new Set();
|
|
182
191
|
const dirs = [];
|
|
192
|
+
// assigned in the map callback below, which control-flow narrowing does not see
|
|
193
|
+
let startMenuCategory = null;
|
|
183
194
|
const fileSpace = " ".repeat(6);
|
|
184
195
|
const commonOptions = getEffectiveOptions(this.options, this.packager);
|
|
196
|
+
// WiX 3 declares one Directory per segment, so empty segments (a leading, trailing or doubled separator) are dropped
|
|
197
|
+
const menuCategory = isWix3 ? joinMenuCategory(commonOptions.menuCategory, path.sep) : commonOptions.menuCategory;
|
|
185
198
|
// The template only declares `<Icon Id="${iconId}"/>` when an icon is configured, so referencing
|
|
186
199
|
// that id unconditionally makes light.exe fail with LGHT0094 for an app without an icon.
|
|
187
200
|
const iconAttribute = (await this.packager.getIconPath()) == null ? "" : ` Icon="${this.iconId}"`;
|
|
@@ -198,10 +211,12 @@ export default class MsiTarget extends Target {
|
|
|
198
211
|
// This syntax is a shortcut to defining each directory in an individual Directory element.
|
|
199
212
|
dirName = packagePath.substring(0, lastSlash);
|
|
200
213
|
// https://github.com/electron-userland/electron-builder/issues/3027
|
|
201
|
-
directoryId =
|
|
214
|
+
directoryId = getDirectoryId(dirName);
|
|
202
215
|
if (!dirNames.has(dirName)) {
|
|
203
216
|
dirNames.add(dirName);
|
|
204
|
-
|
|
217
|
+
if (!isWix3) {
|
|
218
|
+
dirs.push(`<Directory Id="${directoryId}" Name="${ROOT_DIR_ID}:\\${dirName.replace(/\//g, "\\")}\\"/>`);
|
|
219
|
+
}
|
|
205
220
|
}
|
|
206
221
|
}
|
|
207
222
|
else if (!isRootDirAddedToRemoveTable) {
|
|
@@ -209,14 +224,20 @@ export default class MsiTarget extends Target {
|
|
|
209
224
|
}
|
|
210
225
|
// since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid
|
|
211
226
|
// https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix
|
|
212
|
-
|
|
227
|
+
const componentDirectoryId = directoryId ?? (isWix3 ? ROOT_DIR_ID : null);
|
|
228
|
+
let result = `<Component${componentDirectoryId === null ? "" : ` Directory="${componentDirectoryId}"`}>`;
|
|
213
229
|
result += `\n${fileSpace} <File Name="${escapeForXml(fileName)}" Source="$(var.appDir)${path.sep}${escapeForXml(packagePath)}" ReadOnly="yes" KeyPath="yes"`;
|
|
214
230
|
const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`;
|
|
215
231
|
if (isMainExecutable) {
|
|
216
232
|
result += ' Id="mainExecutable"';
|
|
217
233
|
}
|
|
218
234
|
else if (directoryId === null) {
|
|
219
|
-
result += ` Id="${
|
|
235
|
+
result += ` Id="${getRootFileId(packagePath, isWix3)}"`;
|
|
236
|
+
}
|
|
237
|
+
else if (isWix3) {
|
|
238
|
+
// WiX 3 derives an omitted File/@Id (and so the Component/@Id) from the file name alone, which collides for files of the same
|
|
239
|
+
// name in different directories (LGHT0091). The component GUID is derived from the install path, not from this id.
|
|
240
|
+
result += ` Id="${getHashedFileId(packagePath)}"`;
|
|
220
241
|
}
|
|
221
242
|
const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER;
|
|
222
243
|
if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {
|
|
@@ -225,11 +246,16 @@ export default class MsiTarget extends Target {
|
|
|
225
246
|
if (isCreateDesktopShortcut) {
|
|
226
247
|
result += `${fileSpace} <Shortcut Id="desktopShortcut" Directory="DesktopFolder" Name="${escapeForXml(shortcutName)}" WorkingDirectory="APPLICATIONFOLDER" Advertise="yes"${iconAttribute}/>\n`;
|
|
227
248
|
}
|
|
228
|
-
const hasMenuCategory =
|
|
249
|
+
const hasMenuCategory = menuCategory != null;
|
|
229
250
|
const startMenuShortcutDirectoryId = hasMenuCategory ? "AppProgramMenuDir" : "ProgramMenuFolder";
|
|
230
251
|
if (commonOptions.isCreateStartMenuShortcut) {
|
|
231
|
-
if (
|
|
232
|
-
|
|
252
|
+
if (menuCategory != null) {
|
|
253
|
+
if (!isWix3) {
|
|
254
|
+
dirs.push(`<Directory Id="${startMenuShortcutDirectoryId}" Name="ProgramMenuFolder:\\${menuCategory}\\"/>`);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
startMenuCategory = menuCategory;
|
|
258
|
+
}
|
|
233
259
|
}
|
|
234
260
|
result += `${fileSpace} <Shortcut Id="startMenuShortcut" Directory="${startMenuShortcutDirectoryId}" Name="${escapeForXml(shortcutName)}" WorkingDirectory="APPLICATIONFOLDER" Advertise="yes"${iconAttribute}>\n`;
|
|
235
261
|
result += `${fileSpace} <ShortcutProperty Key="System.AppUserModel.ID" Value="${escapeForXml(this.packager.appInfo.id)}"/>\n`;
|
|
@@ -258,9 +284,102 @@ export default class MsiTarget extends Target {
|
|
|
258
284
|
}
|
|
259
285
|
return `${result}\n${fileSpace}</Component>`;
|
|
260
286
|
});
|
|
287
|
+
if (isWix3) {
|
|
288
|
+
dirs.push(...renderDirectoryTree(ROOT_DIR_ID, dirNames, path.sep, getDirectoryId));
|
|
289
|
+
if (startMenuCategory != null) {
|
|
290
|
+
// the shortcut is in the innermost directory of the category, which keeps the id the shortcut and RemoveFolder use
|
|
291
|
+
const categoryPath = startMenuCategory;
|
|
292
|
+
dirs.push(...renderDirectoryTree("ProgramMenuFolder", [categoryPath], path.sep, it => (it === categoryPath ? "AppProgramMenuDir" : getDirectoryId(`menu:${it}`))));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
261
295
|
return { dirs: listToString(dirs, 2), files: listToString(files, 3) };
|
|
262
296
|
}
|
|
263
297
|
}
|
|
298
|
+
/** The non-empty segments of a `menuCategory` ("A/B", "A\\B"); a leading, trailing or doubled separator gives no segment. */
|
|
299
|
+
function getMenuCategorySegments(menuCategory) {
|
|
300
|
+
return menuCategory == null ? [] : menuCategory.split(/[\\/]+/).filter(it => it.length > 0);
|
|
301
|
+
}
|
|
302
|
+
/** WiX 3: `menuCategory` with its non-empty segments joined with `separator`, or null if it has none. */
|
|
303
|
+
function joinMenuCategory(menuCategory, separator) {
|
|
304
|
+
const segments = getMenuCategorySegments(menuCategory);
|
|
305
|
+
return segments.length === 0 ? null : segments.join(separator);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The `Directory` elements that wrap APPLICATIONFOLDER under the Program Files folder for `menuCategory`, outermost first; the
|
|
309
|
+
* innermost is `COMPANYDIR`. The legacy bundle takes the category as one name (its inline directory syntax splits it); WiX 3
|
|
310
|
+
* has no inline syntax, so there each segment is a nested directory.
|
|
311
|
+
*/
|
|
312
|
+
function getCompanyDirectories(menuCategory, isWix3) {
|
|
313
|
+
if (!isWix3) {
|
|
314
|
+
return menuCategory ? [{ id: "COMPANYDIR", name: menuCategory }] : [];
|
|
315
|
+
}
|
|
316
|
+
const segments = getMenuCategorySegments(menuCategory);
|
|
317
|
+
return segments.map((name, index) => ({
|
|
318
|
+
id: index === segments.length - 1 ? "COMPANYDIR" : getDirectoryId(`company:${segments.slice(0, index + 1).join("/")}`),
|
|
319
|
+
name,
|
|
320
|
+
}));
|
|
321
|
+
}
|
|
322
|
+
// what WiX 3 candle accepts as an identifier (CNDL0014), and its length limit (CNDL1026, an error with -wx)
|
|
323
|
+
const WIX3_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_.]*$/;
|
|
324
|
+
const WIX3_IDENTIFIER_MAX_LENGTH = 72;
|
|
325
|
+
function getHashedFileId(packagePath) {
|
|
326
|
+
return "f" + createHash("sha256").update(packagePath).digest("hex").slice(0, 16);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The `File/@Id` of a file at the root of the app dir: the file name with `_f`. WiX 3 rejects an id with other characters than
|
|
330
|
+
* letters, digits, `_` and `.` (Electron ships `vulkan-1.dll`), or longer than 72 characters, so such a file gets an id derived
|
|
331
|
+
* from its name there, like the files in subdirectories. The legacy bundle accepts these ids. File names in the app dir are not
|
|
332
|
+
* trusted input, so the id is XML-escaped like the name.
|
|
333
|
+
*/
|
|
334
|
+
function getRootFileId(packagePath, isWix3) {
|
|
335
|
+
const id = `${path.basename(packagePath)}_f`;
|
|
336
|
+
if (isWix3 && (!WIX3_IDENTIFIER.test(id) || id.length > WIX3_IDENTIFIER_MAX_LENGTH)) {
|
|
337
|
+
return getHashedFileId(packagePath);
|
|
338
|
+
}
|
|
339
|
+
return escapeForXml(id);
|
|
340
|
+
}
|
|
341
|
+
function getDirectoryId(dirName) {
|
|
342
|
+
return "d" + createHash("sha256").update(dirName).digest("hex").slice(0, 16);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* WiX 3 has no inline directory syntax (`Name="ROOT:\a\b\"`), so each directory, and each of its ancestors, is declared as a
|
|
346
|
+
* nested `Directory` under a `DirectoryRef` to `rootId`. `dirNames` are relative paths joined with `separator`.
|
|
347
|
+
*/
|
|
348
|
+
export function renderDirectoryTree(rootId, dirNames, separator, idOf) {
|
|
349
|
+
const root = { path: "", children: new Map() };
|
|
350
|
+
for (const dirName of dirNames) {
|
|
351
|
+
let node = root;
|
|
352
|
+
for (const segment of dirName.split(separator)) {
|
|
353
|
+
let child = node.children.get(segment);
|
|
354
|
+
if (child == null) {
|
|
355
|
+
child = { path: node.path === "" ? segment : `${node.path}${separator}${segment}`, children: new Map() };
|
|
356
|
+
node.children.set(segment, child);
|
|
357
|
+
}
|
|
358
|
+
node = child;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (root.children.size === 0) {
|
|
362
|
+
return [];
|
|
363
|
+
}
|
|
364
|
+
const lines = [`<DirectoryRef Id="${rootId}">`];
|
|
365
|
+
const render = (node, depth) => {
|
|
366
|
+
const indent = " ".repeat(depth);
|
|
367
|
+
for (const [name, child] of node.children) {
|
|
368
|
+
const open = `${indent}<Directory Id="${idOf(child.path)}" Name="${escapeForXml(name)}"`;
|
|
369
|
+
if (child.children.size === 0) {
|
|
370
|
+
lines.push(`${open}/>`);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
lines.push(`${open}>`);
|
|
374
|
+
render(child, depth + 1);
|
|
375
|
+
lines.push(`${indent}</Directory>`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
render(root, 1);
|
|
380
|
+
lines.push("</DirectoryRef>");
|
|
381
|
+
return lines;
|
|
382
|
+
}
|
|
264
383
|
function listToString(list, indentLevel) {
|
|
265
384
|
const space = " ".repeat(indentLevel * 2);
|
|
266
385
|
return list.join(`\n${space}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsiTarget.js","sourceRoot":"","sources":["../../../src/targets/win/MsiTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,IA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AAC,WAAW,CAAC,iCAAiC,CAAA;wBAClJ,MAAM,IAAI,GAAG,SAAS,oBAAoB,CAAA;wBAC1C,MAAM,IAAI,GAAG,SAAS,eAAe,CAAA;oBACvC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,GAAG,MAAM,KAAK,SAAS,cAAc,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAA;IACvE,CAAC;CACF;AAED,SAAS,YAAY,CAAC,IAAmB,EAAE,WAAmB;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAChC,CAAC","sourcesContent":["import { Arch, asArray, log, walk, escapeForXml } from \"builder-util\"\nimport { UUID } from \"builder-util-runtime\"\nimport { createHash } from \"crypto\"\nimport ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport path from \"path\"\nimport { Target } from \"../../core.js\"\nimport { MsiOptions } from \"../../index.js\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../../options/CommonWindowsInstallerConfiguration.js\"\nimport { normalizeExt } from \"../../platformPackager.js\"\nimport { downloadBuilderToolset } from \"../../util/electronGet.js\"\nimport { getTemplatePath } from \"../../util/pathManager.js\"\nimport { withToolsetLock } from \"../../util/toolsetLock.js\"\nimport { VmManager } from \"../../vm/vm.js\"\nimport { WineVmManager } from \"../../vm/WineVm.js\"\nimport { WinPackager } from \"../../winPackager.js\"\nimport { createStageDir, getWindowsInstallationDirName } from \"../targetUtil.js\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\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 protected readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager(this.packager.config.toolsets?.wine, this.packager.buildResourcesDir)\n\n readonly options: MsiOptions = this.packager.getOptionsForTarget<MsiOptions>(\"msi\")\n\n constructor(\n protected readonly packager: WinPackager,\n readonly outDir: string,\n name = \"msi\",\n isAsyncSupported = true\n ) {\n super(name, isAsyncSupported)\n }\n\n protected projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(this.name), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n })\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n protected get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n protected get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.emitArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\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 // wix 4.0.0.5512.2 doesn't support the arm64 architecture so default to x64 when building for arm64.\n // This will result in an x64 MSI installer that installs an arm64 version of the application. This is a\n // stopgap until the electron-builder-binaries wix version is upgraded to a version that supports arm64:\n // https://github.com/electron-userland/electron-builder/issues/6077\n const wixArch = arch == Arch.arm64 ? Arch.x64 : arch\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions))\n\n await packager.emitMsiProjectCreated(projectFile)\n\n // noinspection SpellCheckingInspection\n const vendorPath = await downloadBuilderToolset({\n releaseName: \"wix-4.0.0.5512.2\",\n filenameWithExt: \"wix-4.0.0.5512.2.7z\",\n checksums: { \"wix-4.0.0.5512.2.7z\": \"fe677fcd837b18c9b912985d91636bbd8a1e800c3b3a6a841b6f96e89624e839\" },\n })\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", wixArch === Arch.ia32 ? \"x86\" : \"x64\", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await withToolsetLock(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n })\n\n await stageDir.cleanup()\n\n await packager.signIf(artifactPath)\n\n await packager.emitArtifactBuildCompleted({\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\",\n 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 ]\n .concat(this.getCommonWixArgs())\n .concat(this.getAdditionalLightArgs())\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 getAdditionalLightArgs() {\n const args: Array<string> = []\n if (this.options.additionalLightArgs != null) {\n args.push(...this.options.additionalLightArgs)\n }\n return args\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n protected async writeManifest(appOutDir: string, wixArch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n const options = this.options\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: wixArch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n protected async getBaseOptions(commonOptions: FinalCommonWindowsInstallerOptions): Promise<any> {\n const appInfo = this.packager.appInfo\n const iconPath = await this.packager.getIconPath()\n const compression = this.packager.compression\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 return {\n ...commonOptions,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\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 // The template only declares `<Icon Id=\"${iconId}\"/>` when an icon is configured, so referencing\n // that id unconditionally makes light.exe fail with LGHT0094 for an app without an icon.\n const iconAttribute = (await this.packager.getIconPath()) == null ? \"\" : ` Icon=\"${this.iconId}\"`\n const files = (await walk(appOutDir)).map(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(\"sha256\").update(dirName).digest(\"hex\").slice(0, 16)\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(`<Directory Id=\"${directoryId}\" Name=\"${ROOT_DIR_ID}:\\\\${dirName.replace(/\\//g, \"\\\\\")}\\\\\"/>`)\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=\"${escapeForXml(fileName)}\" Source=\"$(var.appDir)${path.sep}${escapeForXml(packagePath)}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\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=\"${escapeForXml(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\"${iconAttribute}/>\\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=\"${escapeForXml(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\"${iconAttribute}>\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${escapeForXml(this.packager.appInfo.id)}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" Directory=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} <ProgId Id=\"${this.productMsiIdPrefix}.${escapeForXml(ext)}\" Advertise=\"yes\"${iconAttribute} ${\n item.description ? `Description=\"${escapeForXml(item.description)}\"` : \"\"\n }>\\n`\n result += `${fileSpace} <Extension Id=\"${escapeForXml(ext)}\" Advertise=\"yes\">\\n`\n result += `${fileSpace} <Verb Id=\"open\" Command=\"Open with ${escapeForXml(this.packager.appInfo.productName)}\" Argument=\""%1"\"/>\\n`\n result += `${fileSpace} </Extension>\\n`\n result += `${fileSpace} </ProgId>\\n`\n }\n }\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}\n"]}
|
|
1
|
+
{"version":3,"file":"MsiTarget.js","sourceRoot":"","sources":["../../../src/targets/win/MsiTarget.ts"],"names":[],"mappings":"AA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MAAM,cAAc,CAAC,CAAA;YACrC,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IACD,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACf,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC7B,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,YAAY,CAAC,IAAmB,EAAE,WAAmB;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAChC,CAAC","sourcesContent":["import { Arch, asArray, log, walk, escapeForXml } from \"builder-util\"\nimport { UUID } from \"builder-util-runtime\"\nimport { createHash } from \"crypto\"\nimport ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport path from \"path\"\nimport { Target } from \"../../core.js\"\nimport { MsiOptions } from \"../../index.js\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../../options/CommonWindowsInstallerConfiguration.js\"\nimport { normalizeExt } from \"../../platformPackager.js\"\nimport { assertNoWix4Namespaces, getCandleArch, getWixArch, getWixNamespace, getWixToolset, WixToolset } from \"../../toolsets/wix.js\"\nimport { getTemplatePath } from \"../../util/pathManager.js\"\nimport { withToolsetLock } from \"../../util/toolsetLock.js\"\nimport { VmManager } from \"../../vm/vm.js\"\nimport { WineVmManager } from \"../../vm/WineVm.js\"\nimport { WinPackager } from \"../../winPackager.js\"\nimport { createStageDir, getWindowsInstallationDirName } from \"../targetUtil.js\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\n// candle.exe and light.exe are .NET Framework programs: on macOS and Linux they run under Wine, which runs them with wine-mono (the\n// toolsets.wix notes in toolsets.md), not with a host Mono\nexport default class MsiTarget extends Target {\n protected readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager(this.packager.config.toolsets?.wine, this.packager.buildResourcesDir)\n\n readonly options: MsiOptions = this.packager.getOptionsForTarget<MsiOptions>(\"msi\")\n\n constructor(\n protected readonly packager: WinPackager,\n readonly outDir: string,\n name = \"msi\",\n isAsyncSupported = true\n ) {\n super(name, isAsyncSupported)\n }\n\n // `toolsets.wix` decides the .wxs namespace (getBaseOptions) and whether arm64 is supported, so it is resolved before the project is written\n protected readonly wixToolset = new Lazy<WixToolset>(() => getWixToolset(this.packager.config.toolsets?.wix, this.packager.buildResourcesDir))\n\n protected projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(this.name), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n })\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n protected get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n protected get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.emitArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\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 // The legacy wix 4.0.0.5512.2 bundle (`toolsets.wix: \"0.0.0\"`) doesn't support the arm64 architecture, so with it an arm64 build is\n // packaged as an x64 MSI that installs the arm64 app. The default WiX 3.14.1 bundle builds an arm64 MSI.\n // https://github.com/electron-userland/electron-builder/issues/6077\n const wixToolset = await this.wixToolset.value\n const wixArch = getWixArch(arch, wixToolset.schema)\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions))\n\n await packager.emitMsiProjectCreated(projectFile)\n // an msiProjectCreated hook written for the legacy bundle can add WiX 4 namespaces, which WiX 3 can't compile\n assertNoWix4Namespaces(await readFile(projectFile, \"utf8\"), wixToolset.schema)\n\n const vendorPath = wixToolset.path\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", getCandleArch(wixArch), `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await withToolsetLock(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n })\n\n await stageDir.cleanup()\n\n await packager.signIf(artifactPath)\n\n await packager.emitArtifactBuildCompleted({\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\",\n 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 ]\n .concat(this.getCommonWixArgs())\n .concat(this.getAdditionalLightArgs())\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 getAdditionalLightArgs() {\n const args: Array<string> = []\n if (this.options.additionalLightArgs != null) {\n args.push(...this.options.additionalLightArgs)\n }\n return args\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n protected async writeManifest(appOutDir: string, wixArch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n const options = this.options\n const isWix3 = (await this.wixToolset.value).schema === \"v3\"\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: wixArch === Arch.ia32 ? \"ProgramFilesFolder\" : \"ProgramFiles64Folder\",\n // a WiX 3 component can't override the directory of its ComponentGroup, so there each component names its own (computeFileDeclaration)\n componentGroupDirectoryAttribute: isWix3 ? \"\" : ` Directory=\"${ROOT_DIR_ID}\"`,\n // the directories between the Program Files folder and APPLICATIONFOLDER, outermost first\n companyDirectories: getCompanyDirectories(commonOptions.menuCategory, isWix3),\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n protected async getBaseOptions(commonOptions: FinalCommonWindowsInstallerOptions): Promise<any> {\n const wixSchema = (await this.wixToolset.value).schema\n const appInfo = this.packager.appInfo\n const iconPath = await this.packager.getIconPath()\n const compression = this.packager.compression\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 return {\n ...commonOptions,\n wixNamespace: getWixNamespace(wixSchema),\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n }\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n // WiX 3 has no inline directory syntax, and a component can't override the directory of its ComponentGroup there\n const isWix3 = (await this.wixToolset.value).schema === \"v3\"\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set<string>()\n const dirs: Array<string> = []\n // assigned in the map callback below, which control-flow narrowing does not see\n let startMenuCategory = null as string | null\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n // WiX 3 declares one Directory per segment, so empty segments (a leading, trailing or doubled separator) are dropped\n const menuCategory = isWix3 ? joinMenuCategory(commonOptions.menuCategory, path.sep) : commonOptions.menuCategory\n // The template only declares `<Icon Id=\"${iconId}\"/>` when an icon is configured, so referencing\n // that id unconditionally makes light.exe fail with LGHT0094 for an app without an icon.\n const iconAttribute = (await this.packager.getIconPath()) == null ? \"\" : ` Icon=\"${this.iconId}\"`\n const files = (await walk(appOutDir)).map(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 = getDirectoryId(dirName)\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n if (!isWix3) {\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 const componentDirectoryId = directoryId ?? (isWix3 ? ROOT_DIR_ID : null)\n let result = `<Component${componentDirectoryId === null ? \"\" : ` Directory=\"${componentDirectoryId}\"`}>`\n result += `\\n${fileSpace} <File Name=\"${escapeForXml(fileName)}\" Source=\"$(var.appDir)${path.sep}${escapeForXml(packagePath)}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\n } else if (directoryId === null) {\n result += ` Id=\"${getRootFileId(packagePath, isWix3)}\"`\n } else if (isWix3) {\n // WiX 3 derives an omitted File/@Id (and so the Component/@Id) from the file name alone, which collides for files of the same\n // name in different directories (LGHT0091). The component GUID is derived from the install path, not from this id.\n result += ` Id=\"${getHashedFileId(packagePath)}\"`\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=\"${escapeForXml(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\"${iconAttribute}/>\\n`\n }\n\n const hasMenuCategory = menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (menuCategory != null) {\n if (!isWix3) {\n dirs.push(`<Directory Id=\"${startMenuShortcutDirectoryId}\" Name=\"ProgramMenuFolder:\\\\${menuCategory}\\\\\"/>`)\n } else {\n startMenuCategory = menuCategory\n }\n }\n result += `${fileSpace} <Shortcut Id=\"startMenuShortcut\" Directory=\"${startMenuShortcutDirectoryId}\" Name=\"${escapeForXml(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\"${iconAttribute}>\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${escapeForXml(this.packager.appInfo.id)}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" Directory=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} <ProgId Id=\"${this.productMsiIdPrefix}.${escapeForXml(ext)}\" Advertise=\"yes\"${iconAttribute} ${\n item.description ? `Description=\"${escapeForXml(item.description)}\"` : \"\"\n }>\\n`\n result += `${fileSpace} <Extension Id=\"${escapeForXml(ext)}\" Advertise=\"yes\">\\n`\n result += `${fileSpace} <Verb Id=\"open\" Command=\"Open with ${escapeForXml(this.packager.appInfo.productName)}\" Argument=\""%1"\"/>\\n`\n result += `${fileSpace} </Extension>\\n`\n result += `${fileSpace} </ProgId>\\n`\n }\n }\n }\n\n return `${result}\\n${fileSpace}</Component>`\n })\n\n if (isWix3) {\n dirs.push(...renderDirectoryTree(ROOT_DIR_ID, dirNames, path.sep, getDirectoryId))\n if (startMenuCategory != null) {\n // the shortcut is in the innermost directory of the category, which keeps the id the shortcut and RemoveFolder use\n const categoryPath = startMenuCategory\n dirs.push(...renderDirectoryTree(\"ProgramMenuFolder\", [categoryPath], path.sep, it => (it === categoryPath ? \"AppProgramMenuDir\" : getDirectoryId(`menu:${it}`))))\n }\n }\n\n return { dirs: listToString(dirs, 2), files: listToString(files, 3) }\n }\n}\n\n/** The non-empty segments of a `menuCategory` (\"A/B\", \"A\\\\B\"); a leading, trailing or doubled separator gives no segment. */\nfunction getMenuCategorySegments(menuCategory: string | null): Array<string> {\n return menuCategory == null ? [] : menuCategory.split(/[\\\\/]+/).filter(it => it.length > 0)\n}\n\n/** WiX 3: `menuCategory` with its non-empty segments joined with `separator`, or null if it has none. */\nfunction joinMenuCategory(menuCategory: string | null, separator: string): string | null {\n const segments = getMenuCategorySegments(menuCategory)\n return segments.length === 0 ? null : segments.join(separator)\n}\n\n/**\n * The `Directory` elements that wrap APPLICATIONFOLDER under the Program Files folder for `menuCategory`, outermost first; the\n * innermost is `COMPANYDIR`. The legacy bundle takes the category as one name (its inline directory syntax splits it); WiX 3\n * has no inline syntax, so there each segment is a nested directory.\n */\nfunction getCompanyDirectories(menuCategory: string | null, isWix3: boolean): Array<{ id: string; name: string }> {\n if (!isWix3) {\n return menuCategory ? [{ id: \"COMPANYDIR\", name: menuCategory }] : []\n }\n const segments = getMenuCategorySegments(menuCategory)\n return segments.map((name, index) => ({\n id: index === segments.length - 1 ? \"COMPANYDIR\" : getDirectoryId(`company:${segments.slice(0, index + 1).join(\"/\")}`),\n name,\n }))\n}\n\n// what WiX 3 candle accepts as an identifier (CNDL0014), and its length limit (CNDL1026, an error with -wx)\nconst WIX3_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_.]*$/\nconst WIX3_IDENTIFIER_MAX_LENGTH = 72\n\nfunction getHashedFileId(packagePath: string): string {\n return \"f\" + createHash(\"sha256\").update(packagePath).digest(\"hex\").slice(0, 16)\n}\n\n/**\n * The `File/@Id` of a file at the root of the app dir: the file name with `_f`. WiX 3 rejects an id with other characters than\n * letters, digits, `_` and `.` (Electron ships `vulkan-1.dll`), or longer than 72 characters, so such a file gets an id derived\n * from its name there, like the files in subdirectories. The legacy bundle accepts these ids. File names in the app dir are not\n * trusted input, so the id is XML-escaped like the name.\n */\nfunction getRootFileId(packagePath: string, isWix3: boolean): string {\n const id = `${path.basename(packagePath)}_f`\n if (isWix3 && (!WIX3_IDENTIFIER.test(id) || id.length > WIX3_IDENTIFIER_MAX_LENGTH)) {\n return getHashedFileId(packagePath)\n }\n return escapeForXml(id)\n}\n\nfunction getDirectoryId(dirName: string): string {\n return \"d\" + createHash(\"sha256\").update(dirName).digest(\"hex\").slice(0, 16)\n}\n\n/**\n * WiX 3 has no inline directory syntax (`Name=\"ROOT:\\a\\b\\\"`), so each directory, and each of its ancestors, is declared as a\n * nested `Directory` under a `DirectoryRef` to `rootId`. `dirNames` are relative paths joined with `separator`.\n */\nexport function renderDirectoryTree(rootId: string, dirNames: Iterable<string>, separator: string, idOf: (dirName: string) => string): Array<string> {\n interface Node {\n readonly path: string\n readonly children: Map<string, Node>\n }\n const root: Node = { path: \"\", children: new Map() }\n for (const dirName of dirNames) {\n let node = root\n for (const segment of dirName.split(separator)) {\n let child = node.children.get(segment)\n if (child == null) {\n child = { path: node.path === \"\" ? segment : `${node.path}${separator}${segment}`, children: new Map() }\n node.children.set(segment, child)\n }\n node = child\n }\n }\n if (root.children.size === 0) {\n return []\n }\n const lines = [`<DirectoryRef Id=\"${rootId}\">`]\n const render = (node: Node, depth: number): void => {\n const indent = \" \".repeat(depth)\n for (const [name, child] of node.children) {\n const open = `${indent}<Directory Id=\"${idOf(child.path)}\" Name=\"${escapeForXml(name)}\"`\n if (child.children.size === 0) {\n lines.push(`${open}/>`)\n } else {\n lines.push(`${open}>`)\n render(child, depth + 1)\n lines.push(`${indent}</Directory>`)\n }\n }\n }\n render(root, 1)\n lines.push(\"</DirectoryRef>\")\n return lines\n}\n\nfunction listToString(list: Array<string>, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
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;AAMzC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAW,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
|
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,CA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AO,GAAG,OAAO,CAAC,GAAG,CAAC;YA8E/D,uBAAuB;YAOvB,mBAAmB;YASnB,oBAAoB;YAMpB,mBAAmB;IASjC,OAAO,CAAC,qCAAqC;YA2B/B,eAAe;YAgEf,kCAAkC;IAiDhD;;;;;;OAMG;YACW,qBAAqB;IAoBnC;;;;;;;OAOG;YACW,2BAA2B;YA0B3B,kBAAkB;CAmEjC"}
|
|
@@ -9,7 +9,7 @@ import { hashFile } from "../../../util/hash.js";
|
|
|
9
9
|
import { time } from "../../../util/timer.js";
|
|
10
10
|
import { verifyUpdateInstallerPublisher } from "../../../codeSign/win/verifyUpdatePublisher.js";
|
|
11
11
|
import { archive } from "../../archive.js";
|
|
12
|
-
import { appendBlockmap, configureDifferentialAwareArchiveOptions, createBlockmap, createNsisWebDifferentialUpdateInfo, locateStoredMemberRegions, toBlockMapOptions, } from "../../differentialUpdateInfoBuilder.js";
|
|
12
|
+
import { appendBlockmap, BINARY_BLOCK_MAP_FORMAT, configureDifferentialAwareArchiveOptions, createBlockmap, createNsisWebDifferentialUpdateInfo, getBlockMapFormat, installerBlockMapOptions, locateArchiveHeaderRegions, locateStoredMemberRegions, locateStoredMembers, toBlockMapOptions, } from "../../differentialUpdateInfoBuilder.js";
|
|
13
13
|
import { getWindowsInstallationAppPackageName, getWindowsInstallationDirName } from "../../targetUtil.js";
|
|
14
14
|
import { addCustomMessageFileInclude, createAddLangsMacro, LangConfigurator } from "./nsisLang.js";
|
|
15
15
|
import { computeLicensePage } from "./nsisLicense.js";
|
|
@@ -144,6 +144,8 @@ export class NsisTarget extends Target {
|
|
|
144
144
|
async buildAppPackage(appOutDir, arch, elevateHelper, fileNameSuffix = "") {
|
|
145
145
|
const packager = this.packager;
|
|
146
146
|
const isBuildDifferentialAware = this.isBuildDifferentialAware;
|
|
147
|
+
// the stored 7z header and its finer chunking only with binary block maps, so a JSON-format build stays as before
|
|
148
|
+
const isBinaryBlockMap = isBuildDifferentialAware && getBlockMapFormat(packager) === BINARY_BLOCK_MAP_FORMAT;
|
|
147
149
|
const format = this.isZipPayload ? "zip" : "7z";
|
|
148
150
|
const archiveFile = path.join(this.outDir, `${packager.appInfo.sanitizedName}-${packager.appInfo.version}-${Arch[arch]}${fileNameSuffix}.nsis.${format}`);
|
|
149
151
|
const preCompressedFileExtensions = this.getPreCompressedFileExtensions();
|
|
@@ -168,7 +170,7 @@ export class NsisTarget extends Target {
|
|
|
168
170
|
// 7za stores what a symlink points to: one that leaves the app fails the package unless fileOptions.allowExternalLinks allows it
|
|
169
171
|
archiveOptions.externalLinks = await packager.getExternalLinkPolicy();
|
|
170
172
|
const timer = time(`nsis package, ${Arch[arch]}`);
|
|
171
|
-
await archive(format, archiveFile, appOutDir, isBuildDifferentialAware ? configureDifferentialAwareArchiveOptions(archiveOptions) : archiveOptions);
|
|
173
|
+
await archive(format, archiveFile, appOutDir, isBuildDifferentialAware ? configureDifferentialAwareArchiveOptions(archiveOptions, isBinaryBlockMap) : archiveOptions);
|
|
172
174
|
timer.end();
|
|
173
175
|
// Inject elevate.exe into the archive via a temp staging dir, never by mutating appOutDir
|
|
174
176
|
// during packaging. The copy into win-unpacked is deferred until all targets finish, so
|
|
@@ -179,7 +181,10 @@ export class NsisTarget extends Target {
|
|
|
179
181
|
await elevateHelper.addToArchive(archiveFile, this, format, archiveOptions, appOutDir);
|
|
180
182
|
}
|
|
181
183
|
if (isBuildDifferentialAware && this.isWebInstaller) {
|
|
182
|
-
const regions =
|
|
184
|
+
const regions = [
|
|
185
|
+
...(await locateStoredMemberRegions(archiveFile, storedMemberFiles)),
|
|
186
|
+
...(isBinaryBlockMap ? await locateArchiveHeaderRegions(archiveFile, [archiveFile]) : []),
|
|
187
|
+
];
|
|
183
188
|
const data = await appendBlockmap(archiveFile, toBlockMapOptions(regions));
|
|
184
189
|
return {
|
|
185
190
|
fileInfo: {
|
|
@@ -404,9 +409,12 @@ export class NsisTarget extends Target {
|
|
|
404
409
|
}
|
|
405
410
|
else if (this.isBuildDifferentialAware) {
|
|
406
411
|
// Every arch package is embedded verbatim in the installer (SetCompress off), so the stored
|
|
407
|
-
// members of all of them sit verbatim in the signed installer too;
|
|
408
|
-
|
|
409
|
-
|
|
412
|
+
// members and the archive headers of all of them sit verbatim in the signed installer too;
|
|
413
|
+
// locate them there. The v3 map is additionally cut at every packed file of a stored asar.
|
|
414
|
+
const members = await locateStoredMembers(installerPath, storedMemberFiles);
|
|
415
|
+
const archiveFiles = Object.values(packageFiles).map(it => it.path);
|
|
416
|
+
const blockMapOptions = await installerBlockMapOptions(installerPath, members, archiveFiles, getBlockMapFormat(packager));
|
|
417
|
+
updateInfo = await createBlockmap(installerPath, this, packager, safeArtifactName, primaryArch, blockMapOptions);
|
|
410
418
|
}
|
|
411
419
|
// a per-machine build always packs elevate.exe (see CopyElevateHelper), unless the framework has no elevate helper
|
|
412
420
|
if (isPerMachine && packager.framework.isCopyElevateHelper) {
|