Skip to content

Commit

Permalink
fix: Trouble building delta package for Squirrel.Windows on OSX
Browse files Browse the repository at this point in the history
Closes #407
  • Loading branch information
develar committed May 18, 2016
1 parent 4a9af55 commit cc8278a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ See all [appdmg options](https://www.npmjs.com/package/appdmg#json-specification
| Name | Description
| --- | ---
| icon | <a name="OsXBuildOptions-icon"></a>The path to icon, which will be shown when mounted (default: `build/icon.icns`).
| background | <a name="OsXBuildOptions-background"></a><p>The path to background (default: <code>build/background.png</code> if exists). The resolution of this file determines the resolution of the installer window. If background is not specified, use <code>window.size</code>, see [specification](https://github.com/LinusU/node-appdmg#json-specification)).</p>
| background | <a name="OsXBuildOptions-background"></a><p>The path to background (default: <code>build/background.png</code> if exists). The resolution of this file determines the resolution of the installer window. If background is not specified, use <code>window.size</code>, see [specification](https://github.com/LinusU/node-appdmg#json-specification).</p>
| target | <a name="OsXBuildOptions-target"></a>Target package type: list of `default`, `dmg`, `zip`, `mas`, `7z`. Defaults to `default` (dmg and zip for Squirrel.Mac).
| identity | <a name="OsXBuildOptions-identity"></a><p>The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](https://github.com/electron-userland/electron-builder/wiki/Code-Signing). MAS installer identity is specified in the [.build.mas](#MasBuildOptions-identity).</p>
| entitlements | <a name="OsXBuildOptions-entitlements"></a><p>The path to entitlements file for signing the app. <code>build/osx.entitlements</code> will be used if exists (it is a recommended way to set). MAS entitlements is specified in the [.build.mas](#MasBuildOptions-entitlements).</p>
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@
"dependencies": {
"7zip-bin": "^1.0.5",
"asar": "^0.11.0",
"bluebird": "^3.3.5",
"bluebird": "^3.4.0",
"chalk": "^1.1.3",
"command-line-args": "^2.1.6",
"compare-versions": "^2.0.1",
"debug": "^2.2.0",
"deep-assign": "^2.0.0",
"electron-osx-sign-tf": "0.4.0-beta.0",
"electron-packager-tf": "~7.1.0",
"electron-winstaller-fixed": "~2.8.2",
"electron-winstaller-fixed": "~2.8.3",
"fs-extra-p": "^1.0.1",
"globby": "^4.0.0",
"hosted-git-info": "^2.1.4",
"hosted-git-info": "^2.1.5",
"image-size": "^0.5.0",
"lodash.template": "^4.2.5",
"mime": "^1.3.4",
Expand All @@ -81,7 +81,7 @@
"tmp": "0.0.28"
},
"optionalDependencies": {
"appdmg": "^0.4.2"
"appdmg": "^0.4.3"
},
"config": {
"pre-git": {
Expand All @@ -94,7 +94,7 @@
"devDependencies": {
"ava-tf": "^0.12.4-beta.6",
"babel-plugin-array-includes": "^2.0.3",
"babel-plugin-transform-es2015-parameters": "^6.8.0",
"babel-plugin-transform-es2015-parameters": "^6.9.0",
"babel-plugin-transform-es2015-spread": "^6.8.0",
"decompress-zip": "^0.3.0",
"electron-download": "^2.1.2",
Expand All @@ -106,7 +106,7 @@
"should": "^8.3.1",
"ts-babel": "^0.8.6",
"tsconfig-glob": "^0.4.3",
"tslint": "3.10.0-dev.1",
"tslint": "3.10.2",
"typescript": "1.9.0-dev.20160515",
"whitespace": "^2.0.0"
},
Expand Down
14 changes: 10 additions & 4 deletions src/winPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class WinPackager extends PlatformPackager<WinBuildOptions> {
}
}

protected async computeEffectiveDistOptions(appOutDir: string, installerOutDir: string, packOptions: ElectronPackagerOptions, setupExeName: string): Promise<any> {
protected async computeEffectiveDistOptions(appOutDir: string, installerOutDir: string, packOptions: ElectronPackagerOptions, setupExeName: string): Promise<WinBuildOptions> {
let iconUrl = this.customBuildOptions.iconUrl || this.devMetadata.build.iconUrl
if (iconUrl == null) {
if (this.info.repositoryInfo != null) {
Expand Down Expand Up @@ -171,10 +171,16 @@ export class WinPackager extends PlatformPackager<WinBuildOptions> {
const archSuffix = arch === "x64" ? "" : ("-" + arch)
const setupExeName = `${this.appName} Setup ${version}${archSuffix}.exe`

await winstaller.createWindowsInstaller(await this.computeEffectiveDistOptions(appOutDir, installerOutDir, packOptions, setupExeName))

const distOptions = await this.computeEffectiveDistOptions(appOutDir, installerOutDir, packOptions, setupExeName)
await winstaller.createWindowsInstaller(distOptions)
this.dispatchArtifactCreated(path.join(installerOutDir, setupExeName), `${this.metadata.name}-Setup-${version}${archSuffix}.exe`)
this.dispatchArtifactCreated(path.join(installerOutDir, `${this.metadata.name}-${winstaller.convertVersion(version)}-full.nupkg`))

const packagePrefix = `${this.metadata.name}-${winstaller.convertVersion(version)}-`
this.dispatchArtifactCreated(path.join(installerOutDir, `${packagePrefix}full.nupkg`))
if (distOptions.remoteReleases != null) {
this.dispatchArtifactCreated(path.join(installerOutDir, `${packagePrefix}delta.nupkg`))
}

this.dispatchArtifactCreated(path.join(installerOutDir, "RELEASES"))
}
}
Expand Down
29 changes: 21 additions & 8 deletions test/src/winPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,33 @@ const __awaiter = require("out/awaiter")

test.ifNotCiOsx("win", () => assertPack("test-app-one", signed({
platform: [Platform.WINDOWS],
arch: "all",
arch: "x64",
}),
{
tempDirCreated: process.env.TEST_DELTA ? it => modifyPackageJson(it, data => {
data.build.win = {
remoteReleases: "https://github.com/develar/__test-app-releases",
}
}) : null,
expectedArtifacts: [
"RELEASES",
"TestApp Setup 1.1.0.exe",
"TestApp-1.1.0-full.nupkg"
],
}
))

test.ifNotCiOsx("delta", () => assertPack("test-app-one", {
platform: [Platform.WINDOWS],
arch: "ia32",
devMetadata: {
build: {
win: {
remoteReleases: "https://github.com/develar/__test-app-releases",
}
}
},
},
{
expectedArtifacts: [
"RELEASES",
"TestApp Setup 1.1.0-ia32.exe",
"TestApp Setup 1.1.0.exe",
"TestApp-1.1.0-full.nupkg",
"TestApp-1.1.0-delta.nupkg",
"TestApp-1.1.0-full.nupkg"
],
}
Expand Down

0 comments on commit cc8278a

Please sign in to comment.