Skip to content

Commit

Permalink
fix(dmg): cannot build DMG on macOS 10.15
Browse files Browse the repository at this point in the history
Close #3990
  • Loading branch information
develar committed Jul 20, 2019
1 parent f6b6e23 commit 8f099f5
Show file tree
Hide file tree
Showing 41 changed files with 899 additions and 3,864 deletions.
7 changes: 7 additions & 0 deletions .idea/codeStyles/Project.xml

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

1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

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

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -34,7 +34,7 @@
"@types/debug": "^4.1.4",
"@types/is-ci": "^2.0.0",
"@types/semver": "^6.0.1",
"app-builder-bin": "3.4.0",
"app-builder-bin": "3.4.1",
"archiver": "^3.0.0",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.9",
Expand All @@ -55,10 +55,10 @@
"minimatch": "^3.0.4",
"normalize-package-data": "^2.5.0",
"pako": "^1.0.10",
"parse-color": "^1.0.0",
"read-config-file": "4.0.1",
"read-config-file": "5.0.0",
"sanitize-filename": "^1.6.1",
"sax": "^1.2.4",
"schema-utils": "^2.0.1",
"semver": "^6.2.0",
"source-map-support": "^0.5.12",
"stat-mode": "^0.3.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/app-builder-lib/package.json
Expand Up @@ -7,6 +7,7 @@
"out",
"templates",
"scheme.json",
"electron-osx-sign",
"certs/root_certs.keychain",
"electron-osx-sign"
],
Expand Down Expand Up @@ -54,10 +55,11 @@
"is-ci": "^2.0.0",
"isbinaryfile": "^4.0.2",
"js-yaml": "^3.13.1",
"read-config-file": "4.0.1",
"read-config-file": "5.0.0",
"minimatch": "^3.0.4",
"normalize-package-data": "^2.5.0",
"sanitize-filename": "^1.6.1",
"schema-utils": "^2.0.1",
"semver": "^6.2.0",
"debug": "^4.1.1",
"lazy-val": "^1.0.4",
Expand Down
8 changes: 6 additions & 2 deletions packages/app-builder-lib/scheme.json
Expand Up @@ -794,12 +794,16 @@
},
"window": {
"$ref": "#/definitions/DmgWindow",
"description": "The DMG windows position and size."
"description": "The DMG windows position and size. With y co-ordinates running from bottom to top.\nThe Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `\"x\": 0, \"y\": 100000` as the x, y co-ordinates.\nIt is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen."
},
"sign": {
"default": false,
"description": "Disable signing of the DMG when building. This can help solve issues with Gatekeeper disabling installation of your app.",
"type": "boolean"
},
"writeUpdateInfo": {
"default": true,
"type": "boolean"
}
},
"title": "DmgOptions",
Expand Down Expand Up @@ -5337,7 +5341,7 @@
"type": "boolean"
},
"framework": {
"description": "The framework name. One of `electron`, `proton-native`, `libui`. Defaults to `electron`.",
"description": "The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.",
"type": [
"null",
"string"
Expand Down
8 changes: 1 addition & 7 deletions packages/app-builder-lib/src/configuration.ts
Expand Up @@ -169,13 +169,7 @@ export interface Configuration extends PlatformSpecificBuildOptions {
readonly launchUiVersion?: boolean | string | null

/**
* @private
* @deprecated Set framework and nodeVersion if need.
*/
readonly protonNodeVersion?: string | null

/**
* The framework name. One of `electron`, `proton-native`, `libui`. Defaults to `electron`.
* The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.
*/
readonly framework?: string | null

Expand Down
17 changes: 13 additions & 4 deletions packages/app-builder-lib/src/options/macOptions.ts
Expand Up @@ -141,7 +141,7 @@ export interface DmgOptions extends TargetSpecificOptions {
* The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
* Defaults to the application icon (`build/icon.icns`).
*/
readonly icon?: string | null
icon?: string | null

/**
* The size of all the icons inside the DMG.
Expand Down Expand Up @@ -172,10 +172,13 @@ export interface DmgOptions extends TargetSpecificOptions {
* The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).
* @default UDZO
*/
readonly format?: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO"
format?: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO"

/**
* The DMG windows position and size.
* The DMG window position and size. With y co-ordinates running from bottom to top.
*
* The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `"x": 0, "y": 100000` as the x, y co-ordinates.
* It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen.
*/
window?: DmgWindow

Expand All @@ -190,6 +193,12 @@ export interface DmgOptions extends TargetSpecificOptions {
* @default false
*/
readonly sign?: boolean

/**
* @private
* @default true
*/
writeUpdateInfo?: boolean
}

export interface DmgWindow {
Expand All @@ -200,7 +209,7 @@ export interface DmgWindow {
x?: number

/**
* The Y position relative to top of the screen.
* The Y position relative to bottom of the screen.
* @default 100
*/
y?: number
Expand Down
9 changes: 1 addition & 8 deletions packages/app-builder-lib/src/packager.ts
Expand Up @@ -39,13 +39,6 @@ async function createFrameworkInfo(configuration: Configuration, packager: Packa
}

let nodeVersion = configuration.nodeVersion
// noinspection JSDeprecatedSymbols
if (framework == null && configuration.protonNodeVersion != null) {
framework = "proton"
// noinspection JSDeprecatedSymbols
nodeVersion = configuration.protonNodeVersion
}

if (framework === "electron" || framework == null) {
return await createElectronFrameworkSupport(configuration, packager)
}
Expand All @@ -56,7 +49,7 @@ async function createFrameworkInfo(configuration: Configuration, packager: Packa

const distMacOsName = `${packager.appInfo.productFilename}.app`
const isUseLaunchUi = configuration.launchUiVersion !== false
if (framework === "proton") {
if (framework === "proton" || framework === "proton-native") {
return new ProtonFramework(nodeVersion, distMacOsName, isUseLaunchUi)
}
else if (framework === "libui") {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/publish/PublishManager.ts
Expand Up @@ -390,7 +390,7 @@ async function resolvePublishConfigurations(publishers: any, platformPackager: P
}

if (serviceName != null) {
log.debug(null, `Detect ${serviceName} as publish provider`)
log.debug(null, `detect ${serviceName} as publish provider`)
return [(await getResolvedPublishConfig(platformPackager, packager, {provider: serviceName}, arch, errorIfCannot))!]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/targets/nsis/nsisOptions.ts
Expand Up @@ -124,7 +124,7 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
readonly deleteAppDataOnUninstall?: boolean

/**
* Defaults to `true` for web installer (`nsis-web`)
* @private
*/
differentialPackage?: boolean

Expand Down
4 changes: 4 additions & 0 deletions packages/app-builder-lib/src/util/appBuilder.ts
Expand Up @@ -4,6 +4,10 @@ import { SpawnOptions } from "child_process"
export function executeAppBuilderAsJson<T>(args: Array<string>): Promise<T> {
return executeAppBuilder(args)
.then(rawResult => {
if (rawResult === "") {
return Object.create(null) as T
}

try {
return JSON.parse(rawResult) as T
}
Expand Down
38 changes: 26 additions & 12 deletions packages/app-builder-lib/src/util/config.ts
@@ -1,12 +1,15 @@
import { DebugLogger, deepAssign, InvalidConfigurationError, log } from "builder-util"
import { DebugLogger, deepAssign, InvalidConfigurationError, log, safeStringifyJson } from "builder-util"
import { statOrNull } from "builder-util/out/fs"
import { readJson } from "fs-extra"
import { Lazy } from "lazy-val"
import * as path from "path"
import { getConfig as _getConfig, loadParentConfig, orNullIfFileNotExist, ReadConfigRequest, validateConfig as _validateConfig } from "read-config-file"
import { getConfig as _getConfig, loadParentConfig, orNullIfFileNotExist, ReadConfigRequest } from "read-config-file"
import { FileSet } from ".."
import { Configuration } from "../configuration"
import { reactCra } from "../presets/rectCra"
const validateSchema = require("schema-utils")

declare const PACKAGE_VERSION: string

// https://github.com/electron-userland/electron-builder/issues/1847
function mergePublish(config: Configuration, configFromOptions: Configuration) {
Expand Down Expand Up @@ -222,19 +225,30 @@ export async function validateConfig(config: Configuration, debugLogger: DebugLo
throw new InvalidConfigurationError(`appImage.systemIntegration is deprecated, https://github.com/TheAssassin/AppImageLauncher is used for desktop integration"`)
}

await _validateConfig(config, schemeDataPromise, (message, errors) => {
if (debugLogger.isEnabled) {
debugLogger.add("invalidConfig", JSON.stringify(errors, null, 2))
}
// noinspection JSUnusedGlobalSymbols
validateSchema(await schemeDataPromise.value, config, {
name: `electron-builder ${PACKAGE_VERSION}`,
postFormatter: (formattedError: string, error: any): string => {
if (debugLogger.isEnabled) {
debugLogger.add("invalidConfig", safeStringifyJson(error))
}

return `${message}
const site = "https://www.electron.build"
let url = `${site}/configuration/configuration`
const targets = new Set(["mac", "dmg", "pkg", "mas", "win", "nsis", "appx", "linux", "appimage", "snap"])
const dataPath: string = error.dataPath == null ? null : error.dataPath
const targetPath = dataPath.startsWith(".") ? dataPath.substr(1).toLowerCase() : null
if (targetPath != null && targets.has(targetPath)) {
url = `${site}/configuration/${targetPath}`
}

How to fix:
1. Open https://electron.build/configuration/configuration
2. Search the option name on the page.
* Not found? The option was deprecated or not exists (check spelling).
* Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.
return `${formattedError}\n How to fix:
1. Open ${url}
2. Search the option name on the page (or type in into Search to find across the docs).
* Not found? The option was deprecated or not exists (check spelling).
* Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.
`
},
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Expand Up @@ -11,7 +11,7 @@
"out"
],
"dependencies": {
"app-builder-bin": "3.4.0",
"app-builder-bin": "3.4.1",
"temp-file": "^3.3.4",
"fs-extra": "^8.1.0",
"is-ci": "^2.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/dmg-builder/package.json
@@ -1,6 +1,6 @@
{
"name": "dmg-builder",
"version": "1.0.1",
"version": "0.0.0-semantic-release",
"main": "out/dmgUtil.js",
"author": "Vladimir Krivosheev",
"license": "MIT",
Expand All @@ -15,7 +15,6 @@
"dependencies": {
"fs-extra": "^8.1.0",
"bluebird-lst": "^1.0.9",
"parse-color": "^1.0.0",
"builder-util": "~0.0.0-semantic-release",
"iconv-lite": "^0.5.0",
"js-yaml": "^3.13.1",
Expand Down

0 comments on commit 8f099f5

Please sign in to comment.