Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 @@ -3839,6 +3839,13 @@
"description": "Whether to create start menu shortcut.",
"type": "boolean"
},
"license": {
"description": "The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants).\n\n**Note: MSI installers only support RTF format.** The license file must be in RTF format for WiX to display it properly.\n\nMultiple license files for different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.rtf` and `license_en.rtf` in the build resources.\nIf OS language is german, `license_de.rtf` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).\n\nAppropriate license file will be selected by language id. English is the default language.\n\nNote: This option is only applicable when `oneClick` is set to `false` (assisted installer). One-click installers do not show a license agreement page.",
"type": [
"null",
"string"
]
},
"menuCategory": {
"default": false,
"description": "Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value.",
Expand Down
14 changes: 14 additions & 0 deletions packages/app-builder-lib/src/options/MsiOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,18 @@ export interface MsiOptions extends CommonWindowsInstallerConfiguration, TargetS
* Any additional arguments to be passed to the light.ext, such as `["-cultures:ja-jp"]`
*/
readonly additionalLightArgs?: Array<string> | null

/**
* The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants).
*
* **Note: MSI installers only support RTF format.** The license file must be in RTF format for WiX to display it properly.
*
* Multiple license files for different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.rtf` and `license_en.rtf` in the build resources.
* If OS language is german, `license_de.rtf` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).
*
* Appropriate license file will be selected by language id. English is the default language.
*
* Note: This option is only applicable when `oneClick` is set to `false` (assisted installer). One-click installers do not show a license agreement page.
*/
readonly license?: string | null
}
11 changes: 11 additions & 0 deletions packages/app-builder-lib/src/targets/MsiTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Target } from "../core"
import { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from "../options/CommonWindowsInstallerConfiguration"
import { normalizeExt } from "../platformPackager"
import { getTemplatePath } from "../util/pathManager"
import { getNotLocalizedLicenseFile } from "../util/license"
import { VmManager } from "../vm/vm"
import { WineVmManager } from "../vm/WineVm"
import { WinPackager } from "../winPackager"
Expand Down Expand Up @@ -192,6 +193,15 @@ export default class MsiTarget extends Target {
log.warn(`Manufacturer is not set for MSI — please set "author" in the package.json`)
}

// Only include license file for assisted installer (oneClick === false)
let licenseRtfPath: string | null = null
if (commonOptions.isAssisted) {
const licenseFile = await getNotLocalizedLicenseFile(this.options.license, this.packager, ["rtf"])
if (licenseFile != null) {
licenseRtfPath = this.vm.toVmFile(licenseFile)
}
}

return {
...commonOptions,
iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),
Expand All @@ -202,6 +212,7 @@ export default class MsiTarget extends Target {
upgradeCode: this.upgradeCode,
manufacturer: companyName || appInfo.productName,
appDescription: appInfo.description,
licenseRtfPath,
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/app-builder-lib/templates/msi/template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
</UI>
{{ } -}}

{{ if (licenseRtfPath) { }}
<WixVariable Id="WixUILicenseRtf" Value="${licenseRtfPath}"/>
{{ } -}}

<UIRef Id="WixUI_InstallDir"/>
<UI>
<Publish Dialog="WelcomeDlg" Control="Next" Event="SpawnWaitDialog" Value="WaitForCostingDlg" Order="2">1 OR CostingComplete = 1</Publish>
Expand Down
13 changes: 13 additions & 0 deletions test/src/windows/msiTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,17 @@ describe.ifWindows("msi", { sequential: true }, () => {
},
},
}))

test.skip("assisted with license", ({ expect }) =>
app(expect, {
targets: Platform.WINDOWS.createTarget("msi", Arch.x64),
config: {
appId: "build.electron.test.msi.assisted.license",
productName: "Test MSI Assisted License",
msi: {
oneClick: false,
license: "license_de.rtf",
},
},
}))
})
Loading