diff --git a/packages/app-builder-lib/src/packager.ts b/packages/app-builder-lib/src/packager.ts index fbe5e6d397f..b6d4910c1d6 100644 --- a/packages/app-builder-lib/src/packager.ts +++ b/packages/app-builder-lib/src/packager.ts @@ -399,7 +399,7 @@ export class Packager { const platformToTarget = new Map>() const createdOutDirs = new Set() - for (const [platform, archToType] of this.options.targets!) { + for (const [platform, archToType] of this.options.targets!!) { if (this.cancellationToken.cancelled) { break } diff --git a/packages/app-builder-lib/src/targets/snap.ts b/packages/app-builder-lib/src/targets/snap.ts index d4d3848cbe7..f0e733e7ab6 100644 --- a/packages/app-builder-lib/src/targets/snap.ts +++ b/packages/app-builder-lib/src/targets/snap.ts @@ -12,7 +12,7 @@ import { getTemplatePath } from "../util/pathManager" import { LinuxTargetHelper } from "./LinuxTargetHelper" import { createStageDirPath } from "./targetUtil" -const defaultPlugs = ["desktop", "desktop-legacy", "home", "x11", "unity7", "browser-support", "network", "gsettings", "pulseaudio", "opengl"] +const defaultPlugs = ["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "pulseaudio", "opengl"] export default class SnapTarget extends Target { readonly options: SnapOptions = {...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name]} @@ -95,6 +95,9 @@ export default class SnapTarget extends Target { else { const archTriplet = archNameToTriplet(arch) appDescriptor.environment = { + // https://github.com/electron-userland/electron-builder/issues/4007 + // https://github.com/electron/electron/issues/9056 + DISABLE_WAYLAND: "1", TMPDIR: "$XDG_RUNTIME_DIR", PATH: "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", SNAP_DESKTOP_RUNTIME: "$SNAP/gnome-platform", diff --git a/packages/app-builder-lib/src/targets/targetFactory.ts b/packages/app-builder-lib/src/targets/targetFactory.ts index 6cb2df51440..70682b8bf45 100644 --- a/packages/app-builder-lib/src/targets/targetFactory.ts +++ b/packages/app-builder-lib/src/targets/targetFactory.ts @@ -1,5 +1,5 @@ import { addValue, Arch, archFromString, ArchType, asArray } from "builder-util" -import { PlatformSpecificBuildOptions, DEFAULT_TARGET, DIR_TARGET, Platform, Target, TargetConfiguration } from "../index" +import { PlatformSpecificBuildOptions, DEFAULT_TARGET, DIR_TARGET, Platform, Target, TargetConfiguration } from ".." import { PlatformPackager } from "../platformPackager" import { ArchiveTarget } from "./ArchiveTarget" diff --git a/test/out/__snapshots__/BuildTest.js.snap b/test/out/__snapshots__/BuildTest.js.snap index 43b8ccf7754..284b16d53dc 100644 --- a/test/out/__snapshots__/BuildTest.js.snap +++ b/test/out/__snapshots__/BuildTest.js.snap @@ -346,7 +346,7 @@ Object { "size": 765, }, "chownr.js": Object { - "size": 2488, + "size": 3512, }, "package.json": Object { "size": 402, diff --git a/test/out/linux/__snapshots__/snapTest.js.snap b/test/out/linux/__snapshots__/snapTest.js.snap index bf21cc3b3e6..56c7d8b4ddd 100644 --- a/test/out/linux/__snapshots__/snapTest.js.snap +++ b/test/out/linux/__snapshots__/snapTest.js.snap @@ -18,6 +18,7 @@ Object { "adapter": "none", "command": "command.sh", "environment": Object { + "DISABLE_WAYLAND": "1", "LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu", "PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", "SNAP_DESKTOP_RUNTIME": "$SNAP/gnome-platform", @@ -28,6 +29,7 @@ Object { "desktop-legacy", "home", "x11", + "wayland", "unity7", "browser-support", "network", @@ -229,6 +231,7 @@ Object { "sep": Object { "command": "command.sh", "environment": Object { + "DISABLE_WAYLAND": "1", "LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu", "PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", "SNAP_DESKTOP_RUNTIME": "$SNAP/gnome-platform", @@ -239,6 +242,7 @@ Object { "desktop-legacy", "home", "x11", + "wayland", "unity7", "browser-support", "network", @@ -295,6 +299,7 @@ Object { "sep": Object { "command": "command.sh", "environment": Object { + "DISABLE_WAYLAND": "1", "FOO": "bar", "LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu", "PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", @@ -306,6 +311,7 @@ Object { "desktop-legacy", "home", "x11", + "wayland", "unity7", "browser-support", "network", @@ -990,6 +996,7 @@ Object { "sep": Object { "command": "command.sh", "environment": Object { + "DISABLE_WAYLAND": "1", "LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu", "PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", "SNAP_DESKTOP_RUNTIME": "$SNAP/gnome-platform", @@ -1049,6 +1056,7 @@ Object { "adapter": "none", "command": "command.sh", "environment": Object { + "DISABLE_WAYLAND": "1", "LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu", "PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", "SNAP_DESKTOP_RUNTIME": "$SNAP/gnome-platform", @@ -1241,6 +1249,7 @@ Object { "adapter": "none", "command": "command.sh", "environment": Object { + "DISABLE_WAYLAND": "1", "LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu", "PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", "SNAP_DESKTOP_RUNTIME": "$SNAP/gnome-platform",