Skip to content

Commit

Permalink
fix: DMG assembly on Apple Silicon (#4606) (#5724)
Browse files Browse the repository at this point in the history
* fix: conditionally setting dmg filesystem to APFS for arm64 processors. Apple Silicon dropped support for creating dmgs with HFS+ (#4606)
  • Loading branch information
mmaietta authored Mar 31, 2021
1 parent 18e0c24 commit 469b85f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion packages/dmg-builder/src/dmg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,15 @@ async function createStageDmg(tempDmg: string, appPath: string, volumeName: stri
if (log.isDebugEnabled) {
imageArgs.push("-debug")
}
imageArgs.push("-fs", "HFS+", "-fsargs", "-c c=64,a=16,e=16")

let filesystem = ["HFS+", "-fsargs", "-c c=64,a=16,e=16"]
if (process.arch === "arm64") {
// Apple Silicon `hdiutil` dropped support for HFS+, so we force the latest type
// https://github.com/electron-userland/electron-builder/issues/4606
filesystem = ["APFS"]
log.warn(null, "Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+")
}
imageArgs.push("-fs", ...filesystem)
imageArgs.push(tempDmg)
// The reason for retrying up to ten times is that hdiutil create in some cases fail to unmount due to "resource busy".
// https://github.com/electron-userland/electron-builder/issues/5431
Expand Down
2 changes: 1 addition & 1 deletion test/snapshots/mac/macArchiveTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Object {
`;

exports[`invalid target 1`] = `
"Invalid configuration object. electron-builder <appVersion> has been initialized using a configuration object that does not match the API schema.
"Invalid configuration object. electron-builder 22.10.5 has been initialized using a configuration object that does not match the API schema.
- configuration.mac should be one of these:
object { appId?, artifactName?, asar?, asarUnpack?, binaries?, bundleShortVersion?, bundleVersion?, category?, compression?, cscInstallerKeyPassword?, cscInstallerLink?, cscKeyPassword?, cscLink?, darkModeSupport?, defaultArch?, detectUpdateChannel?, electronLanguages?, electronUpdaterCompatibility?, entitlements?, entitlementsInherit?, entitlementsLoginHelper?, executableName?, extendInfo?, extraDistFiles?, extraFiles?, extraResources?, fileAssociations?, files?, forceCodeSigning?, gatekeeperAssess?, generateUpdatesFilesForAllChannels?, hardenedRuntime?, helperBundleId?, helperEHBundleId?, helperGPUBundleId?, helperNPBundleId?, helperPluginBundleId?, helperRendererBundleId?, icon?, identity?, minimumSystemVersion?, protocols?, provisioningProfile?, publish?, releaseInfo?, requirements?, signIgnore?, strictVerify?, target?, type? } | null
-> Options related to how build macOS targets.
Expand Down

0 comments on commit 469b85f

Please sign in to comment.