Skip to content

feat: generate minimumSystemVersion into latest.yml from platformat config[breaking change] #9046

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .changeset/little-chairs-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"app-builder-lib": patch
"builder-util-runtime": patch
---

feat: generate minimumSystemVersion into latest.yml from platform config
39 changes: 37 additions & 2 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,13 @@
],
"description": "The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing."
},
"minimumSystemVersion": {
"description": "The minimum os kernel version required to install the application.",
"type": [
"null",
"string"
]
},
"packageCategory": {
"description": "backward compatibility + to allow specify fpm-only category for all possible fpm targets in one place",
"type": [
Expand Down Expand Up @@ -2327,6 +2334,13 @@
"MacConfiguration": {
"additionalProperties": false,
"properties": {
"LSMinimumSystemVersion": {
"description": "The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.",
"type": [
"null",
"string"
]
},
"additionalArguments": {
"anyOf": [
{
Expand Down Expand Up @@ -2737,7 +2751,7 @@
"type": "boolean"
},
"minimumSystemVersion": {
"description": "The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.",
"description": "The minimum os kernel version required to install the application.",
"type": [
"null",
"string"
Expand Down Expand Up @@ -2959,6 +2973,13 @@
"MasConfiguration": {
"additionalProperties": false,
"properties": {
"LSMinimumSystemVersion": {
"description": "The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.",
"type": [
"null",
"string"
]
},
"additionalArguments": {
"anyOf": [
{
Expand Down Expand Up @@ -3369,7 +3390,7 @@
"type": "boolean"
},
"minimumSystemVersion": {
"description": "The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.",
"description": "The minimum os kernel version required to install the application.",
"type": [
"null",
"string"
Expand Down Expand Up @@ -6569,6 +6590,13 @@
"string"
]
},
"minimumSystemVersion": {
"description": "The minimum os kernel version required to install the application.",
"type": [
"null",
"string"
]
},
"protocols": {
"anyOf": [
{
Expand Down Expand Up @@ -7438,6 +7466,13 @@
],
"description": "MAS (Mac Application Store) development options (`mas-dev` target)."
},
"minimumSystemVersion": {
"description": "The minimum os kernel version required to install the application.",
"type": [
"null",
"string"
]
},
"msi": {
"anyOf": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export class MacPackager extends PlatformPackager<MacConfiguration> {
appPlist.CFBundleName = appInfo.productName
appPlist.CFBundleDisplayName = appInfo.productName

const minimumSystemVersion = this.platformSpecificBuildOptions.minimumSystemVersion
const minimumSystemVersion = this.platformSpecificBuildOptions.LSMinimumSystemVersion
if (minimumSystemVersion != null) {
appPlist.LSMinimumSystemVersion = minimumSystemVersion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions, Fil
cscKeyPassword?: string | null

readonly defaultArch?: string

/**
* The minimum os kernel version required to install the application.
*/
readonly minimumSystemVersion?: string | null
}

export interface ReleaseInfo {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/options/macOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export interface MacConfiguration extends PlatformSpecificBuildOptions {
/**
* The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.
*/
readonly minimumSystemVersion?: string | null
readonly LSMinimumSystemVersion?: string | null

/**
* Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS.
Expand Down
5 changes: 5 additions & 0 deletions packages/app-builder-lib/src/publish/updateInfoBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ async function createUpdateInfo(version: string, event: ArtifactCreated, release
const customUpdateInfo = event.updateInfo
const url = path.basename(event.file)
const sha512 = (customUpdateInfo == null ? null : customUpdateInfo.sha512) || (await hashFile(event.file))
const minimumSystemVersion = customUpdateInfo == null ? null : customUpdateInfo.minimumSystemVersion
const files = [{ url, sha512 }]
const result: UpdateInfo = {
// @ts-ignore
Expand All @@ -180,10 +181,14 @@ async function createUpdateInfo(version: string, event: ArtifactCreated, release
path: url /* backward compatibility, electron-updater 1.x - electron-updater 2.15.0 */,
// @ts-ignore
sha512 /* backward compatibility, electron-updater 1.x - electron-updater 2.15.0 */,
minimumSystemVersion,
...(releaseInfo as UpdateInfo),
}

if (customUpdateInfo != null) {
if (customUpdateInfo.minimumSystemVersion) {
delete customUpdateInfo.minimumSystemVersion
}
// file info or nsis web installer packages info
Object.assign("sha512" in customUpdateInfo ? files[0] : result, customUpdateInfo)
}
Expand Down
4 changes: 4 additions & 0 deletions packages/app-builder-lib/src/targets/ArchiveTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export class ArchiveTarget extends Target {
}
}

if (updateInfo != null && this.packager.platformSpecificBuildOptions.minimumSystemVersion) {
updateInfo.minimumSystemVersion = this.packager.platformSpecificBuildOptions.minimumSystemVersion
}

await packager.info.emitArtifactBuildCompleted({
updateInfo,
file: artifactPath,
Expand Down
4 changes: 4 additions & 0 deletions packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ export class NsisTarget extends Target {
updateInfo.isAdminRightsRequired = true
}

if (updateInfo != null && this.packager.platformSpecificBuildOptions.minimumSystemVersion) {
updateInfo.minimumSystemVersion = this.packager.platformSpecificBuildOptions.minimumSystemVersion
}

await packager.info.emitArtifactBuildCompleted({
file: installerPath,
updateInfo,
Expand Down
1 change: 1 addition & 0 deletions test/snapshots/mac/macPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ exports[`one-package 1`] = `
"url": "Test App ßW-1.1.0.dmg",
},
],
"minimumSystemVersion": "22.0.4",
"path": "Test App ßW-1.1.0-mac.zip",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
Expand Down
3 changes: 2 additions & 1 deletion test/src/mac/macPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ test.ifMac("one-package", ({ expect }) =>
},
],
},
minimumSystemVersion: "10.12.0",
minimumSystemVersion: "22.0.4",
LSMinimumSystemVersion: "10.12.0",
fileAssociations: [
{
ext: "foo",
Expand Down
Loading