Skip to content

Commit

Permalink
fix: vendor/osx/7za seems to be broken
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Apr 8, 2016
1 parent 2dd5d7c commit 487164d
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 718 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ addons:
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gnu-tar dpkg libicns graphicsmagick git-lfs; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git lfs pull; fi
- git-lfs pull
- gem install --no-rdoc --no-ri fpm

install:
- nvm install $NODE_VERSION
- npm install npm -g
- npm prune
- npm install Microsoft/TypeScript
- npm install

script:
Expand Down
19 changes: 18 additions & 1 deletion docs/multi-platform-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,26 @@ gem install fpm
## Linux
To build app in distributable format for Linux:
```
sudo apt-get install icnsutils graphicsmagick
sudo apt-get install ruby-dev gcc make icnsutils graphicsmagick
gem install fpm
```

To build app in distributable format for Windows on Linux:
* Install Wine:
```
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine1.8 winetricks
winetricks -q vcrun2013
```
* Install [Mono](http://www.mono-project.com/docs/getting-started/install/linux/#usage):
```
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-complete
```

## Windows

Not documented yet.
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"main": "out/index.js",
"files": [
"out",
"templates",
"vendor"
"templates"
],
"bin": {
"build": "./out/build-cli.js",
Expand Down Expand Up @@ -55,12 +54,11 @@
"dependencies": {
"bluebird": "^3.3.4",
"command-line-args": "^2.1.6",
"electron-packager": "^6.0.0",
"electron-winstaller-fixed": "^2.0.6-beta.7",
"electron-packager": "^6.0.1",
"electron-winstaller-fixed": "^2.0.6-beta.8",
"fs-extra": "^0.26.7",
"fs-extra-p": "^0.2.0",
"globby": "^4.0.0",
"gm": "^1.21.1",
"hosted-git-info": "^2.1.4",
"image-size": "^0.5.0",
"lodash.template": "^4.2.4",
Expand All @@ -69,7 +67,8 @@
"progress-stream": "^1.2.0",
"read-package-json": "^2.0.3",
"source-map-support": "^0.4.0",
"tmp": "0.0.28"
"tmp": "0.0.28",
"7zip-bin": "0.0.1"
},
"optionalDependencies": {
"appdmg": "^0.3.6"
Expand All @@ -90,7 +89,7 @@
"ts-babel": "^0.6.9",
"tsconfig-glob": "^0.4.3",
"tslint": "next",
"typescript": "^1.9.0-dev.20160405",
"typescript": "^1.9.0-dev.20160408",
"validate-commit-msg": "^2.5.0"
},
"babel": {
Expand Down
10 changes: 2 additions & 8 deletions src/linuxPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Platform, LinuxBuildOptions } from "./metadata"
import { dir as _tpmDir, TmpOptions } from "tmp"
import { exec, log } from "./util"
import { outputFile, readFile, readdir } from "fs-extra-p"
import { State as Gm } from "gm"
const template = require("lodash.template")

//noinspection JSUnusedLocalSymbols
Expand Down Expand Up @@ -100,16 +99,11 @@ Icon=${this.metadata.name}
const output = outputs[0].toString()
log(output)

const gm = require("gm")

const imagePath = path.join(tempDir, "icon_256x256x32.png")

function resize(size: number): BluebirdPromise<any> {
return new BluebirdPromise((resolve, reject) => {
(<Gm>gm(imagePath))
.resize(size, size)
.write(path.join(tempDir, `icon_${size}x${size}x32.png`), error => error == null ? resolve() : reject(error))
})
const sizeArg = `${size}x${size}`
return exec("gm", ["convert", "-size", sizeArg, imagePath, "-resize", sizeArg, path.join(tempDir, `icon_${size}x${size}x32.png`)])
}

const promises: Array<Promise<any>> = [resize(24), resize(96)]
Expand Down
3 changes: 2 additions & 1 deletion src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Promise as BluebirdPromise } from "bluebird"
import { log, spawn } from "./util"
import { createKeychain, deleteKeychain, CodeSigningInfo, generateKeychainName, sign } from "./codeSign"
import { stat } from "fs-extra-p"
import { path7za } from "7zip-bin"

//noinspection JSUnusedLocalSymbols
const __awaiter = require("./awaiter")
Expand Down Expand Up @@ -112,7 +113,7 @@ export default class MacPackager extends PlatformPackager<OsXBuildOptions> {
}
args.push(resultPath, this.appName + ".app")

return spawn(path.join(__dirname, "..", "vendor", "osx", "7za"), args, {
return spawn(path7za, args, {
cwd: outDir,
stdio: ["ignore", "ignore", "inherit"],
})
Expand Down
14 changes: 1 addition & 13 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
# Running Windows tests on OS X

```
brew install Caskroom/cask/xquartz wine mono
```

# Running Linux tests on OS X
Do not use OS X bundled Ruby. Install using `brew`.

```
brew install ruby gnu-tar dpkg libicns graphicsmagick
gem install fpm
```
In addition to [required system packages](./multi-platform-build.md), on OS X `dpkg` is required to run Linux tests: `brew install dpkg`

# Inspect output if test uses temporary directory
Set environment variable `TEST_APP_TMP_DIR` (e.g. `/tmp/electron-builder-test`).
Expand Down
9 changes: 3 additions & 6 deletions test/fixtures/test-app-one/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "TestApp",
"version": "1.0.0",
"version": "1.1.0",
"homepage": "http://foo.example.com",
"description": "Test Application",
"scripts": {
Expand All @@ -10,15 +10,12 @@
"author": "Foo Bar <[email protected]>",
"license": "MIT",
"devDependencies": {
"electron-prebuilt": "^0.37.3"
"electron-prebuilt": "^0.37.5"
},
"build": {
"app-bundle-id": "your.id",
"app-category-type": "your.app.category.type",
"iconUrl": "https://raw.githubusercontent.com/szwacz/electron-boilerplate/master/resources/windows/icon.ico",
"compression": "store",
"win": {
"title": "My App"
}
"compression": "store"
}
}
2 changes: 1 addition & 1 deletion test/fixtures/test-app/app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "TestApp",
"version": "1.0.0",
"version": "1.1.0",
"description": "Test Application",
"author": "Foo Bar",
"homepage": "https://github.com/atom/electron-quick-start#readme",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"start": "electron ."
},
"devDependencies": {
"electron-prebuilt": "^0.37.3"
"electron-prebuilt": "^0.37.5"
},
"build": {
"app-bundle-id": "your.id",
Expand Down
48 changes: 20 additions & 28 deletions test/src/BuildTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,29 @@ import { Platform, PackagerOptions } from "out"
//noinspection JSUnusedLocalSymbols
const __awaiter = require("out/awaiter")

test("custom app dir", async () => {
await assertPack("test-app-one", allPlatformsAndCurrentArch(), {
tempDirCreated: (projectDir) => {
return BluebirdPromise.all([
modifyPackageJson(projectDir, data => {
data.directories = {
buildResources: "custom"
}
}),
move(path.join(projectDir, "build"), path.join(projectDir, "custom"))
])
}
})
})
test("custom buildResources dir", () => assertPack("test-app-one", allPlatformsAndCurrentArch(), {
tempDirCreated: projectDir => BluebirdPromise.all([
modifyPackageJson(projectDir, data => {
data.directories = {
buildResources: "custom"
}
}),
move(path.join(projectDir, "build"), path.join(projectDir, "custom"))
])
}))

test("productName with space", () => assertPack("test-app-one", allPlatformsAndCurrentArch(), {
tempDirCreated: projectDir => {
return modifyPackageJson(projectDir, data => {
data.productName = "Test App"
})
}
tempDirCreated: projectDir => modifyPackageJson(projectDir, data => {
data.productName = "Test App"
})
}))

test("build in the app package.json", t => t.throws(assertPack("test-app", allPlatformsAndCurrentArch(), {
tempDirCreated: projectDir => {
return modifyPackageJson(projectDir, data => {
data.build = {
"iconUrl": "bar",
}
}, true)
}
tempDirCreated: projectDir => modifyPackageJson(projectDir, data => {
data.build = {
"iconUrl": "bar",
}
}, true)
}), /'build' in the application package\.json .+/))

test("version from electron-prebuilt dependency", () => assertPack("test-app-one", {
Expand All @@ -49,7 +41,7 @@ test("version from electron-prebuilt dependency", () => assertPack("test-app-one
tempDirCreated: projectDir => {
return BluebirdPromise.all([
outputJson(path.join(projectDir, "node_modules", "electron-prebuilt", "package.json"), {
version: "0.37.3"
version: "0.37.5"
}),
modifyPackageJson(projectDir, data => {
data.devDependencies = {}
Expand Down Expand Up @@ -133,7 +125,7 @@ test("copy extra resource", async () => {
"lib/net45/foo/nameWithoutDot",
"lib/net45/locales/en-US.pak",
"lib/net45/resources/app.asar",
"lib/net45/resources/atom.asar",
"lib/net45/resources/electron.asar",
"lib/net45/win/x64.txt",
"TestApp.nuspec",
"[Content_Types].xml",
Expand Down
4 changes: 2 additions & 2 deletions test/src/helpers/expectedContents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const expectedLinuxContents = [
"/usr/share/",
"/opt/TestApp/resources/",
"/opt/TestApp/resources/app.asar",
"/opt/TestApp/resources/atom.asar",
"/opt/TestApp/resources/electron.asar",
"/usr/share/applications/",
"/usr/share/applications/TestApp.desktop",
"/usr/share/doc/",
Expand Down Expand Up @@ -76,7 +76,7 @@ export const expectedWinContents = [
"lib/net45/xinput1_3.dll",
"lib/net45/locales/en-US.pak",
"lib/net45/resources/app.asar",
"lib/net45/resources/atom.asar",
"lib/net45/resources/electron.asar",
"TestApp.nuspec",
"[Content_Types].xml",
"_rels/.rels"
Expand Down
28 changes: 14 additions & 14 deletions test/src/helpers/packTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ async function checkLinuxResult(projectDir: string, packager: Packager, packager
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb", productName), null, 2))
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName), null, 2))

const packageFile = projectDir + "/dist/TestApp-1.0.0-amd64.deb"
const packageFile = projectDir + "/dist/TestApp-1.1.0-amd64.deb"
assertThat(await getContents(packageFile, productName)).deepEqual(expectedContents)
if (packagerOptions.arch === "all" || packagerOptions.arch === "ia32") {
assertThat(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName)).deepEqual(expectedContents)
assertThat(await getContents(projectDir + "/dist/TestApp-1.1.0-i386.deb", productName)).deepEqual(expectedContents)
}

const regexp = /^ *(\w+): *(.+)$/gm
Expand All @@ -161,20 +161,20 @@ async function checkOsXResult(packager: Packager, artifacts: Array<ArtifactCreat
CFBundleDisplayName: productName,
CFBundleIdentifier: "your.id",
LSApplicationCategoryType: "your.app.category.type",
CFBundleVersion: "1.0.0" + "." + (process.env.TRAVIS_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM)
CFBundleVersion: "1.1.0" + "." + (process.env.TRAVIS_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM)
})

const result = await exec("codesign", ["--verify", packedAppDir])
assertThat(result[0].toString()).not.match(/is not signed at all/)

assertThat(artifacts.map(it => path.basename(it.file)).sort()).deepEqual([
`${productName}-1.0.0-mac.zip`,
`${productName}-1.0.0.dmg`,
`${productName}-1.1.0-mac.zip`,
`${productName}-1.1.0.dmg`,
].sort())

assertThat(artifacts.map(it => it.artifactName).sort()).deepEqual([
"TestApp-1.0.0-mac.zip",
"TestApp-1.0.0.dmg",
"TestApp-1.1.0-mac.zip",
"TestApp-1.1.0.dmg",
].sort())
}

Expand All @@ -184,8 +184,8 @@ async function checkWindowsResult(packager: Packager, packagerOptions: PackagerO
function getWinExpected(archSuffix: string) {
return [
`RELEASES${archSuffix}`,
`${productName}Setup-1.0.0${archSuffix}.exe`,
`TestApp-1.0.0${archSuffix}-full.nupkg`,
`${productName}Setup-1.1.0${archSuffix}.exe`,
`TestApp-1.1.0${archSuffix}-full.nupkg`,
]
}

Expand All @@ -202,11 +202,11 @@ async function checkWindowsResult(packager: Packager, packagerOptions: PackagerO

if (archSuffix == "") {
const expectedArtifactNames = expected.slice()
expectedArtifactNames[1] = `TestAppSetup-1.0.0${archSuffix}.exe`
assertThat(artifacts.map(it => it.artifactName).filter(it => it != null)).deepEqual([`TestAppSetup-1.0.0${archSuffix}.exe`])
expectedArtifactNames[1] = `TestAppSetup-1.1.0${archSuffix}.exe`
assertThat(artifacts.map(it => it.artifactName).filter(it => it != null)).deepEqual([`TestAppSetup-1.1.0${archSuffix}.exe`])
}

const packageFile = path.join(path.dirname(artifacts[0].file), `TestApp-1.0.0${archSuffix}-full.nupkg`)
const packageFile = path.join(path.dirname(artifacts[0].file), `TestApp-1.1.0${archSuffix}-full.nupkg`)
const unZipper = new DecompressZip(packageFile)
const fileDescriptors = await unZipper.getFiles()

Expand All @@ -231,8 +231,8 @@ async function checkWindowsResult(packager: Packager, packagerOptions: PackagerO
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>TestApp</id>
<version>1.0.0</version>
<title>My App</title>
<version>1.1.0</version>
<title>${productName}</title>
<authors>Foo Bar</authors>
<owners>Foo Bar</owners>
<projectUrl>http://foo.example.com</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion test/src/helpers/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const rootDir = path.join(__dirname, "..", "..", "..")
const testPackageDir = path.join(require("os").tmpdir(), "electron_builder_published")
const testNodeModules = path.join(testPackageDir, "node_modules")

const electronVersion = "0.37.3"
const electronVersion = "0.37.5"

BluebirdPromise.all([
deleteOldElectronVersion(),
Expand Down
12 changes: 10 additions & 2 deletions test/src/winPackagerTest.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import test from "./helpers/avaEx"
import { assertPack, platform } from "./helpers/packTester"
import { assertPack, platform, modifyPackageJson } from "./helpers/packTester"
import { move } from "fs-extra-p"
import * as path from "path"

//noinspection JSUnusedLocalSymbols
const __awaiter = require("out/awaiter")

test.ifNotTravis("win", () => assertPack("test-app-one", platform("win32")))
test.ifNotTravis("win", () => assertPack("test-app-one", {
platform: ["win32"],
}, {
tempDirCreated: it => modifyPackageJson(it, data => {
// data.build.win = {
// remoteReleases: "https://github.com/develar/__test-app-releases",
// }
})
}))

test.ifNotTravis("icon < 256", (t: any) => t.throws(assertPack("test-app-one", platform("win32"), {
tempDirCreated: projectDir => move(path.join(projectDir, "build", "incorrect.ico"), path.join(projectDir, "build", "icon.ico"), {clobber: true})
Expand Down
Loading

0 comments on commit 487164d

Please sign in to comment.