Skip to content

Commit f6c47f7

Browse files
committed
fix: warn "It is not possible to build OS X app on Windows"
Closes #422
1 parent ecdff3c commit f6c47f7

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

.travis.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
os: osx
2-
31
osx_image: xcode7
42

5-
env:
6-
- NODE_VERSION=6
7-
- NODE_VERSION=4
3+
matrix:
4+
include:
5+
- os: osx
6+
env: NODE_VERSION=6
7+
8+
- os: osx
9+
env: TEST_FILES=osxPackagerTest,CodeSignTest NODE_VERSION=4
810

911
language: c
1012

docs/Multi Platform Build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Don't expect that you can build app for all platforms on one platform.
33
* If your app has native dependencies, it can be compiled only on the target platform.
44
[prebuild](https://www.npmjs.com/package/prebuild) is a solution, but most node modules [don't provide](https://github.com/atom/node-keytar/issues/27) prebuilt binaries.
55

6-
* OS Code Signing works only OS X. [Cannot be fixed](http://stackoverflow.com/a/12156576).
6+
* OS Code Signing works only on OS X. [Cannot be fixed](http://stackoverflow.com/a/12156576).
77
* Windows Code Signing doesn't work on Linux. We are going to fix it soon.
88

99
Don't think that mentioned issues are major, you should use build servers — e.g. [AppVeyor](http://www.appveyor.com/) to build Windows app and [Travis](https://travis-ci.org) to build OS X/Linux apps.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"test": "node ./test/out/helpers/runTests.js",
2323
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
2424
"//": "Update wiki if docs changed. Update only if functionalily are generally available (latest release, not next)",
25-
"update-wiki": "git subtree split -b wiki --prefix docs/ && git push wiki wiki:master",
25+
"update-wiki": "git subtree split -b wiki --prefix docs/ && git push -f wiki wiki:master",
2626
"whitespace": "whitespace src/*.ts",
2727
"docker-images": "docker/build.sh"
2828
},

src/packager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export class Packager implements BuildInfo {
7777
// custom packager - don't check wine
7878
let checkWine = this.options.platformPackagerFactory == null
7979
for (let [platform, archToType] of this.options.targets!) {
80+
if (platform === Platform.OSX && process.platform === Platform.WINDOWS.nodeName) {
81+
throw new Error("Build for OS X is supported only on OS X, please see https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build")
82+
}
83+
8084
let wineCheck: Promise<string> | null = null
8185
if (checkWine && process.platform !== "win32" && platform === Platform.WINDOWS) {
8286
wineCheck = exec("wine", ["--version"])

test/src/BuildTest.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from "./helpers/avaEx"
2-
import { assertPack, modifyPackageJson, outDirName } from "./helpers/packTester"
2+
import { assertPack, modifyPackageJson, outDirName, platform } from "./helpers/packTester"
33
import { expectedWinContents } from "./helpers/expectedContents"
44
import { move, outputFile, outputJson } from "fs-extra-p"
55
import { Promise as BluebirdPromise } from "bluebird"
@@ -243,6 +243,8 @@ test("copy extra content", async () => {
243243
}
244244
})
245245

246+
test.ifWinCi("Build OS X on Windows is not supported", (t: any) => t.throws(assertPack("test-app-one", platform(Platform.OSX)), /Build for OS X is supported only on OS X.+/))
247+
246248
function allPlatforms(dist: boolean = true): PackagerOptions {
247249
return {
248250
targets: getPossiblePlatforms(dist ? null : DIR_TARGET),

test/src/helpers/runTests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async function copyDependencies() {
119119
}
120120

121121
/**
122-
* CIRCLE_NODE_INDEX=3 — test nodejs 4 (on Circle).
122+
* CIRCLE_NODE_INDEX=2 — test nodejs 4 (on Circle).
123123
*/
124124
function runTests(): BluebirdPromise<any> {
125125
const args: Array<string> = []
@@ -139,7 +139,7 @@ function runTests(): BluebirdPromise<any> {
139139
}
140140
else if (!isEmptyOrSpaces(process.env.CIRCLE_NODE_INDEX)) {
141141
const circleNodeIndex = parseInt(process.env.CIRCLE_NODE_INDEX, 10)
142-
if (circleNodeIndex === 0 || circleNodeIndex === 3) {
142+
if (circleNodeIndex === 0 || circleNodeIndex === 2) {
143143
skipWin = true
144144
args.push(path.join(baseDir, "linuxPackagerTest.js"), path.join(baseDir, "BuildTest.js"))
145145
}

0 commit comments

Comments
 (0)