app-builder-lib 26.11.1 → 26.12.1
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/out/binDownload.js +36 -6
- package/out/binDownload.js.map +1 -1
- package/out/codeSign/codesign.js +7 -23
- package/out/codeSign/codesign.js.map +1 -1
- package/out/codeSign/macCodeSign.js +2 -2
- package/out/codeSign/macCodeSign.js.map +1 -1
- package/out/configuration.d.ts +36 -2
- package/out/configuration.js.map +1 -1
- package/out/electron/ElectronFramework.js +4 -1
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/electron/electronVersion.js +9 -4
- package/out/electron/electronVersion.js.map +1 -1
- package/out/fileMatcher.d.ts +2 -1
- package/out/fileMatcher.js +0 -1
- package/out/fileMatcher.js.map +1 -1
- package/out/fileTransformer.js +2 -1
- package/out/fileTransformer.js.map +1 -1
- package/out/forge-maker.js +6 -2
- package/out/forge-maker.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.js.map +1 -1
- package/out/linuxPackager.js +1 -1
- package/out/linuxPackager.js.map +1 -1
- package/out/mac/MacTargetHelper.d.ts +24 -0
- package/out/mac/MacTargetHelper.js +267 -0
- package/out/mac/MacTargetHelper.js.map +1 -0
- package/out/macPackager.d.ts +21 -7
- package/out/macPackager.js +218 -346
- package/out/macPackager.js.map +1 -1
- package/out/node-module-collector/moduleManager.d.ts +1 -0
- package/out/node-module-collector/moduleManager.js +2 -0
- package/out/node-module-collector/moduleManager.js.map +1 -1
- package/out/node-module-collector/nodeModulesCollector.d.ts +3 -2
- package/out/node-module-collector/nodeModulesCollector.js +23 -3
- package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.js +5 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/out/options/SnapOptions.d.ts +415 -56
- package/out/options/SnapOptions.js.map +1 -1
- package/out/options/linuxOptions.d.ts +8 -0
- package/out/options/linuxOptions.js.map +1 -1
- package/out/packager.js +4 -4
- package/out/packager.js.map +1 -1
- package/out/platformPackager.js +9 -5
- package/out/platformPackager.js.map +1 -1
- package/out/publish/PublishManager.js +2 -2
- package/out/publish/PublishManager.js.map +1 -1
- package/out/publish/updateInfoBuilder.d.ts +4 -0
- package/out/publish/updateInfoBuilder.js +14 -2
- package/out/publish/updateInfoBuilder.js.map +1 -1
- package/out/targets/AppxTarget.js +2 -1
- package/out/targets/AppxTarget.js.map +1 -1
- package/out/targets/ArchiveTarget.js +1 -1
- package/out/targets/ArchiveTarget.js.map +1 -1
- package/out/targets/FlatpakTarget.js +2 -4
- package/out/targets/FlatpakTarget.js.map +1 -1
- package/out/targets/FpmTarget.js +30 -6
- package/out/targets/FpmTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.d.ts +4 -1
- package/out/targets/LinuxTargetHelper.js +134 -8
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/MsiTarget.js +7 -4
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/MsiWrappedTarget.js +1 -1
- package/out/targets/MsiWrappedTarget.js.map +1 -1
- package/out/targets/appimage/AppImageTarget.js +2 -1
- package/out/targets/appimage/AppImageTarget.js.map +1 -1
- package/out/targets/archive.js +2 -6
- package/out/targets/archive.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +26 -16
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/nsis/nsisScriptGenerator.js +2 -3
- package/out/targets/nsis/nsisScriptGenerator.js.map +1 -1
- package/out/targets/nsis/nsisUtil.d.ts +0 -7
- package/out/targets/nsis/nsisUtil.js +5 -48
- package/out/targets/nsis/nsisUtil.js.map +1 -1
- package/out/targets/pkg.js +1 -1
- package/out/targets/pkg.js.map +1 -1
- package/out/targets/snap/SnapTarget.d.ts +36 -0
- package/out/targets/snap/SnapTarget.js +105 -0
- package/out/targets/snap/SnapTarget.js.map +1 -0
- package/out/targets/snap/core24.d.ts +52 -0
- package/out/targets/snap/core24.js +448 -0
- package/out/targets/snap/core24.js.map +1 -0
- package/out/targets/snap/coreCustom.d.ts +28 -0
- package/out/targets/snap/coreCustom.js +63 -0
- package/out/targets/snap/coreCustom.js.map +1 -0
- package/out/targets/snap/coreLegacy.d.ts +20 -0
- package/out/targets/snap/coreLegacy.js +278 -0
- package/out/targets/snap/coreLegacy.js.map +1 -0
- package/out/targets/snap/snapcraftBuilder.d.ts +39 -0
- package/out/targets/snap/snapcraftBuilder.js +419 -0
- package/out/targets/snap/snapcraftBuilder.js.map +1 -0
- package/out/toolsets/linux.d.ts +5 -0
- package/out/toolsets/linux.js +55 -23
- package/out/toolsets/linux.js.map +1 -1
- package/out/toolsets/windows.d.ts +19 -0
- package/out/toolsets/windows.js +126 -18
- package/out/toolsets/windows.js.map +1 -1
- package/out/util/bundledTool.js +2 -1
- package/out/util/bundledTool.js.map +1 -1
- package/out/util/config/config.js +4 -3
- package/out/util/config/config.js.map +1 -1
- package/out/util/electronGet.d.ts +6 -1
- package/out/util/electronGet.js +15 -7
- package/out/util/electronGet.js.map +1 -1
- package/out/util/envPath.d.ts +2 -0
- package/out/util/envPath.js +28 -0
- package/out/util/envPath.js.map +1 -0
- package/out/util/packageMetadata.js +2 -1
- package/out/util/packageMetadata.js.map +1 -1
- package/out/util/toolsetLock.d.ts +1 -0
- package/out/util/toolsetLock.js +23 -0
- package/out/util/toolsetLock.js.map +1 -0
- package/out/util/yarn.js +1 -1
- package/out/util/yarn.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/out/vm/vm.d.ts +1 -0
- package/out/vm/vm.js +18 -0
- package/out/vm/vm.js.map +1 -1
- package/package.json +9 -9
- package/scheme.json +1401 -107
- package/templates/nsis/multiUser.nsh +14 -12
- package/out/targets/snap.d.ts +0 -17
- package/out/targets/snap.js +0 -337
- package/out/targets/snap.js.map +0 -1
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SnapCore24 = void 0;
|
|
4
|
+
const builder_util_1 = require("builder-util");
|
|
5
|
+
const fs_extra_1 = require("fs-extra");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const SnapTarget_1 = require("./SnapTarget");
|
|
8
|
+
const snapcraftBuilder_1 = require("./snapcraftBuilder");
|
|
9
|
+
const yaml = require("js-yaml");
|
|
10
|
+
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
11
|
+
/** Snap build strategy for core24 — generates a native snapcraft.yaml and invokes the snapcraft CLI. */
|
|
12
|
+
class SnapCore24 extends SnapTarget_1.SnapCore {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
// browser-support is intentionally absent here; it is auto-injected in mapSnapOptionsToSnapcraftYAML
|
|
16
|
+
// when the user has not provided custom plugs, so it always lands in both root plugs and app plugs.
|
|
17
|
+
this.defaultPlugs = ["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"];
|
|
18
|
+
// Snap file hierarchy:
|
|
19
|
+
// - snap/gui/ gets automatically copied to meta/gui/ in the final snap
|
|
20
|
+
// - Desktop files in meta/gui/ are used for menu integration
|
|
21
|
+
this.configRelativePath = "snap";
|
|
22
|
+
this.guiRelativePath = path.join(this.configRelativePath, "gui");
|
|
23
|
+
}
|
|
24
|
+
async createDescriptor(arch) {
|
|
25
|
+
return await this.mapSnapOptionsToSnapcraftYAML(arch);
|
|
26
|
+
}
|
|
27
|
+
isHostMode() {
|
|
28
|
+
return this.options.useDestructiveMode === true;
|
|
29
|
+
}
|
|
30
|
+
/** Writes the snapcraft.yaml, stages app files, then invokes `buildSnap()` to run the actual snapcraft build. */
|
|
31
|
+
async buildSnap(params) {
|
|
32
|
+
const { snap, appOutDir, stageDir, artifactPath } = params;
|
|
33
|
+
const snapDirResolved = path.resolve(stageDir, this.configRelativePath);
|
|
34
|
+
const snapcraftYamlPath = path.join(snapDirResolved, "snapcraft.yaml");
|
|
35
|
+
// Create snap/gui directory for desktop files and icons
|
|
36
|
+
// Snapcraft will automatically copy snap/gui/ contents to meta/gui/ in the final snap
|
|
37
|
+
const guiOutput = path.resolve(stageDir, this.guiRelativePath);
|
|
38
|
+
await (0, fs_extra_1.mkdir)(guiOutput, { recursive: true });
|
|
39
|
+
const yamlContent = yaml.dump(snap, snapcraftBuilder_1.SNAPCRAFT_YAML_OPTIONS);
|
|
40
|
+
await (0, fs_extra_1.writeFile)(snapcraftYamlPath, yamlContent, "utf8");
|
|
41
|
+
builder_util_1.log.debug(snap, "generated snapcraft.yaml");
|
|
42
|
+
// Copy icon to snap/gui/ directory
|
|
43
|
+
// Snapcraft will automatically copy this to meta/gui/ in the final snap
|
|
44
|
+
const desktopExtraProps = {};
|
|
45
|
+
const icon = this.helper.maxIconPath;
|
|
46
|
+
if (icon) {
|
|
47
|
+
const iconFileName = `${snap.name}${path.extname(icon)}`;
|
|
48
|
+
await (0, fs_extra_1.copy)(icon, path.join(guiOutput, iconFileName));
|
|
49
|
+
// Icon path will be available at ${SNAP}/meta/gui/<icon-file> after installation
|
|
50
|
+
desktopExtraProps.Icon = `\${SNAP}/meta/gui/${iconFileName}`;
|
|
51
|
+
}
|
|
52
|
+
// Create desktop file in snap/gui/ directory
|
|
53
|
+
// Snapcraft will automatically copy this to meta/gui/ in the final snap
|
|
54
|
+
const desktopFilePath = path.join(guiOutput, `${snap.name}.desktop`);
|
|
55
|
+
await this.helper.writeDesktopEntry(this.options, this.packager.executableName + " %U", desktopFilePath, desktopExtraProps);
|
|
56
|
+
// Copy app files to the project root `app` directory so `source: app`
|
|
57
|
+
// in the generated `snapcraft.yaml` (which is under `snap/`) can be
|
|
58
|
+
// resolved by snapcraft running in the build environment.
|
|
59
|
+
const appDir = path.resolve(stageDir, "app");
|
|
60
|
+
if (path.resolve(appDir) !== path.resolve(appOutDir)) {
|
|
61
|
+
builder_util_1.log.debug({ to: builder_util_1.log.filePath(appDir), from: builder_util_1.log.filePath(appOutDir) }, "copying app files to project root app directory");
|
|
62
|
+
await (0, builder_util_1.copyDir)(appOutDir, appDir);
|
|
63
|
+
}
|
|
64
|
+
// Auto-generate `organize` mapping for the app part so top-level helper
|
|
65
|
+
// binaries and resources are placed under `app/` inside the snap. Update
|
|
66
|
+
// the already-written `snapcraft.yaml` so the build sees the mapping.
|
|
67
|
+
try {
|
|
68
|
+
const appPart = snap.parts[snap.name];
|
|
69
|
+
if (appPart) {
|
|
70
|
+
const entries = (await (0, fs_extra_1.readdir)(appOutDir)).sort();
|
|
71
|
+
const organize = appPart.organize || {};
|
|
72
|
+
for (const entry of entries) {
|
|
73
|
+
if (!entry) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (organize[entry]) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
organize[entry] = `app/${entry}`;
|
|
80
|
+
}
|
|
81
|
+
appPart.organize = organize;
|
|
82
|
+
const updatedYaml = yaml.dump(snap, snapcraftBuilder_1.SNAPCRAFT_YAML_OPTIONS);
|
|
83
|
+
await (0, fs_extra_1.writeFile)(snapcraftYamlPath, updatedYaml, "utf8");
|
|
84
|
+
builder_util_1.log.debug({ organize }, "updated snapcraft.yaml with organize mapping");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
builder_util_1.log.warn({ error: e.message }, "failed to generate and update organize mapping");
|
|
89
|
+
}
|
|
90
|
+
const buildMode = {
|
|
91
|
+
useLXD: this.options.useLXD === true,
|
|
92
|
+
useMultipass: this.options.useMultipass === true,
|
|
93
|
+
useDestructiveMode: this.options.useDestructiveMode === true,
|
|
94
|
+
remoteBuild: this.options.remoteBuild || undefined,
|
|
95
|
+
};
|
|
96
|
+
if (this.packager.packagerOptions.effectiveOptionComputed != null) {
|
|
97
|
+
const shouldSkip = await this.packager.packagerOptions.effectiveOptionComputed({ snap, ...buildMode });
|
|
98
|
+
if (shouldSkip) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const rootOptions = this.packager.config.snapcraft;
|
|
103
|
+
await (0, snapcraftBuilder_1.buildSnap)({
|
|
104
|
+
snapcraftConfig: snap,
|
|
105
|
+
artifactPath,
|
|
106
|
+
stageDir,
|
|
107
|
+
packager: this.packager,
|
|
108
|
+
cscLink: rootOptions === null || rootOptions === void 0 ? void 0 : rootOptions.cscLink,
|
|
109
|
+
...buildMode,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/** Converts `SnapOptions24` into a fully resolved `SnapcraftYAML` descriptor for the given architecture. */
|
|
113
|
+
async mapSnapOptionsToSnapcraftYAML(arch) {
|
|
114
|
+
var _a, _b, _c, _d;
|
|
115
|
+
const appInfo = this.packager.appInfo;
|
|
116
|
+
const appName = this.packager.executableName.toLowerCase();
|
|
117
|
+
const options = this.options;
|
|
118
|
+
// Default to ["gnome"] in normal builds; no extensions in host/destructive-mode (where the
|
|
119
|
+
// gnome extension is incompatible). Throw if the user explicitly includes "gnome" in host mode.
|
|
120
|
+
const hostMode = this.isHostMode();
|
|
121
|
+
const extensionsList = options.extensions != null ? [...options.extensions] : hostMode ? [] : ["gnome"];
|
|
122
|
+
if (hostMode && extensionsList.includes("gnome")) {
|
|
123
|
+
throw new builder_util_1.InvalidConfigurationError(`The "gnome" snapcraft extension is incompatible with host/destructive-mode builds.\n` +
|
|
124
|
+
`In this mode snapcraft cannot resolve the extension's command-chain source ` +
|
|
125
|
+
`(/usr/share/snapcraft/extensions/desktop/command-chain) and will fail.\n\n` +
|
|
126
|
+
`To resolve this, choose one of:\n` +
|
|
127
|
+
` 1. Remove "gnome" from snapcraft.core24.extensions (or set it to []) and add any\n` +
|
|
128
|
+
` required stage-packages manually.\n` +
|
|
129
|
+
` 2. Switch to an isolated build environment by setting snapcraft.core24.useLXD: true\n` +
|
|
130
|
+
` or snapcraft.core24.useMultipass: true instead of useDestructiveMode.\n\n` +
|
|
131
|
+
`See: https://snapcraft.io/docs/gnome-extension`);
|
|
132
|
+
}
|
|
133
|
+
const resolvedExtensions = extensionsList.length > 0 ? extensionsList : undefined;
|
|
134
|
+
const useGnomeExtension = extensionsList.includes("gnome");
|
|
135
|
+
// Create the app part
|
|
136
|
+
const appPart = {
|
|
137
|
+
plugin: "dump",
|
|
138
|
+
source: "app",
|
|
139
|
+
"build-packages": ((_a = options.buildPackages) === null || _a === void 0 ? void 0 : _a.length) ? options.buildPackages : undefined,
|
|
140
|
+
"stage-packages": this.expandDefaultsInArray(options.stagePackages, snapcraftBuilder_1.DEFAULT_STAGE_PACKAGES),
|
|
141
|
+
after: this.expandDefaultsInArray(options.after, []),
|
|
142
|
+
stage: ((_b = options.appPartStage) === null || _b === void 0 ? void 0 : _b.length) ? options.appPartStage : undefined,
|
|
143
|
+
};
|
|
144
|
+
// Process plugs and slots
|
|
145
|
+
// When using GNOME extension, we don't need to manually configure content snaps
|
|
146
|
+
// The extension will handle: gnome-46-2404, gtk-3-themes, icon-themes, sound-themes
|
|
147
|
+
let rootPlugs;
|
|
148
|
+
let appPlugs;
|
|
149
|
+
if (useGnomeExtension) {
|
|
150
|
+
// With GNOME extension, only process user-provided custom plugs
|
|
151
|
+
const result = options.plugs ? this.processPlugOrSlots(options.plugs) : { root: undefined, app: undefined };
|
|
152
|
+
rootPlugs = result.root;
|
|
153
|
+
// Extension automatically adds common plugs, so we only add custom ones
|
|
154
|
+
appPlugs = result.app;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
// Without GNOME extension, we need manual content snaps
|
|
158
|
+
const defaultRootPlugs = {
|
|
159
|
+
"gtk-3-themes": {
|
|
160
|
+
interface: "content",
|
|
161
|
+
target: "$SNAP/data-dir/themes",
|
|
162
|
+
"default-provider": "gtk-common-themes",
|
|
163
|
+
},
|
|
164
|
+
"icon-themes": {
|
|
165
|
+
interface: "content",
|
|
166
|
+
target: "$SNAP/data-dir/icons",
|
|
167
|
+
"default-provider": "gtk-common-themes",
|
|
168
|
+
},
|
|
169
|
+
"sound-themes": {
|
|
170
|
+
interface: "content",
|
|
171
|
+
target: "$SNAP/data-dir/sounds",
|
|
172
|
+
"default-provider": "gtk-common-themes",
|
|
173
|
+
},
|
|
174
|
+
"gnome-46-2404": {
|
|
175
|
+
interface: "content",
|
|
176
|
+
target: "$SNAP/gnome-platform",
|
|
177
|
+
"default-provider": "gnome-46-2404",
|
|
178
|
+
},
|
|
179
|
+
"gpu-2404": {
|
|
180
|
+
interface: "content",
|
|
181
|
+
target: "$SNAP/gpu-2404",
|
|
182
|
+
"default-provider": "mesa-2404",
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
const result = options.plugs
|
|
186
|
+
? this.processPlugOrSlots(options.plugs)
|
|
187
|
+
: hostMode
|
|
188
|
+
? { root: undefined, app: this.defaultPlugs }
|
|
189
|
+
: {
|
|
190
|
+
root: defaultRootPlugs,
|
|
191
|
+
app: this.defaultPlugs,
|
|
192
|
+
};
|
|
193
|
+
rootPlugs = result.root;
|
|
194
|
+
appPlugs = result.app;
|
|
195
|
+
}
|
|
196
|
+
// Always add browser-support with allow-sandbox so Chromium's internal sandbox
|
|
197
|
+
// can create user namespaces under strict confinement. Without allow-sandbox: true
|
|
198
|
+
// the app crashes immediately with "FATAL: Permission denied (13)" in credentials.cc.
|
|
199
|
+
// Skip the injection only when the user has explicitly provided their own plugs
|
|
200
|
+
// (they are responsible for including browser-support in that case).
|
|
201
|
+
if (!options.plugs) {
|
|
202
|
+
rootPlugs = { ...rootPlugs, "browser-support": { interface: "browser-support", "allow-sandbox": true } };
|
|
203
|
+
if (!(appPlugs === null || appPlugs === void 0 ? void 0 : appPlugs.includes("browser-support"))) {
|
|
204
|
+
appPlugs = [...(appPlugs !== null && appPlugs !== void 0 ? appPlugs : []), "browser-support"];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const { root: rootSlots, app: appSlots } = options.slots ? this.processPlugOrSlots(options.slots) : { root: undefined, app: undefined };
|
|
208
|
+
// Build the effective arg list for the snap command.
|
|
209
|
+
// Start with any user-supplied executableArgs, then conditionally add --no-sandbox
|
|
210
|
+
// if browser-support with allow-sandbox:true is not present in the resolved plugs
|
|
211
|
+
// (mirrors the same logic in SnapCoreLegacy.buildSnap).
|
|
212
|
+
const extraArgs = [...((_c = this.options.executableArgs) !== null && _c !== void 0 ? _c : [])];
|
|
213
|
+
if (this.options.forceX11 === true) {
|
|
214
|
+
if (!extraArgs.includes("--ozone-platform=x11")) {
|
|
215
|
+
extraArgs.push("--ozone-platform=x11");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (this.helper.isElectronVersionGreaterOrEqualThan("5.0.0") && !this.isBrowserSandboxAllowed(rootPlugs)) {
|
|
219
|
+
if (!extraArgs.includes("--no-sandbox")) {
|
|
220
|
+
extraArgs.push("--no-sandbox");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const commandSuffix = extraArgs.length > 0 ? ` ${extraArgs.join(" ")}` : "";
|
|
224
|
+
// Create the app configuration
|
|
225
|
+
const app = {
|
|
226
|
+
command: `app/${this.packager.executableName}${commandSuffix}`,
|
|
227
|
+
"command-chain": undefined, // explicitly undefined so removeNullish strips it; extensions supply their own command-chain
|
|
228
|
+
plugs: appPlugs,
|
|
229
|
+
slots: appSlots,
|
|
230
|
+
autostart: options.autoStart ? `${appName}.desktop` : undefined,
|
|
231
|
+
desktop: `meta/gui/${appName}.desktop`,
|
|
232
|
+
extensions: resolvedExtensions,
|
|
233
|
+
};
|
|
234
|
+
// Icon path — build-time relative path so snapcraft can find the file in snap/gui/
|
|
235
|
+
await this.helper.icons;
|
|
236
|
+
const iconPath = this.helper.maxIconPath != null ? `snap/gui/${appName}${path.extname(this.helper.maxIconPath)}` : undefined;
|
|
237
|
+
// Process hooks if configured
|
|
238
|
+
const hooksConfig = options.hooks;
|
|
239
|
+
const hooks = hooksConfig ? await this.processHooks(hooksConfig) : undefined;
|
|
240
|
+
// Parts configuration - the extension automatically adds a gnome/sdk part
|
|
241
|
+
// Don't manually add desktop-launch when using the extension
|
|
242
|
+
const parts = {
|
|
243
|
+
[appName]: appPart,
|
|
244
|
+
};
|
|
245
|
+
// Note: `organize` will be generated later in `buildSnap` based on the
|
|
246
|
+
// actual contents of the built app directory so helper binaries and
|
|
247
|
+
// resources are automatically moved under `app/` in the snap.
|
|
248
|
+
// Build the snapcraft configuration
|
|
249
|
+
const snapcraft = {
|
|
250
|
+
// Required fields
|
|
251
|
+
name: appName,
|
|
252
|
+
base: "core24",
|
|
253
|
+
confinement: options.confinement || "strict",
|
|
254
|
+
parts: parts,
|
|
255
|
+
// Architecture/Platform — only needed for cross-compilation; snapcraft 8
|
|
256
|
+
// defaults to host arch and snapcraft 7 rejects this field entirely.
|
|
257
|
+
...(arch !== (0, builder_util_1.archFromString)(process.arch)
|
|
258
|
+
? {
|
|
259
|
+
platforms: {
|
|
260
|
+
[(0, builder_util_1.toLinuxArchString)(arch, "snap")]: {
|
|
261
|
+
"build-for": (0, builder_util_1.toLinuxArchString)(arch, "snap"),
|
|
262
|
+
"build-on": (0, builder_util_1.toLinuxArchString)((0, builder_util_1.archFromString)(process.arch), "snap"),
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
}
|
|
266
|
+
: {}),
|
|
267
|
+
// Metadata - with fallbacks from appInfo
|
|
268
|
+
version: appInfo.version,
|
|
269
|
+
summary: options.summary || appInfo.productName,
|
|
270
|
+
description: this.helper.getDescription(options),
|
|
271
|
+
grade: options.grade || "stable",
|
|
272
|
+
title: options.title || appInfo.productName,
|
|
273
|
+
icon: iconPath,
|
|
274
|
+
// Build configuration
|
|
275
|
+
compression: options.compression || undefined,
|
|
276
|
+
assumes: this.normalizeAssumesList(options.assumes),
|
|
277
|
+
// Environment
|
|
278
|
+
environment: this.buildEnvironment(options),
|
|
279
|
+
// User-supplied layout always wins. Without gnome extension and not in host mode, fall back to content-snap defaults.
|
|
280
|
+
layout: (_d = options.layout) !== null && _d !== void 0 ? _d : (useGnomeExtension || hostMode ? undefined : this.buildDefaultLayout(options)),
|
|
281
|
+
// Interfaces
|
|
282
|
+
plugs: rootPlugs,
|
|
283
|
+
slots: rootSlots,
|
|
284
|
+
// Hooks
|
|
285
|
+
hooks: hooks,
|
|
286
|
+
// Apps
|
|
287
|
+
apps: {
|
|
288
|
+
[appName]: app,
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
return (0, builder_util_1.removeNullish)(snapcraft);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Build environment variables with proper defaults
|
|
295
|
+
*/
|
|
296
|
+
buildEnvironment(options) {
|
|
297
|
+
var _a;
|
|
298
|
+
const env = {};
|
|
299
|
+
// Add default TMPDIR for Electron/Chromium apps
|
|
300
|
+
if (!((_a = options.environment) === null || _a === void 0 ? void 0 : _a.TMPDIR)) {
|
|
301
|
+
env.TMPDIR = "$XDG_RUNTIME_DIR";
|
|
302
|
+
}
|
|
303
|
+
if (options.environment) {
|
|
304
|
+
(0, builder_util_runtime_1.deepAssign)(env, options.environment);
|
|
305
|
+
}
|
|
306
|
+
return Object.keys(env).length > 0 ? env : undefined;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Build default layout for core24 with GNOME platform content snaps (non-extension mode)
|
|
310
|
+
* This allows the app to access libraries from the gnome-46-2404 and mesa-2404 content snaps
|
|
311
|
+
*/
|
|
312
|
+
buildDefaultLayout(options) {
|
|
313
|
+
// If user provides custom layout, use that instead
|
|
314
|
+
if (options.layout) {
|
|
315
|
+
return options.layout;
|
|
316
|
+
}
|
|
317
|
+
// Default layout for core24 Electron apps using GNOME content snaps WITHOUT extension
|
|
318
|
+
return {
|
|
319
|
+
"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.0": {
|
|
320
|
+
bind: "$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.0",
|
|
321
|
+
},
|
|
322
|
+
"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1": {
|
|
323
|
+
bind: "$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1",
|
|
324
|
+
},
|
|
325
|
+
"/usr/share/xml/iso-codes": {
|
|
326
|
+
bind: "$SNAP/gnome-platform/usr/share/xml/iso-codes",
|
|
327
|
+
},
|
|
328
|
+
"/usr/share/libdrm": {
|
|
329
|
+
bind: "$SNAP/gpu-2404/libdrm",
|
|
330
|
+
},
|
|
331
|
+
"/usr/share/drirc.d": {
|
|
332
|
+
symlink: "$SNAP/gpu-2404/drirc.d",
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Process hooks directory into hook definitions
|
|
338
|
+
*/
|
|
339
|
+
async processHooks(hooksPath) {
|
|
340
|
+
try {
|
|
341
|
+
const buildResourcesDir = this.packager.buildResourcesDir;
|
|
342
|
+
const hooksDir = path.resolve(buildResourcesDir, hooksPath);
|
|
343
|
+
if (!hooksDir.startsWith(buildResourcesDir + path.sep) && hooksDir !== buildResourcesDir) {
|
|
344
|
+
throw new builder_util_1.InvalidConfigurationError(`snapcraft.core24.hooks must resolve within the build resources directory (got "${hooksDir}")`);
|
|
345
|
+
}
|
|
346
|
+
const hookFiles = await (0, fs_extra_1.readdir)(hooksDir);
|
|
347
|
+
if (hookFiles.length === 0) {
|
|
348
|
+
return undefined;
|
|
349
|
+
}
|
|
350
|
+
const hooks = {};
|
|
351
|
+
for (const hookFile of hookFiles) {
|
|
352
|
+
const hookName = path.basename(hookFile, path.extname(hookFile));
|
|
353
|
+
if (!(0, builder_util_runtime_1.isValidKey)(hookName)) {
|
|
354
|
+
throw new builder_util_1.InvalidConfigurationError(`Invalid hook name: ${hookName}`);
|
|
355
|
+
}
|
|
356
|
+
hooks[hookName] = {
|
|
357
|
+
// Hook definitions will be populated by snapcraft from the files
|
|
358
|
+
// Just register that these hooks exist
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
return hooks;
|
|
362
|
+
}
|
|
363
|
+
catch (e) {
|
|
364
|
+
builder_util_1.log.error({ message: e.message }, "error processing Snap hooks directory");
|
|
365
|
+
throw e;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Normalize assumes list (can be string or array)
|
|
370
|
+
*/
|
|
371
|
+
normalizeAssumesList(assumes) {
|
|
372
|
+
if (!assumes) {
|
|
373
|
+
return undefined;
|
|
374
|
+
}
|
|
375
|
+
if (typeof assumes === "string") {
|
|
376
|
+
return [assumes];
|
|
377
|
+
}
|
|
378
|
+
return assumes.length > 0 ? assumes : undefined;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Process plugs or slots into root-level definitions and app-level references
|
|
382
|
+
*/
|
|
383
|
+
processPlugOrSlots(items) {
|
|
384
|
+
if (!items || (Array.isArray(items) && items.length === 0)) {
|
|
385
|
+
return { root: undefined, app: undefined };
|
|
386
|
+
}
|
|
387
|
+
const root = {};
|
|
388
|
+
const app = [];
|
|
389
|
+
// Handle single descriptor object
|
|
390
|
+
if (!Array.isArray(items)) {
|
|
391
|
+
Object.entries(items).forEach(([name, config]) => {
|
|
392
|
+
if (!(0, builder_util_runtime_1.isValidKey)(name)) {
|
|
393
|
+
throw new Error(`Invalid plug/slot name: ${name}`);
|
|
394
|
+
}
|
|
395
|
+
root[name] = config;
|
|
396
|
+
app.push(name);
|
|
397
|
+
});
|
|
398
|
+
return { root, app };
|
|
399
|
+
}
|
|
400
|
+
// Handle array - support "default" keyword
|
|
401
|
+
const processedItems = this.expandDefaultsInArray(items, this.defaultPlugs);
|
|
402
|
+
for (const item of processedItems !== null && processedItems !== void 0 ? processedItems : []) {
|
|
403
|
+
if (typeof item === "string") {
|
|
404
|
+
// Simple string reference
|
|
405
|
+
app.push(item);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
// Descriptor object with configuration
|
|
409
|
+
Object.entries(item).forEach(([name, config]) => {
|
|
410
|
+
if (!(0, builder_util_runtime_1.isValidKey)(name)) {
|
|
411
|
+
throw new Error(`Invalid plug/slot name: ${name}`);
|
|
412
|
+
}
|
|
413
|
+
root[name] = config;
|
|
414
|
+
app.push(name);
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return { root: Object.keys(root).length > 0 ? root : undefined, app: app.length > 0 ? app : undefined };
|
|
419
|
+
}
|
|
420
|
+
isBrowserSandboxAllowed(plugs) {
|
|
421
|
+
if (!plugs) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
for (const plug of Object.values(plugs)) {
|
|
425
|
+
if ((plug === null || plug === void 0 ? void 0 : plug.interface) === "browser-support" && plug["allow-sandbox"] === true) {
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Expand "default" keyword in arrays of anything
|
|
433
|
+
*/
|
|
434
|
+
expandDefaultsInArray(items, defaults) {
|
|
435
|
+
const result = [];
|
|
436
|
+
for (const item of items !== null && items !== void 0 ? items : []) {
|
|
437
|
+
if (typeof item === "string" && item === "default") {
|
|
438
|
+
result.push(...defaults);
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
result.push(item);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return result.length > 0 ? result : undefined;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
exports.SnapCore24 = SnapCore24;
|
|
448
|
+
//# sourceMappingURL=core24.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core24.js","sourceRoot":"","sources":["../../../src/targets/snap/core24.ts"],"names":[],"mappings":";;;AAAA,+CAA8H;AAC9H,uCAA0D;AAC1D,6BAA4B;AAE5B,6CAAuC;AAEvC,yDAA8F;AAC9F,gCAA+B;AAC/B,+DAAsE;AAEtE,wGAAwG;AACxG,M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SAAS,MAAK,iBAAiB,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE,CAAC;gBAC5E,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAI,KAAoB,EAAE,QAAa;QAClE,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,EAAE,CAAC;YAC/B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACnD,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA;YAC1B,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/C,CAAC;CACF;AAveD,gCAueC","sourcesContent":["import { Arch, archFromString, copyDir, InvalidConfigurationError, log, removeNullish, toLinuxArchString } from \"builder-util\"\nimport { copy, mkdir, readdir, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { PlugDescriptor, SlotDescriptor, SnapOptions24, SnapcraftOptions } from \"../../options/SnapOptions\"\nimport { SnapCore } from \"./SnapTarget\"\nimport { App, Part, SnapcraftYAML } from \"./snapcraft\"\nimport { buildSnap, DEFAULT_STAGE_PACKAGES, SNAPCRAFT_YAML_OPTIONS } from \"./snapcraftBuilder\"\nimport * as yaml from \"js-yaml\"\nimport { deepAssign, isValidKey, Nullish } from \"builder-util-runtime\"\n\n/** Snap build strategy for core24 — generates a native snapcraft.yaml and invokes the snapcraft CLI. */\nexport class SnapCore24 extends SnapCore<SnapOptions24> {\n // browser-support is intentionally absent here; it is auto-injected in mapSnapOptionsToSnapcraftYAML\n // when the user has not provided custom plugs, so it always lands in both root plugs and app plugs.\n defaultPlugs = [\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]\n\n // Snap file hierarchy:\n // - snap/gui/ gets automatically copied to meta/gui/ in the final snap\n // - Desktop files in meta/gui/ are used for menu integration\n readonly configRelativePath = \"snap\"\n readonly guiRelativePath = path.join(this.configRelativePath, \"gui\")\n\n async createDescriptor(arch: Arch): Promise<SnapcraftYAML> {\n return await this.mapSnapOptionsToSnapcraftYAML(arch)\n }\n\n private isHostMode(): boolean {\n return this.options.useDestructiveMode === true\n }\n\n /** Writes the snapcraft.yaml, stages app files, then invokes `buildSnap()` to run the actual snapcraft build. */\n async buildSnap(params: { snap: SnapcraftYAML; appOutDir: string; stageDir: string; snapArch: Arch; artifactPath: string }): Promise<void> {\n const { snap, appOutDir, stageDir, artifactPath } = params\n\n const snapDirResolved = path.resolve(stageDir, this.configRelativePath)\n const snapcraftYamlPath = path.join(snapDirResolved, \"snapcraft.yaml\")\n\n // Create snap/gui directory for desktop files and icons\n // Snapcraft will automatically copy snap/gui/ contents to meta/gui/ in the final snap\n const guiOutput = path.resolve(stageDir, this.guiRelativePath)\n await mkdir(guiOutput, { recursive: true })\n\n const yamlContent = yaml.dump(snap, SNAPCRAFT_YAML_OPTIONS)\n await writeFile(snapcraftYamlPath, yamlContent, \"utf8\")\n log.debug(snap, \"generated snapcraft.yaml\")\n\n // Copy icon to snap/gui/ directory\n // Snapcraft will automatically copy this to meta/gui/ in the final snap\n const desktopExtraProps: Record<string, string> = {}\n const icon = this.helper.maxIconPath\n if (icon) {\n const iconFileName = `${snap.name}${path.extname(icon)}`\n await copy(icon, path.join(guiOutput, iconFileName))\n // Icon path will be available at ${SNAP}/meta/gui/<icon-file> after installation\n desktopExtraProps.Icon = `\\${SNAP}/meta/gui/${iconFileName}`\n }\n\n // Create desktop file in snap/gui/ directory\n // Snapcraft will automatically copy this to meta/gui/ in the final snap\n const desktopFilePath = path.join(guiOutput, `${snap.name}.desktop`)\n await this.helper.writeDesktopEntry(this.options, this.packager.executableName + \" %U\", desktopFilePath, desktopExtraProps)\n\n // Copy app files to the project root `app` directory so `source: app`\n // in the generated `snapcraft.yaml` (which is under `snap/`) can be\n // resolved by snapcraft running in the build environment.\n const appDir = path.resolve(stageDir, \"app\")\n if (path.resolve(appDir) !== path.resolve(appOutDir)) {\n log.debug({ to: log.filePath(appDir), from: log.filePath(appOutDir) }, \"copying app files to project root app directory\")\n await copyDir(appOutDir, appDir)\n }\n\n // Auto-generate `organize` mapping for the app part so top-level helper\n // binaries and resources are placed under `app/` inside the snap. Update\n // the already-written `snapcraft.yaml` so the build sees the mapping.\n try {\n const appPart = snap.parts[snap.name]\n if (appPart) {\n const entries = (await readdir(appOutDir)).sort()\n const organize: Record<string, string> = (appPart.organize as Record<string, string>) || {}\n for (const entry of entries) {\n if (!entry) {\n continue\n }\n if (organize[entry]) {\n continue\n }\n organize[entry] = `app/${entry}`\n }\n appPart.organize = organize\n\n const updatedYaml = yaml.dump(snap, SNAPCRAFT_YAML_OPTIONS)\n await writeFile(snapcraftYamlPath, updatedYaml, \"utf8\")\n log.debug({ organize }, \"updated snapcraft.yaml with organize mapping\")\n }\n } catch (e: any) {\n log.warn({ error: e.message }, \"failed to generate and update organize mapping\")\n }\n\n const buildMode = {\n useLXD: this.options.useLXD === true,\n useMultipass: this.options.useMultipass === true,\n useDestructiveMode: this.options.useDestructiveMode === true,\n remoteBuild: this.options.remoteBuild || undefined,\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null) {\n const shouldSkip = await this.packager.packagerOptions.effectiveOptionComputed({ snap, ...buildMode })\n if (shouldSkip) {\n return\n }\n }\n\n const rootOptions = this.packager.config.snapcraft as SnapcraftOptions | null | undefined\n await buildSnap({\n snapcraftConfig: snap,\n artifactPath,\n stageDir,\n packager: this.packager,\n cscLink: rootOptions?.cscLink,\n ...buildMode,\n })\n }\n\n /** Converts `SnapOptions24` into a fully resolved `SnapcraftYAML` descriptor for the given architecture. */\n async mapSnapOptionsToSnapcraftYAML(arch: Arch): Promise<SnapcraftYAML> {\n const appInfo = this.packager.appInfo\n const appName = this.packager.executableName.toLowerCase()\n const options = this.options\n\n // Default to [\"gnome\"] in normal builds; no extensions in host/destructive-mode (where the\n // gnome extension is incompatible). Throw if the user explicitly includes \"gnome\" in host mode.\n const hostMode = this.isHostMode()\n const extensionsList: string[] = options.extensions != null ? [...options.extensions] : hostMode ? [] : [\"gnome\"]\n if (hostMode && extensionsList.includes(\"gnome\")) {\n throw new InvalidConfigurationError(\n `The \"gnome\" snapcraft extension is incompatible with host/destructive-mode builds.\\n` +\n `In this mode snapcraft cannot resolve the extension's command-chain source ` +\n `(/usr/share/snapcraft/extensions/desktop/command-chain) and will fail.\\n\\n` +\n `To resolve this, choose one of:\\n` +\n ` 1. Remove \"gnome\" from snapcraft.core24.extensions (or set it to []) and add any\\n` +\n ` required stage-packages manually.\\n` +\n ` 2. Switch to an isolated build environment by setting snapcraft.core24.useLXD: true\\n` +\n ` or snapcraft.core24.useMultipass: true instead of useDestructiveMode.\\n\\n` +\n `See: https://snapcraft.io/docs/gnome-extension`\n )\n }\n const resolvedExtensions = extensionsList.length > 0 ? extensionsList : undefined\n const useGnomeExtension = extensionsList.includes(\"gnome\")\n\n // Create the app part\n const appPart: Part = {\n plugin: \"dump\",\n source: \"app\",\n \"build-packages\": options.buildPackages?.length ? options.buildPackages : undefined,\n \"stage-packages\": this.expandDefaultsInArray(options.stagePackages, DEFAULT_STAGE_PACKAGES),\n after: this.expandDefaultsInArray(options.after, []),\n stage: options.appPartStage?.length ? options.appPartStage : undefined,\n }\n\n // Process plugs and slots\n // When using GNOME extension, we don't need to manually configure content snaps\n // The extension will handle: gnome-46-2404, gtk-3-themes, icon-themes, sound-themes\n let rootPlugs: Record<string, any> | undefined\n let appPlugs: string[] | undefined\n\n if (useGnomeExtension) {\n // With GNOME extension, only process user-provided custom plugs\n const result = options.plugs ? this.processPlugOrSlots(options.plugs) : { root: undefined, app: undefined }\n rootPlugs = result.root\n // Extension automatically adds common plugs, so we only add custom ones\n appPlugs = result.app\n } else {\n // Without GNOME extension, we need manual content snaps\n const defaultRootPlugs: Record<string, any> = {\n \"gtk-3-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/themes\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"icon-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/icons\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"sound-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/sounds\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"gnome-46-2404\": {\n interface: \"content\",\n target: \"$SNAP/gnome-platform\",\n \"default-provider\": \"gnome-46-2404\",\n },\n \"gpu-2404\": {\n interface: \"content\",\n target: \"$SNAP/gpu-2404\",\n \"default-provider\": \"mesa-2404\",\n },\n }\n\n const result = options.plugs\n ? this.processPlugOrSlots(options.plugs)\n : hostMode\n ? { root: undefined, app: this.defaultPlugs }\n : {\n root: defaultRootPlugs,\n app: this.defaultPlugs,\n }\n rootPlugs = result.root\n appPlugs = result.app\n }\n\n // Always add browser-support with allow-sandbox so Chromium's internal sandbox\n // can create user namespaces under strict confinement. Without allow-sandbox: true\n // the app crashes immediately with \"FATAL: Permission denied (13)\" in credentials.cc.\n // Skip the injection only when the user has explicitly provided their own plugs\n // (they are responsible for including browser-support in that case).\n if (!options.plugs) {\n rootPlugs = { ...rootPlugs, \"browser-support\": { interface: \"browser-support\", \"allow-sandbox\": true } }\n if (!appPlugs?.includes(\"browser-support\")) {\n appPlugs = [...(appPlugs ?? []), \"browser-support\"]\n }\n }\n\n const { root: rootSlots, app: appSlots } = options.slots ? this.processPlugOrSlots(options.slots) : { root: undefined, app: undefined }\n\n // Build the effective arg list for the snap command.\n // Start with any user-supplied executableArgs, then conditionally add --no-sandbox\n // if browser-support with allow-sandbox:true is not present in the resolved plugs\n // (mirrors the same logic in SnapCoreLegacy.buildSnap).\n const extraArgs: string[] = [...(this.options.executableArgs ?? [])]\n if (this.options.forceX11 === true) {\n if (!extraArgs.includes(\"--ozone-platform=x11\")) {\n extraArgs.push(\"--ozone-platform=x11\")\n }\n }\n if (this.helper.isElectronVersionGreaterOrEqualThan(\"5.0.0\") && !this.isBrowserSandboxAllowed(rootPlugs)) {\n if (!extraArgs.includes(\"--no-sandbox\")) {\n extraArgs.push(\"--no-sandbox\")\n }\n }\n const commandSuffix = extraArgs.length > 0 ? ` ${extraArgs.join(\" \")}` : \"\"\n\n // Create the app configuration\n const app: App = {\n command: `app/${this.packager.executableName}${commandSuffix}`,\n \"command-chain\": undefined, // explicitly undefined so removeNullish strips it; extensions supply their own command-chain\n plugs: appPlugs,\n slots: appSlots,\n autostart: options.autoStart ? `${appName}.desktop` : undefined,\n desktop: `meta/gui/${appName}.desktop`,\n extensions: resolvedExtensions,\n }\n\n // Icon path — build-time relative path so snapcraft can find the file in snap/gui/\n await this.helper.icons\n const iconPath = this.helper.maxIconPath != null ? `snap/gui/${appName}${path.extname(this.helper.maxIconPath)}` : undefined\n\n // Process hooks if configured\n const hooksConfig = options.hooks\n const hooks = hooksConfig ? await this.processHooks(hooksConfig) : undefined\n\n // Parts configuration - the extension automatically adds a gnome/sdk part\n // Don't manually add desktop-launch when using the extension\n const parts: Record<string, Part> = {\n [appName]: appPart,\n }\n\n // Note: `organize` will be generated later in `buildSnap` based on the\n // actual contents of the built app directory so helper binaries and\n // resources are automatically moved under `app/` in the snap.\n\n // Build the snapcraft configuration\n const snapcraft: SnapcraftYAML = {\n // Required fields\n name: appName,\n base: \"core24\",\n confinement: options.confinement || \"strict\",\n parts: parts,\n\n // Architecture/Platform — only needed for cross-compilation; snapcraft 8\n // defaults to host arch and snapcraft 7 rejects this field entirely.\n ...(arch !== archFromString(process.arch)\n ? {\n platforms: {\n [toLinuxArchString(arch, \"snap\")]: {\n \"build-for\": toLinuxArchString(arch, \"snap\"),\n \"build-on\": toLinuxArchString(archFromString(process.arch), \"snap\"),\n },\n },\n }\n : {}),\n\n // Metadata - with fallbacks from appInfo\n version: appInfo.version,\n summary: options.summary || appInfo.productName,\n description: this.helper.getDescription(options),\n grade: options.grade || \"stable\",\n title: options.title || appInfo.productName,\n icon: iconPath,\n\n // Build configuration\n compression: options.compression || undefined,\n assumes: this.normalizeAssumesList(options.assumes),\n\n // Environment\n environment: this.buildEnvironment(options),\n\n // User-supplied layout always wins. Without gnome extension and not in host mode, fall back to content-snap defaults.\n layout: options.layout ?? (useGnomeExtension || hostMode ? undefined : this.buildDefaultLayout(options)),\n\n // Interfaces\n plugs: rootPlugs,\n slots: rootSlots,\n\n // Hooks\n hooks: hooks,\n\n // Apps\n apps: {\n [appName]: app,\n },\n }\n\n return removeNullish(snapcraft)\n }\n\n /**\n * Build environment variables with proper defaults\n */\n private buildEnvironment(options: SnapOptions24): Record<string, string | null> | undefined {\n const env: Record<string, string | null> = {}\n\n // Add default TMPDIR for Electron/Chromium apps\n if (!options.environment?.TMPDIR) {\n env.TMPDIR = \"$XDG_RUNTIME_DIR\"\n }\n\n if (options.environment) {\n deepAssign(env, options.environment)\n }\n\n return Object.keys(env).length > 0 ? env : undefined\n }\n\n /**\n * Build default layout for core24 with GNOME platform content snaps (non-extension mode)\n * This allows the app to access libraries from the gnome-46-2404 and mesa-2404 content snaps\n */\n private buildDefaultLayout(options: SnapOptions24): Record<string, any> | undefined {\n // If user provides custom layout, use that instead\n if (options.layout) {\n return options.layout\n }\n\n // Default layout for core24 Electron apps using GNOME content snaps WITHOUT extension\n return {\n \"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.0\": {\n bind: \"$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.0\",\n },\n \"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1\": {\n bind: \"$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1\",\n },\n \"/usr/share/xml/iso-codes\": {\n bind: \"$SNAP/gnome-platform/usr/share/xml/iso-codes\",\n },\n \"/usr/share/libdrm\": {\n bind: \"$SNAP/gpu-2404/libdrm\",\n },\n \"/usr/share/drirc.d\": {\n symlink: \"$SNAP/gpu-2404/drirc.d\",\n },\n }\n }\n\n /**\n * Process hooks directory into hook definitions\n */\n private async processHooks(hooksPath: string): Promise<Record<string, any> | undefined> {\n try {\n const buildResourcesDir = this.packager.buildResourcesDir\n const hooksDir = path.resolve(buildResourcesDir, hooksPath)\n if (!hooksDir.startsWith(buildResourcesDir + path.sep) && hooksDir !== buildResourcesDir) {\n throw new InvalidConfigurationError(`snapcraft.core24.hooks must resolve within the build resources directory (got \"${hooksDir}\")`)\n }\n const hookFiles = await readdir(hooksDir)\n\n if (hookFiles.length === 0) {\n return undefined\n }\n\n const hooks: Record<string, any> = {}\n for (const hookFile of hookFiles) {\n const hookName = path.basename(hookFile, path.extname(hookFile))\n if (!isValidKey(hookName)) {\n throw new InvalidConfigurationError(`Invalid hook name: ${hookName}`)\n }\n hooks[hookName] = {\n // Hook definitions will be populated by snapcraft from the files\n // Just register that these hooks exist\n }\n }\n\n return hooks\n } catch (e: any) {\n log.error({ message: e.message }, \"error processing Snap hooks directory\")\n throw e\n }\n }\n\n /**\n * Normalize assumes list (can be string or array)\n */\n normalizeAssumesList(assumes: Array<string> | string | Nullish): string[] | undefined {\n if (!assumes) {\n return undefined\n }\n if (typeof assumes === \"string\") {\n return [assumes]\n }\n return assumes.length > 0 ? assumes : undefined\n }\n\n /**\n * Process plugs or slots into root-level definitions and app-level references\n */\n processPlugOrSlots<T extends Array<string | SlotDescriptor | PlugDescriptor> | SlotDescriptor | PlugDescriptor | null>(\n items: T\n ): {\n root: Record<string, unknown> | undefined\n app: string[] | undefined\n } {\n if (!items || (Array.isArray(items) && items.length === 0)) {\n return { root: undefined, app: undefined }\n }\n const root: Record<string, unknown> = {}\n const app: string[] = []\n\n // Handle single descriptor object\n if (!Array.isArray(items)) {\n Object.entries(items).forEach(([name, config]) => {\n if (!isValidKey(name)) {\n throw new Error(`Invalid plug/slot name: ${name}`)\n }\n root[name] = config\n app.push(name)\n })\n return { root, app }\n }\n\n // Handle array - support \"default\" keyword\n const processedItems = this.expandDefaultsInArray(items, this.defaultPlugs)\n for (const item of processedItems ?? []) {\n if (typeof item === \"string\") {\n // Simple string reference\n app.push(item)\n } else {\n // Descriptor object with configuration\n Object.entries(item).forEach(([name, config]) => {\n if (!isValidKey(name)) {\n throw new Error(`Invalid plug/slot name: ${name}`)\n }\n root[name] = config\n app.push(name)\n })\n }\n }\n\n return { root: Object.keys(root).length > 0 ? root : undefined, app: app.length > 0 ? app : undefined }\n }\n\n private isBrowserSandboxAllowed(plugs: Record<string, any> | undefined): boolean {\n if (!plugs) {\n return false\n }\n for (const plug of Object.values(plugs)) {\n if (plug?.interface === \"browser-support\" && plug[\"allow-sandbox\"] === true) {\n return true\n }\n }\n return false\n }\n\n /**\n * Expand \"default\" keyword in arrays of anything\n */\n private expandDefaultsInArray<T>(items: T[] | Nullish, defaults: T[]): T[] | undefined {\n const result: Array<T> = []\n for (const item of items ?? []) {\n if (typeof item === \"string\" && item === \"default\") {\n result.push(...defaults)\n } else {\n result.push(item)\n }\n }\n return result.length > 0 ? result : undefined\n }\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Arch } from "builder-util";
|
|
2
|
+
import { SnapOptionsCustom } from "../../options/SnapOptions";
|
|
3
|
+
import { SnapCore } from "./SnapTarget";
|
|
4
|
+
import { SnapcraftYAML } from "./snapcraft";
|
|
5
|
+
/**
|
|
6
|
+
* Pass-through snap builder for `base: "custom"`.
|
|
7
|
+
*
|
|
8
|
+
* electron-builder reads the file at `snapcraft.custom.yaml` (or the inline object),
|
|
9
|
+
* writes it into the stage directory, and invokes snapcraft. **Nothing is injected or
|
|
10
|
+
* modified in any way** — no plugs, extensions, organize mappings, desktop files,
|
|
11
|
+
* environment variables, layout entries, or stage packages. `linux.*` configuration
|
|
12
|
+
* is also not cascaded into the descriptor.
|
|
13
|
+
*
|
|
14
|
+
* Because electron-builder exerts no control over the descriptor's content, GitHub
|
|
15
|
+
* issue support for snap runtime problems encountered with custom yaml files is limited.
|
|
16
|
+
* Prefer a structured base (`core24`, `core22`, etc.) for a fully managed build.
|
|
17
|
+
*/
|
|
18
|
+
export declare class SnapCoreCustom extends SnapCore<SnapOptionsCustom> {
|
|
19
|
+
readonly defaultPlugs: string[];
|
|
20
|
+
createDescriptor(_arch: Arch): Promise<SnapcraftYAML>;
|
|
21
|
+
buildSnap(params: {
|
|
22
|
+
snap: SnapcraftYAML;
|
|
23
|
+
appOutDir: string;
|
|
24
|
+
stageDir: string;
|
|
25
|
+
snapArch: Arch;
|
|
26
|
+
artifactPath: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SnapCoreCustom = void 0;
|
|
4
|
+
const builder_util_1 = require("builder-util");
|
|
5
|
+
const fs_extra_1 = require("fs-extra");
|
|
6
|
+
const yaml = require("js-yaml");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const SnapTarget_1 = require("./SnapTarget");
|
|
9
|
+
const snapcraftBuilder_1 = require("./snapcraftBuilder");
|
|
10
|
+
/**
|
|
11
|
+
* Pass-through snap builder for `base: "custom"`.
|
|
12
|
+
*
|
|
13
|
+
* electron-builder reads the file at `snapcraft.custom.yaml` (or the inline object),
|
|
14
|
+
* writes it into the stage directory, and invokes snapcraft. **Nothing is injected or
|
|
15
|
+
* modified in any way** — no plugs, extensions, organize mappings, desktop files,
|
|
16
|
+
* environment variables, layout entries, or stage packages. `linux.*` configuration
|
|
17
|
+
* is also not cascaded into the descriptor.
|
|
18
|
+
*
|
|
19
|
+
* Because electron-builder exerts no control over the descriptor's content, GitHub
|
|
20
|
+
* issue support for snap runtime problems encountered with custom yaml files is limited.
|
|
21
|
+
* Prefer a structured base (`core24`, `core22`, etc.) for a fully managed build.
|
|
22
|
+
*/
|
|
23
|
+
class SnapCoreCustom extends SnapTarget_1.SnapCore {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.defaultPlugs = [];
|
|
27
|
+
}
|
|
28
|
+
async createDescriptor(_arch) {
|
|
29
|
+
const { yaml: yamlPath } = this.options;
|
|
30
|
+
if (!yamlPath) {
|
|
31
|
+
throw new builder_util_1.InvalidConfigurationError('snapcraft.base = "custom" requires an entry in snapcraft.custom.yaml (either a path to a snapcraft.yaml file or a SnapcraftYAML object directly in the configuration)');
|
|
32
|
+
}
|
|
33
|
+
if (typeof yamlPath !== "string") {
|
|
34
|
+
return yamlPath; // fully defined SnapcraftYAML object provided directly in configuration, no file reading necessary
|
|
35
|
+
}
|
|
36
|
+
const resolved = path.resolve(this.packager.buildResourcesDir, yamlPath);
|
|
37
|
+
const buildResourcesDir = this.packager.buildResourcesDir;
|
|
38
|
+
if (!resolved.startsWith(buildResourcesDir + path.sep) && resolved !== buildResourcesDir) {
|
|
39
|
+
throw new builder_util_1.InvalidConfigurationError(`snapcraft.custom.yaml must resolve within the build resources directory (got "${resolved}")`);
|
|
40
|
+
}
|
|
41
|
+
const raw = await (0, fs_extra_1.readFile)(resolved, "utf8");
|
|
42
|
+
return yaml.load(raw);
|
|
43
|
+
}
|
|
44
|
+
async buildSnap(params) {
|
|
45
|
+
const { snap, stageDir, artifactPath } = params;
|
|
46
|
+
const snapDirResolved = path.resolve(stageDir, "snap");
|
|
47
|
+
const snapcraftYamlPath = path.join(snapDirResolved, "snapcraft.yaml");
|
|
48
|
+
const yamlContent = yaml.dump(snap, snapcraftBuilder_1.SNAPCRAFT_YAML_OPTIONS);
|
|
49
|
+
await (0, fs_extra_1.outputFile)(snapcraftYamlPath, yamlContent, "utf8");
|
|
50
|
+
builder_util_1.log.debug(snap, "using custom snapcraft.yaml (pass-through, no injection)");
|
|
51
|
+
if (this.packager.packagerOptions.effectiveOptionComputed != null && (await this.packager.packagerOptions.effectiveOptionComputed({ snap }))) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
await (0, snapcraftBuilder_1.buildSnap)({
|
|
55
|
+
snapcraftConfig: snap,
|
|
56
|
+
artifactPath,
|
|
57
|
+
stageDir,
|
|
58
|
+
packager: this.packager,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.SnapCoreCustom = SnapCoreCustom;
|
|
63
|
+
//# sourceMappingURL=coreCustom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coreCustom.js","sourceRoot":"","sources":["../../../src/targets/snap/coreCustom.ts"],"names":[],"mappings":";;;AAAA,+CAAmE;AACnE,uCAA+C;AAC/C,gCAA+B;AAC/B,6BAA4B;AAE5B,6CAAuC;AAEvC,yDAAsE;AAEtE;;;;;;;;;;;;GAYG;AACH,MAAa,cAAe,SAAQ,qBAA2B;IAA/D;;QACW,iBAAY,GAAa,EAAE,CAAA;IA0CtC,CAAC;IAxCC,KAAK,CAAC,gBAAgB,CAAC,KAAW;QAChC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,OAAO,CAAA;QACvC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,wCAAyB,CACjC,uKAAuK,CACxK,CAAA;QACH,CAAC;QACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,QAAQ,CAAA,CAAC,mGAAmG;QACrH,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAA;QACxE,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAA;QACzD,IAAI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urationError, log } from \"builder-util\"\nimport { outputFile, readFile } from \"fs-extra\"\nimport * as yaml from \"js-yaml\"\nimport * as path from \"path\"\nimport { SnapOptionsCustom } from \"../../options/SnapOptions\"\nimport { SnapCore } from \"./SnapTarget\"\nimport { SnapcraftYAML } from \"./snapcraft\"\nimport { buildSnap, SNAPCRAFT_YAML_OPTIONS } from \"./snapcraftBuilder\"\n\n/**\n * Pass-through snap builder for `base: \"custom\"`.\n *\n * electron-builder reads the file at `snapcraft.custom.yaml` (or the inline object),\n * writes it into the stage directory, and invokes snapcraft. **Nothing is injected or\n * modified in any way** — no plugs, extensions, organize mappings, desktop files,\n * environment variables, layout entries, or stage packages. `linux.*` configuration\n * is also not cascaded into the descriptor.\n *\n * Because electron-builder exerts no control over the descriptor's content, GitHub\n * issue support for snap runtime problems encountered with custom yaml files is limited.\n * Prefer a structured base (`core24`, `core22`, etc.) for a fully managed build.\n */\nexport class SnapCoreCustom extends SnapCore<SnapOptionsCustom> {\n readonly defaultPlugs: string[] = []\n\n async createDescriptor(_arch: Arch): Promise<SnapcraftYAML> {\n const { yaml: yamlPath } = this.options\n if (!yamlPath) {\n throw new InvalidConfigurationError(\n 'snapcraft.base = \"custom\" requires an entry in snapcraft.custom.yaml (either a path to a snapcraft.yaml file or a SnapcraftYAML object directly in the configuration)'\n )\n }\n if (typeof yamlPath !== \"string\") {\n return yamlPath // fully defined SnapcraftYAML object provided directly in configuration, no file reading necessary\n }\n const resolved = path.resolve(this.packager.buildResourcesDir, yamlPath)\n const buildResourcesDir = this.packager.buildResourcesDir\n if (!resolved.startsWith(buildResourcesDir + path.sep) && resolved !== buildResourcesDir) {\n throw new InvalidConfigurationError(`snapcraft.custom.yaml must resolve within the build resources directory (got \"${resolved}\")`)\n }\n const raw = await readFile(resolved, \"utf8\")\n return yaml.load(raw) as SnapcraftYAML\n }\n\n async buildSnap(params: { snap: SnapcraftYAML; appOutDir: string; stageDir: string; snapArch: Arch; artifactPath: string }): Promise<void> {\n const { snap, stageDir, artifactPath } = params\n\n const snapDirResolved = path.resolve(stageDir, \"snap\")\n const snapcraftYamlPath = path.join(snapDirResolved, \"snapcraft.yaml\")\n\n const yamlContent = yaml.dump(snap, SNAPCRAFT_YAML_OPTIONS)\n await outputFile(snapcraftYamlPath, yamlContent, \"utf8\")\n log.debug(snap, \"using custom snapcraft.yaml (pass-through, no injection)\")\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null && (await this.packager.packagerOptions.effectiveOptionComputed({ snap }))) {\n return\n }\n\n await buildSnap({\n snapcraftConfig: snap,\n artifactPath,\n stageDir,\n packager: this.packager,\n })\n }\n}\n"]}
|