diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml
index 66a1f3f0d20..89dffe27537 100644
--- a/.idea/dictionaries/develar.xml
+++ b/.idea/dictionaries/develar.xml
@@ -140,6 +140,7 @@
mpass
multilib
multiuser
+ muon
mutators
nevershow
nokeys
diff --git a/package.json b/package.json
index 7c23bced9eb..c1e50e0a187 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,7 @@
"chromium-pickle-js": "^0.2.0",
"cuint": "^0.2.2",
"debug": "^2.6.3",
- "electron-download-tf": "4.0.0",
+ "electron-download-tf": "4.1.1",
"electron-macos-sign": "~1.6.0",
"fs-extra-p": "^4.1.0",
"hosted-git-info": "^2.4.1",
@@ -80,7 +80,6 @@
"convert-source-map": "^1.4.0",
"decompress-zip": "^0.3.0",
"depcheck": "^0.6.7",
- "electron-download-tf": "4.0.0",
"globby": "^6.1.0",
"jest-cli": "^19.0.2",
"jest-environment-node-debug": "^2.0.0",
diff --git a/packages/electron-builder/package.json b/packages/electron-builder/package.json
index c4d1329304c..39d00cb0b9d 100644
--- a/packages/electron-builder/package.json
+++ b/packages/electron-builder/package.json
@@ -54,7 +54,7 @@
"electron-builder-core": "0.0.0-semantic-release",
"electron-builder-http": "0.0.0-semantic-release",
"electron-builder-util": "0.0.0-semantic-release",
- "electron-download-tf": "4.0.0",
+ "electron-download-tf": "4.1.1",
"electron-macos-sign": "~1.6.0",
"electron-publish": "0.0.0-semantic-release",
"fs-extra-p": "^4.1.0",
diff --git a/packages/electron-builder/src/linuxPackager.ts b/packages/electron-builder/src/linuxPackager.ts
index c5bbc7f7989..fcfd07e24e3 100755
--- a/packages/electron-builder/src/linuxPackager.ts
+++ b/packages/electron-builder/src/linuxPackager.ts
@@ -67,6 +67,6 @@ export class LinuxPackager extends PlatformPackager {
}
protected postInitApp(appOutDir: string): Promise {
- return rename(path.join(appOutDir, "electron"), path.join(appOutDir, this.executableName))
+ return rename(path.join(appOutDir, this.electronDistExecutableName), path.join(appOutDir, this.executableName))
}
}
\ No newline at end of file
diff --git a/packages/electron-builder/src/metadata.ts b/packages/electron-builder/src/metadata.ts
index dd2355cc051..a942b747f9e 100755
--- a/packages/electron-builder/src/metadata.ts
+++ b/packages/electron-builder/src/metadata.ts
@@ -178,6 +178,11 @@ export interface Config extends PlatformSpecificBuildOptions {
* The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.
*/
readonly electronVersion?: string | null
+
+ /**
+ * The version of muon you are packaging for.
+ */
+ readonly muonVersion?: string | null
/**
* The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName}-${version}.${ext}` (some target can have another defaults, see corresponding options).
diff --git a/packages/electron-builder/src/packager.ts b/packages/electron-builder/src/packager.ts
index fc6572a1707..0d332a94559 100644
--- a/packages/electron-builder/src/packager.ts
+++ b/packages/electron-builder/src/packager.ts
@@ -49,6 +49,7 @@ export class Packager implements BuildInfo {
isTwoPackageJsonProjectLayoutUsed = true
electronVersion: string
+ muonVersion?: string | null
readonly eventEmitter = new EventEmitter()
@@ -159,6 +160,7 @@ export class Packager implements BuildInfo {
checkConflictingOptions(this.config)
this.electronVersion = await getElectronVersion(this.config, projectDir, this.isPrepackedAppAsar ? this.metadata : null)
+ this.muonVersion = this.config.muonVersion
this.appInfo = new AppInfo(this.metadata, this)
const cleanupTasks: Array<() => Promise> = []
diff --git a/packages/electron-builder/src/packager/dirPackager.ts b/packages/electron-builder/src/packager/dirPackager.ts
index 382a0bdc4b3..74ee48aa594 100644
--- a/packages/electron-builder/src/packager/dirPackager.ts
+++ b/packages/electron-builder/src/packager/dirPackager.ts
@@ -32,11 +32,23 @@ function subOptionWarning (properties: any, optionName: any, parameter: any, val
properties[parameter] = value
}
-export async function unpackElectron(packager: PlatformPackager, out: string, platform: string, arch: string, electronVersion: string) {
- const electronDist = packager.config.electronDist
- if (electronDist == null) {
+export function unpackElectron(packager: PlatformPackager, out: string, platform: string, arch: string, version: string) {
+ return unpack(packager, out, platform, createDownloadOpts(packager.config, platform, arch, version))
+}
+
+export function unpackMuon(packager: PlatformPackager, out: string, platform: string, arch: string, version: string) {
+ return unpack(packager, out, platform, Object.assign({
+ mirror: "https://github.com/brave/muon/releases/download/v",
+ customFilename: `brave-v${version}-${platform}-${arch}.zip`,
+ verifyChecksum: false,
+ }, createDownloadOpts(packager.config, platform, arch, version)))
+}
+
+async function unpack(packager: PlatformPackager, out: string, platform: string, options: any) {
+ const dist = packager.config.electronDist
+ if (dist == null) {
const zipPath = (await BluebirdPromise.all([
- downloadElectron(createDownloadOpts(packager.config, platform, arch, electronVersion)),
+ downloadElectron(options),
emptyDir(out)
]))[0]
@@ -44,7 +56,7 @@ export async function unpackElectron(packager: PlatformPackager, out: strin
}
else {
await emptyDir(out)
- await copyDir(path.resolve(packager.info.projectDir, electronDist, "Electron.app"), path.join(out, "Electron.app"))
+ await copyDir(path.resolve(packager.info.projectDir, dist, "Electron.app"), path.join(out, "Electron.app"))
}
if (platform === "linux") {
diff --git a/packages/electron-builder/src/packager/mac.ts b/packages/electron-builder/src/packager/mac.ts
index a9ee1d2bf18..5849258784a 100644
--- a/packages/electron-builder/src/packager/mac.ts
+++ b/packages/electron-builder/src/packager/mac.ts
@@ -11,11 +11,11 @@ function doRename(basePath: string, oldName: string, newName: string) {
return rename(path.join(basePath, oldName), path.join(basePath, newName))
}
-function moveHelpers(frameworksPath: string, appName: string) {
+function moveHelpers(frameworksPath: string, appName: string, prefix: string) {
return BluebirdPromise.map([" Helper", " Helper EH", " Helper NP"], suffix => {
- const executableBasePath = path.join(frameworksPath, `Electron${suffix}.app`, "Contents", "MacOS")
- return doRename(executableBasePath, `Electron${suffix}`, appName + suffix)
- .then(() => doRename(frameworksPath, `Electron${suffix}.app`, `${appName}${suffix}.app`))
+ const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, "Contents", "MacOS")
+ return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix)
+ .then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))
})
}
@@ -29,13 +29,13 @@ export async function createApp(packager: PlatformPackager, appOutDir: stri
const appInfo = packager.appInfo
const appFilename = appInfo.productFilename
- const contentsPath = path.join(appOutDir, "Electron.app", "Contents")
+ const contentsPath = path.join(appOutDir, packager.electronDistMacOsAppName, "Contents")
const frameworksPath = path.join(contentsPath, "Frameworks")
const appPlistFilename = path.join(contentsPath, "Info.plist")
- const helperPlistFilename = path.join(frameworksPath, "Electron Helper.app", "Contents", "Info.plist")
- const helperEHPlistFilename = path.join(frameworksPath, "Electron Helper EH.app", "Contents", "Info.plist")
- const helperNPPlistFilename = path.join(frameworksPath, "Electron Helper NP.app", "Contents", "Info.plist")
+ const helperPlistFilename = path.join(frameworksPath, `${packager.electronDistMacOsExecutableName} Helper.app`, "Contents", "Info.plist")
+ const helperEHPlistFilename = path.join(frameworksPath, `${packager.electronDistMacOsExecutableName} Helper EH.app`, "Contents", "Info.plist")
+ const helperNPPlistFilename = path.join(frameworksPath, `${packager.electronDistMacOsExecutableName} Helper NP.app`, "Contents", "Info.plist")
const buildMetadata = packager.config!
const fileContents: Array = await BluebirdPromise.map([appPlistFilename, helperPlistFilename, helperEHPlistFilename, helperNPPlistFilename, (buildMetadata)["extend-info"]], it => it == null ? it : readFile(it, "utf8"))
@@ -140,7 +140,7 @@ export async function createApp(packager: PlatformPackager, appOutDir: stri
writeFile(helperPlistFilename, buildPlist(helperPlist)),
writeFile(helperEHPlistFilename, buildPlist(helperEHPlist)),
writeFile(helperNPPlistFilename, buildPlist(helperNPPlist)),
- doRename(path.join(contentsPath, "MacOS"), "Electron", appPlist.CFBundleExecutable),
+ doRename(path.join(contentsPath, "MacOS"), packager.electronDistMacOsExecutableName, appPlist.CFBundleExecutable),
unlinkIfExists(path.join(appOutDir, "LICENSE")),
unlinkIfExists(path.join(appOutDir, "LICENSES.chromium.html")),
]
@@ -152,7 +152,7 @@ export async function createApp(packager: PlatformPackager, appOutDir: stri
await BluebirdPromise.all(promises)
- await moveHelpers(frameworksPath, appFilename)
+ await moveHelpers(frameworksPath, appFilename, packager.electronDistMacOsExecutableName)
const appPath = path.join(appOutDir, `${appFilename}.app`)
await rename(path.dirname(contentsPath), appPath)
// https://github.com/electron-userland/electron-builder/issues/840
diff --git a/packages/electron-builder/src/packagerApi.ts b/packages/electron-builder/src/packagerApi.ts
index 24fd8671925..2f5670a9c3c 100644
--- a/packages/electron-builder/src/packagerApi.ts
+++ b/packages/electron-builder/src/packagerApi.ts
@@ -52,6 +52,7 @@ export interface BuildInfo {
readonly appDir: string
readonly electronVersion: string
+ readonly muonVersion?: string | null
readonly isTwoPackageJsonProjectLayoutUsed: boolean
diff --git a/packages/electron-builder/src/platformPackager.ts b/packages/electron-builder/src/platformPackager.ts
index 8cc63712220..c74df948b8b 100644
--- a/packages/electron-builder/src/platformPackager.ts
+++ b/packages/electron-builder/src/platformPackager.ts
@@ -12,7 +12,7 @@ import { AsarPackager, checkFileInArchive } from "./asarUtil"
import { copyFiles, FileMatcher } from "./fileMatcher"
import { createTransformer } from "./fileTransformer"
import { Config } from "./metadata"
-import { unpackElectron } from "./packager/dirPackager"
+import { unpackElectron, unpackMuon } from "./packager/dirPackager"
import { BuildInfo, PackagerOptions } from "./packagerApi"
import { readInstalled } from "./readInstalled"
@@ -139,6 +139,18 @@ export abstract class PlatformPackager
return matcher
}
+
+ get electronDistMacOsAppName() {
+ return this.info.muonVersion == null ? "Electron.app" : "Brave.app"
+ }
+
+ get electronDistExecutableName() {
+ return this.info.muonVersion == null ? "electron" : "brave"
+ }
+
+ get electronDistMacOsExecutableName() {
+ return this.info.muonVersion == null ? "Electron" : "Brave"
+ }
protected async doPack(outDir: string, appOutDir: string, platformName: string, arch: Arch, platformSpecificBuildOptions: DC, targets: Array) {
if (this.info.prepackaged != null) {
@@ -150,7 +162,7 @@ export abstract class PlatformPackager
const extraResourceMatchers = this.getExtraFileMatchers(true, appOutDir, macroExpander, platformSpecificBuildOptions)
const extraFileMatchers = this.getExtraFileMatchers(false, appOutDir, macroExpander, platformSpecificBuildOptions)
- const resourcesPath = this.platform === Platform.MAC ? path.join(appOutDir, "Electron.app", "Contents", "Resources") : path.join(appOutDir, "resources")
+ const resourcesPath = this.platform === Platform.MAC ? path.join(appOutDir, this.electronDistMacOsAppName, "Contents", "Resources") : path.join(appOutDir, "resources")
log(`Packaging for ${platformName} ${Arch[arch]} using electron ${this.info.electronVersion} to ${path.relative(this.projectDir, appOutDir)}`)
@@ -165,9 +177,10 @@ export abstract class PlatformPackager
}
else {
// prune dev or not listed dependencies
+ const muonVersion = this.info.muonVersion
await BluebirdPromise.all([
dependencies(appDir, ignoreFiles),
- unpackElectron(this, appOutDir, platformName, Arch[arch], this.info.electronVersion),
+ muonVersion == null ? unpackElectron(this, appOutDir, platformName, Arch[arch], this.info.electronVersion) : unpackMuon(this, appOutDir, platformName, Arch[arch], muonVersion),
])
if (debug.enabled) {
diff --git a/packages/electron-builder/src/winPackager.ts b/packages/electron-builder/src/winPackager.ts
index 67cc0dcb735..a140659a9bf 100644
--- a/packages/electron-builder/src/winPackager.ts
+++ b/packages/electron-builder/src/winPackager.ts
@@ -230,12 +230,12 @@ export class WinPackager extends PlatformPackager {
protected async postInitApp(appOutDir: string) {
const executable = path.join(appOutDir, `${this.appInfo.productFilename}.exe`)
- await rename(path.join(appOutDir, "electron.exe"), executable)
+ await rename(path.join(appOutDir, `${this.electronDistExecutableName}.exe`), executable)
await this.signAndEditResources(executable)
}
}
- async function checkIcon(file: string): Promise {
+async function checkIcon(file: string): Promise {
const fd = await open(file, "r")
const buffer = new Buffer(512)
try {
diff --git a/test/out/__snapshots__/muon.js.snap b/test/out/__snapshots__/muon.js.snap
new file mode 100644
index 00000000000..68145a84f23
--- /dev/null
+++ b/test/out/__snapshots__/muon.js.snap
@@ -0,0 +1,19 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`muon linux 1`] = `
+Object {
+ "linux": Array [],
+}
+`;
+
+exports[`muon mac 1`] = `
+Object {
+ "mac": Array [],
+}
+`;
+
+exports[`muon win 1`] = `
+Object {
+ "win": Array [],
+}
+`;
diff --git a/test/src/ExtraBuildTest.ts b/test/src/ExtraBuildTest.ts
index 7cf442bcb37..bd05089543f 100644
--- a/test/src/ExtraBuildTest.ts
+++ b/test/src/ExtraBuildTest.ts
@@ -142,4 +142,4 @@ test.ifAll.ifDevOrLinuxCi("scheme validation extraFiles", app({
}
],
},
-}))
+}))
\ No newline at end of file
diff --git a/test/src/muon.ts b/test/src/muon.ts
new file mode 100644
index 00000000000..b7798766155
--- /dev/null
+++ b/test/src/muon.ts
@@ -0,0 +1,23 @@
+import { DIR_TARGET, Platform } from "electron-builder-core"
+import { app } from "./helpers/packTester"
+
+test.ifAll.ifDevOrLinuxCi("muon linux", app({
+ targets: Platform.LINUX.createTarget(DIR_TARGET),
+ config: {
+ muonVersion: "2.56.9",
+ },
+}))
+
+test.ifAll.ifMac("muon mac", app({
+ targets: Platform.MAC.createTarget(DIR_TARGET),
+ config: {
+ muonVersion: "2.56.9",
+ },
+}))
+
+test.ifAll.ifMac("muon win", app({
+ targets: Platform.WINDOWS.createTarget(DIR_TARGET),
+ config: {
+ muonVersion: "2.56.9",
+ },
+}))
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 413d0cf2f08..72b67415e75 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -930,7 +930,7 @@ dashdash@^1.12.0:
dependencies:
assert-plus "^1.0.0"
-debug@^2.1.1, debug@^2.1.3, debug@^2.2.0, debug@^2.6.0, debug@^2.6.1, debug@^2.6.3:
+debug@^2.1.1, debug@^2.1.3, debug@^2.2.0, debug@^2.6.0, debug@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d"
dependencies:
@@ -1055,18 +1055,18 @@ ecc-jsbn@~0.1.1:
dependencies:
jsbn "~0.1.0"
-electron-download-tf@4.0.0:
- version "4.0.0"
- resolved "https://registry.yarnpkg.com/electron-download-tf/-/electron-download-tf-4.0.0.tgz#b2cd6af916ea94cc3723d8931961cb537fb2efff"
+electron-download-tf@4.1.1:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/electron-download-tf/-/electron-download-tf-4.1.1.tgz#127aaa6a10ccf598bc15ed6ae83390348ebb3b4b"
dependencies:
- debug "^2.6.1"
- fs-extra "^2.0.0"
+ debug "^2.6.3"
+ fs-extra "^2.1.2"
minimist "^1.2.0"
nugget "^2.0.1"
path-exists "^3.0.0"
rc "^1.1.7"
semver "^5.3.0"
- sumchecker "^2.0.1"
+ sumchecker "^2.0.2"
electron-macos-sign@~1.6.0:
version "1.6.0"
@@ -1282,7 +1282,7 @@ fs-extra-p@^4.0.2, fs-extra-p@^4.1.0:
bluebird-lst "^1.0.2"
fs-extra "^2.1.2"
-fs-extra@^2.0.0, fs-extra@^2.1.2:
+fs-extra@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.1.2.tgz#046c70163cef9aad46b0e4a7fa467fb22d71de35"
dependencies:
@@ -2255,7 +2255,7 @@ mime@^1.3.4:
dependencies:
brace-expansion "^1.0.0"
-minimist@0.0.8:
+minimist@0.0.8, minimist@~0.0.1:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
@@ -2263,10 +2263,6 @@ minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
-minimist@~0.0.1:
- version "0.0.10"
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
-
mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
@@ -3021,7 +3017,7 @@ strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
-sumchecker@^2.0.1:
+sumchecker@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.2.tgz#0f42c10e5d05da5d42eea3e56c3399a37d6c5b3e"
dependencies: