Skip to content

Commit

Permalink
feat(electron-updater): MacOS delta update
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Sep 8, 2018
1 parent 9eec0a9 commit 3ac5f7e
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 41 deletions.
3 changes: 0 additions & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"7zip-bin": "~4.0.2",
"@types/is-ci": "^1.1.0",
"app-builder-bin": "2.1.2",
"app-builder-bin": "2.1.3",
"archiver": "^3.0.0",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.5",
Expand Down Expand Up @@ -66,7 +66,7 @@
"temp-file": "^3.1.3",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.5.0",
"yargs": "^12.0.1"
"yargs": "^12.0.2"
},
"devDependencies": {
"@babel/core": "^7.0.0",
Expand All @@ -77,7 +77,7 @@
"@types/ejs": "^2.6.0",
"@types/electron-is-dev": "^0.3.0",
"@types/ini": "^1.3.29",
"@types/jest": "^23.3.1",
"@types/jest": "^23.3.2",
"@types/js-yaml": "^3.11.2",
"@types/lodash.isequal": "^4.5.3",
"@types/node-emoji": "^1.8.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"homepage": "https://github.com/electron-userland/electron-builder",
"dependencies": {
"7zip-bin": "~4.0.2",
"app-builder-bin": "2.1.2",
"app-builder-bin": "2.1.3",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.5",
"chromium-pickle-js": "^0.2.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/app-builder-lib/src/targets/ArchiveTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Platform, Target, TargetSpecificOptions } from "../core"
import { copyFiles, getFileMatchers } from "../fileMatcher"
import { PlatformPackager } from "../platformPackager"
import { archive, tar } from "./archive"
import { appendBlockmap } from "./differentialUpdateInfoBuilder"

export class ArchiveTarget extends Target {
readonly options: TargetSpecificOptions = (this.packager.config as any)[this.name]
Expand Down Expand Up @@ -31,6 +32,7 @@ export class ArchiveTarget extends Target {
const artifactPath = path.join(this.outDir, artifactName)

this.logBuilding(`${isMac ? "macOS " : ""}${format}`, artifactPath, arch)
let extraData: any = {}
if (format.startsWith("tar.")) {
await tar(packager.compression, format, artifactPath, appOutDir, isMac, packager.info.tempDirManager)
}
Expand All @@ -54,9 +56,14 @@ export class ArchiveTarget extends Target {
withoutDir,
}
await archive(format, artifactPath, dirToArchive, archiveOptions)

if (isMac && format === "zip") {
extraData = await appendBlockmap(artifactPath)
}
}

packager.info.dispatchArtifactCreated({
...extraData,
file: artifactPath,
// tslint:disable-next-line:no-invalid-template-strings
safeArtifactName: packager.computeSafeArtifactName(artifactName, format, arch, false, defaultPattern.replace("${productName}", "${name}")),
Expand Down
1 change: 0 additions & 1 deletion packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export class NsisTarget extends Target {
const data = await appendBlockmap(archiveFile)
return {
...data,
size: data.size!!,
path: archiveFile,
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"out"
],
"dependencies": {
"app-builder-bin": "2.1.2",
"app-builder-bin": "2.1.3",
"temp-file": "^3.1.3",
"fs-extra-p": "^4.6.1",
"is-ci": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"read-config-file": "3.1.2",
"sanitize-filename": "^1.6.1",
"update-notifier": "^2.5.0",
"yargs": "^12.0.1",
"yargs": "^12.0.2",
"lazy-val": "^1.0.3",
"app-builder-lib": "0.0.0-semantic-release",
"dmg-builder": "0.0.0-semantic-release"
Expand Down
9 changes: 9 additions & 0 deletions test/out/__snapshots__/PublishManagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ Object {
},
Object {
"arch": "x64",
"blockMapSize": 127345,
"file": "Test App ßW-1.1.0-mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
"sha512": "YPRXBemp3KHpVqEHTECfVUuifVqYP2nYrmb//FrGAzIiw8SEGB7HBd36tFT7yRFwrQ2U6kYbMvgTu+6ctt1hpg==",
"size": 120686349,
},
],
}
Expand Down Expand Up @@ -202,8 +205,11 @@ Object {
},
Object {
"arch": "x64",
"blockMapSize": 127340,
"file": "Test App ßW_1.1.0_mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
"sha512": "LZPJVLdboEIRPy7YecICcd6BZZa+YCvoqW8VBu9iFhf/QC/trLfvEOE0HZGns4wXdkXhYmb6rryfGL1gylG+xQ==",
"size": 120686337,
},
],
}
Expand Down Expand Up @@ -256,8 +262,11 @@ Object {
},
Object {
"arch": "x64",
"blockMapSize": 127340,
"file": "Test App ßW-1.1.0-mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
"sha512": "JhaaiG2kUWwHmf2meYGAgX0syjrQNqpVpjKoQyC4SbgHrk6uTeFnCoLSEFiEZ8DIUwmNLQIiiGLhyVwQSvRQOQ==",
"size": 120686337,
},
],
}
Expand Down
20 changes: 0 additions & 20 deletions test/out/linux/__snapshots__/snapTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ Object {
"sep": Object {
"adapter": "none",
"command": "command.sh",
"environment": Object {
"LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu/pulseaudio:$SNAP/usr/lib/x86_64-linux-gnu/mesa-egl:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu",
"PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH",
"TMPDIR": "$XDG_RUNTIME_DIR",
},
"plugs": Array [
"desktop",
"desktop-legacy",
Expand Down Expand Up @@ -295,11 +290,6 @@ Object {
"sep": Object {
"adapter": "none",
"command": "command.sh",
"environment": Object {
"LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu/pulseaudio:$SNAP/usr/lib/x86_64-linux-gnu/mesa-egl:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu",
"PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH",
"TMPDIR": "$XDG_RUNTIME_DIR",
},
"plugs": Array [
"desktop",
"desktop-legacy",
Expand Down Expand Up @@ -380,11 +370,6 @@ Object {
"sep": Object {
"adapter": "none",
"command": "command.sh",
"environment": Object {
"LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu/pulseaudio:$SNAP/usr/lib/x86_64-linux-gnu/mesa-egl:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu",
"PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH",
"TMPDIR": "$XDG_RUNTIME_DIR",
},
"plugs": Array [
"custom",
"desktop",
Expand Down Expand Up @@ -465,11 +450,6 @@ Object {
"sep": Object {
"adapter": "none",
"command": "command.sh",
"environment": Object {
"LD_LIBRARY_PATH": "$SNAP_LIBRARY_PATH:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu/pulseaudio:$SNAP/usr/lib/x86_64-linux-gnu/mesa-egl:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu",
"PATH": "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH",
"TMPDIR": "$XDG_RUNTIME_DIR",
},
"plugs": Array [
"foo1",
"desktop",
Expand Down
12 changes: 12 additions & 0 deletions test/out/mac/__snapshots__/dmgTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ Object {
"mac": Array [
Object {
"arch": "x64",
"blockMapSize": 127387,
"file": "Test App ßW-1.1.0-mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
"sha512": "/lf/N3touhGUzkjPk4TytPL+Hg6AxSV65I8VJXzSZLib4HLLat1AryKClx7yTsQ/9rCGzAXqlNS383p0ntEzFg==",
"size": 120757682,
},
],
}
Expand Down Expand Up @@ -81,8 +84,11 @@ Object {
"mac": Array [
Object {
"arch": "x64",
"blockMapSize": 127320,
"file": "Test App ßW-1.1.0-mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
"sha512": "6AiS1vGPYAP45ji+Ovm3+5CezDQH16EoDgAKf7lXcOZ8I2zUbplU+T77S54f0I5SPI/Fmx+2f3KRYaG1MATJCg==",
"size": 120686069,
},
],
}
Expand Down Expand Up @@ -2431,7 +2437,10 @@ Object {
},
Object {
"arch": "x64",
"blockMapSize": 127310,
"file": "NoApplicationsLink-1.1.0-mac.zip",
"sha512": "O18kVW/8pJU1NTUsCgp6VrFisjD4VBP9iqvx+EPZ2ZBqbgpjnyvCSHMn86708Qltig1q8Nl8SNbAjkLOMgIUnw==",
"size": 120690271,
},
],
}
Expand Down Expand Up @@ -2564,8 +2573,11 @@ Object {
"mac": Array [
Object {
"arch": "x64",
"blockMapSize": 127386,
"file": "Test App ßW-1.1.0-mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
"sha512": "y+HmbzqY93LBa8VYz1kX5Bn5aBylS6c6ZF41gv6MKMWoSlGVwS44egQEDx1hOh1T0ILJ/foCLg0sIsvLmPH5Xw==",
"size": 120742969,
},
],
}
Expand Down
3 changes: 3 additions & 0 deletions test/out/mac/__snapshots__/macArchiveTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ Object {
"mac": Array [
Object {
"arch": "x64",
"blockMapSize": 127338,
"file": "Test App ßW-1.1.0-mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
"sha512": "dNQkjqiqMu0ca74JpDyF/bmRGHvW8EBsgiI0CWAv9DMeJA9Rk33ePlq7kCjcR4XRl3eLzWZwIG/nZaJtr/zcig==",
"size": 120686249,
},
],
}
Expand Down
3 changes: 3 additions & 0 deletions test/out/mac/__snapshots__/macPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ Object {
},
Object {
"arch": "x64",
"blockMapSize": 127387,
"file": "Test App ßW-1.1.0-mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
"sha512": "3gnllNya5vkH7OSdN3Hjtl+kwPZB6pdbEMPAkKywQnNpdZjPBIUmqhP4aOafJ05UNeA0AFJbRieqdJYSgeUJYg==",
"size": 120756067,
},
],
}
Expand Down
3 changes: 3 additions & 0 deletions test/out/updater/__snapshots__/differentialUpdateTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ Object {
},
Object {
"arch": "x64",
"blockMapSize": 49987,
"file": "Test App ßW-1.0.0-mac.zip",
"safeArtifactName": "TestApp-1.0.0-mac.zip",
"sha512": "vQIR+0O404gAzQ9XXwBJ+ibHA8PpoK7Yg4IZOUTESj3dttla8LbcTaolkpxvCBZFiRr4HvbAWUeDVVIMliXWEw==",
"size": 46431114,
},
],
}
Expand Down
Loading

0 comments on commit 3ac5f7e

Please sign in to comment.