Skip to content

Commit

Permalink
feat: use mergeASARs API by @electron/universal (#6578)
Browse files Browse the repository at this point in the history
* feat: use `mergeASARs` API by @electron/universal

@electron/universal@1.2.0 introduced `mergeASARs` and `singleArchFiles`
options that enable merging of x64 and arm64 ASARs into one. This change
adds appropriate properties to the MacConfiguration interface and passes
them along to @electron/universal.
  • Loading branch information
indutny-signal committed Jan 26, 2022
1 parent 6d1e4b0 commit 81132a8
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-kangaroos-serve.md
@@ -0,0 +1,5 @@
---
"app-builder-lib": minor
---

feat: use `mergeASARs` API by @electron/universal
2 changes: 1 addition & 1 deletion packages/app-builder-lib/package.json
Expand Up @@ -49,7 +49,7 @@
"dependencies": {
"7zip-bin": "~5.1.1",
"@develar/schema-utils": "~2.6.5",
"@electron/universal": "1.0.5",
"@electron/universal": "1.2.0",
"@malept/flatpak-bundler": "^0.4.0",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.9",
Expand Down
18 changes: 18 additions & 0 deletions packages/app-builder-lib/scheme.json
Expand Up @@ -2578,6 +2578,11 @@
"string"
]
},
"mergeASARs": {
"default": true,
"description": "Whether to merge ASAR files for different architectures or not.\n\nThis option has no effect unless building for \"universal\" arch.",
"type": "boolean"
},
"minimumSystemVersion": {
"description": "The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.",
"type": [
Expand Down Expand Up @@ -2702,6 +2707,10 @@
],
"description": "Regex or an array of regex's that signal skipping signing a file."
},
"singleArchFiles": {
"description": "Minimatch pattern of paths that are allowed to be present in one of the\nASAR files, but not in the other.\n\nThis option has no effect unless building for \"universal\" arch and applies\nonly if `mergeASARs` is `true`.",
"type": "string"
},
"strictVerify": {
"anyOf": [
{
Expand Down Expand Up @@ -3183,6 +3192,11 @@
"string"
]
},
"mergeASARs": {
"default": true,
"description": "Whether to merge ASAR files for different architectures or not.\n\nThis option has no effect unless building for \"universal\" arch.",
"type": "boolean"
},
"minimumSystemVersion": {
"description": "The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.",
"type": [
Expand Down Expand Up @@ -3307,6 +3321,10 @@
],
"description": "Regex or an array of regex's that signal skipping signing a file."
},
"singleArchFiles": {
"description": "Minimatch pattern of paths that are allowed to be present in one of the\nASAR files, but not in the other.\n\nThis option has no effect unless building for \"universal\" arch and applies\nonly if `mergeASARs` is `true`.",
"type": "string"
},
"strictVerify": {
"anyOf": [
{
Expand Down
2 changes: 2 additions & 0 deletions packages/app-builder-lib/src/macPackager.ts
Expand Up @@ -127,6 +127,8 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
arm64AppPath: path.join(arm64AppOutPath, appFile),
outAppPath: path.join(appOutDir, appFile),
force: true,
mergeASARs: platformSpecificBuildOptions.mergeASARs ?? true,
singleArchFiles: platformSpecificBuildOptions.singleArchFiles,
})
await fs.rm(x64AppOutDir, { recursive: true, force: true })
await fs.rm(arm64AppOutPath, { recursive: true, force: true })
Expand Down
17 changes: 17 additions & 0 deletions packages/app-builder-lib/src/options/macOptions.ts
Expand Up @@ -175,6 +175,23 @@ export interface MacConfiguration extends PlatformSpecificBuildOptions {
* Specify the URL of the timestamp authority server
*/
readonly timestamp?: string | null

/**
* Whether to merge ASAR files for different architectures or not.
*
* This option has no effect unless building for "universal" arch.
* @default true
*/
readonly mergeASARs?: boolean

/**
* Minimatch pattern of paths that are allowed to be present in one of the
* ASAR files, but not in the other.
*
* This option has no effect unless building for "universal" arch and applies
* only if `mergeASARs` is `true`.
*/
readonly singleArchFiles?: string
}

export interface DmgOptions extends TargetSpecificOptions {
Expand Down
13 changes: 8 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 81132a8

Please sign in to comment.