Skip to content

Commit

Permalink
fix: warn "It is not possible to build OS X app on Windows"
Browse files Browse the repository at this point in the history
Closes #422
  • Loading branch information
develar committed Jun 2, 2016
1 parent ecdff3c commit f6c47f7
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
os: osx

osx_image: xcode7

env:
- NODE_VERSION=6
- NODE_VERSION=4
matrix:
include:
- os: osx
env: NODE_VERSION=6

- os: osx
env: TEST_FILES=osxPackagerTest,CodeSignTest NODE_VERSION=4

language: c

Expand Down
2 changes: 1 addition & 1 deletion docs/Multi Platform Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Don't expect that you can build app for all platforms on one platform.
* If your app has native dependencies, it can be compiled only on the target platform.
[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.

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

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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test": "node ./test/out/helpers/runTests.js",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"//": "Update wiki if docs changed. Update only if functionalily are generally available (latest release, not next)",
"update-wiki": "git subtree split -b wiki --prefix docs/ && git push wiki wiki:master",
"update-wiki": "git subtree split -b wiki --prefix docs/ && git push -f wiki wiki:master",
"whitespace": "whitespace src/*.ts",
"docker-images": "docker/build.sh"
},
Expand Down
4 changes: 4 additions & 0 deletions src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export class Packager implements BuildInfo {
// custom packager - don't check wine
let checkWine = this.options.platformPackagerFactory == null
for (let [platform, archToType] of this.options.targets!) {
if (platform === Platform.OSX && process.platform === Platform.WINDOWS.nodeName) {
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")
}

let wineCheck: Promise<string> | null = null
if (checkWine && process.platform !== "win32" && platform === Platform.WINDOWS) {
wineCheck = exec("wine", ["--version"])
Expand Down
4 changes: 3 additions & 1 deletion test/src/BuildTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from "./helpers/avaEx"
import { assertPack, modifyPackageJson, outDirName } from "./helpers/packTester"
import { assertPack, modifyPackageJson, outDirName, platform } from "./helpers/packTester"
import { expectedWinContents } from "./helpers/expectedContents"
import { move, outputFile, outputJson } from "fs-extra-p"
import { Promise as BluebirdPromise } from "bluebird"
Expand Down Expand Up @@ -243,6 +243,8 @@ test("copy extra content", async () => {
}
})

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.+/))

function allPlatforms(dist: boolean = true): PackagerOptions {
return {
targets: getPossiblePlatforms(dist ? null : DIR_TARGET),
Expand Down
4 changes: 2 additions & 2 deletions test/src/helpers/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async function copyDependencies() {
}

/**
* CIRCLE_NODE_INDEX=3 — test nodejs 4 (on Circle).
* CIRCLE_NODE_INDEX=2 — test nodejs 4 (on Circle).
*/
function runTests(): BluebirdPromise<any> {
const args: Array<string> = []
Expand All @@ -139,7 +139,7 @@ function runTests(): BluebirdPromise<any> {
}
else if (!isEmptyOrSpaces(process.env.CIRCLE_NODE_INDEX)) {
const circleNodeIndex = parseInt(process.env.CIRCLE_NODE_INDEX, 10)
if (circleNodeIndex === 0 || circleNodeIndex === 3) {
if (circleNodeIndex === 0 || circleNodeIndex === 2) {
skipWin = true
args.push(path.join(baseDir, "linuxPackagerTest.js"), path.join(baseDir, "BuildTest.js"))
}
Expand Down

0 comments on commit f6c47f7

Please sign in to comment.