Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying additional WiX compiler options #5813

Merged
merged 4 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -3388,6 +3388,13 @@
"default": true,
"description": "If `warningsAsErrors` is `true` (default): treat warnings as errors. If `warningsAsErrors` is `false`: allow warnings.",
"type": "boolean"
},
"additionalWixArgs": {
"description": "Any additional arguments to be passed to the WiX installer compiler, such as `[\"-ext\", \"WixUtilExtension\"]`",
"type": [
"null",
"array"
]
}
},
"type": "object"
Expand Down
5 changes: 5 additions & 0 deletions packages/app-builder-lib/src/options/MsiOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ export interface MsiOptions extends CommonWindowsInstallerConfiguration, TargetS
* @default true
*/
readonly warningsAsErrors?: boolean

/**
* Any additional arguments to be passed to the WiX installer compiler, such as `["-ext", "WixUtilExtension"]`
*/
readonly additionalWixArgs?: Array<string> | null
}
3 changes: 3 additions & 0 deletions packages/app-builder-lib/src/targets/MsiTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ export default class MsiTarget extends Target {
if (this.options.warningsAsErrors !== false) {
args.push("-wx")
}
if (this.options.additionalWixArgs != null) {
args.push(...this.options.additionalWixArgs)
}
return args
}

Expand Down
40 changes: 40 additions & 0 deletions test/src/windows/msiTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { app } from "../helpers/packTester"
import { Platform } from "electron-builder"
import fs from "fs"

test.ifAll.ifDevOrWinCi(
"msi",
Expand Down Expand Up @@ -62,6 +63,45 @@ test.ifAll.ifDevOrWinCi(
)
)

const wixArgsProductName = "Test WiX Args";
test.ifAll.ifDevOrWinCi(
"wix args",
app(
{
targets: Platform.WINDOWS.createTarget("msi"),
config: {
appId: "build.electron.test.msi.oneClick.wixArgs",
extraMetadata: {
// version: "1.0.0",
},
productName: wixArgsProductName,
// Inject a custom-action which requires the WixUtilExtension DLL
msiProjectCreated: async (path) => {
await fs.promises.writeFile(path, (await fs.promises.readFile(path, "utf8")).replace(
'</Product>',
`<util:CloseApplication xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"
PromptToContinue="no"
Target="${wixArgsProductName}.exe"
CloseMessage="yes"
Timeout="2"
TerminateProcess="1"
RebootPrompt="no"
/>
</Product>`
));
},
msi: {
// Apply the needed DLL
additionalWixArgs: ["-ext", "WixUtilExtension"],
},
},
},
{
// signed: true,
}
)
)

test.skip.ifAll(
"assisted",
app({
Expand Down