Skip to content

Commit

Permalink
update WebInstaller and related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaietta committed Oct 16, 2024
1 parent 07d1c99 commit 1b41b17
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
18 changes: 10 additions & 8 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -3859,6 +3859,11 @@
"string"
]
},
"buildUniversalInstaller": {
"default": true,
"description": "Disable building an universal installer of the archs specified in the target configuration",
"type": "boolean"
},
"createDesktopShortcut": {
"default": true,
"description": "Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user).",
Expand Down Expand Up @@ -3892,10 +3897,6 @@
"differentialPackage": {
"type": "boolean"
},
"disableUniversalInstaller": {
"description": "Disable building an universal installer of the archs specified in the target configuration",
"type": "boolean"
},
"displayLanguageSelector": {
"default": false,
"description": "Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).",
Expand Down Expand Up @@ -4163,6 +4164,11 @@
"string"
]
},
"buildUniversalInstaller": {
"default": true,
"description": "Disable building an universal installer of the archs specified in the target configuration",
"type": "boolean"
},
"createDesktopShortcut": {
"default": true,
"description": "Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user).",
Expand Down Expand Up @@ -4196,10 +4202,6 @@
"differentialPackage": {
"type": "boolean"
},
"disableUniversalInstaller": {
"description": "Disable building an universal installer of the archs specified in the target configuration",
"type": "boolean"
},
"displayLanguageSelector": {
"default": false,
"description": "Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).",
Expand Down
4 changes: 2 additions & 2 deletions packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export class NsisTarget extends Target {
NsisTargetOptions.resolve(this.options)
}

private shouldBuildUniversalInstaller() {
return !this.options.disableUniversalInstaller
protected shouldBuildUniversalInstaller() {
return !!this.options.buildUniversalInstaller
}

build(appOutDir: string, arch: Arch) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Arch } from "builder-util"
import { Arch, getArchSuffix } from "builder-util"
import { computeDownloadUrl, getPublishConfigs, getPublishConfigsForUpdateInfo } from "../../publish/PublishManager"
import { WinPackager } from "../../winPackager"
import { NsisWebOptions } from "./nsisOptions"
Expand Down Expand Up @@ -36,7 +36,10 @@ export class WebInstallerTarget extends NsisTarget {
defines.APP_PACKAGE_URL = appPackageUrl
}

protected installerFilenamePattern(_primaryArch?: Arch | null, _defaultArch?: string): string {
protected installerFilenamePattern(primaryArch?: Arch | null, defaultArch?: string): string {
if (!this.shouldBuildUniversalInstaller()) {
return "${productName} Web Setup ${version}" + (primaryArch != null ? getArchSuffix(primaryArch, defaultArch) : "") + ".${ext}"
}
return "${productName} Web Setup ${version}.${ext}"
}

Expand Down
3 changes: 2 additions & 1 deletion packages/app-builder-lib/src/targets/nsis/nsisOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo

/**
* Disable building an universal installer of the archs specified in the target configuration
* @default true
*/
readonly disableUniversalInstaller?: boolean
readonly buildUniversalInstaller?: boolean
}

/**
Expand Down
10 changes: 7 additions & 3 deletions test/src/windows/webInstallerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { app } from "../helpers/packTester"

// tests are heavy, to distribute tests across CircleCI machines evenly, these tests were moved from oneClickInstallerTest

test.ifNotCiMac(
test.ifNotMac(
"web installer",
app({
targets: Platform.WINDOWS.createTarget(["nsis-web"], Arch.x64),
targets: Platform.WINDOWS.createTarget(["nsis-web"], Arch.x64, Arch.arm64),
config: {
publish: {
provider: "s3",
Expand All @@ -23,11 +23,15 @@ test.ifNotCiMac(
loadBrowserProcessSpecificV8Snapshot: true,
grantFileProtocolExtraPrivileges: undefined, // unsupported on current electron version in our tests
},
nsisWeb: {
buildUniversalInstaller: false,
},
},
})
)

test.ifAll.ifNotCiMac(
// can no longer run on mac since mac arm64 can't build ia32, but we want to verify universal builds
test.ifAll.ifNotMac(
"web installer (default github)",
app({
targets: Platform.WINDOWS.createTarget(["nsis-web"], Arch.ia32, Arch.x64, Arch.arm64),
Expand Down
2 changes: 1 addition & 1 deletion test/src/windows/winPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.ifNotCiMac(
version: "3.0.0-beta.2",
},
nsis: {
disableUniversalInstaller: true,
buildUniversalInstaller: false,
},
},
})
Expand Down

0 comments on commit 1b41b17

Please sign in to comment.