Skip to content

Commit

Permalink
fix(linux): icon.icns is not used for Linux icon
Browse files Browse the repository at this point in the history
Close #2617
  • Loading branch information
develar committed Feb 23, 2018
1 parent 06008f6 commit 2154934
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"////": "All typings are added into root `package.json` to avoid duplication errors in the IDE compiler (several `node.d.ts` files).",
"dependencies": {
"7zip-bin": "~3.1.0",
"app-builder-bin": "1.4.0",
"app-builder-bin": "1.4.1",
"archiver": "^2.1.1",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.201.0",
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": "1.4.0",
"app-builder-bin": "1.4.1",
"temp-file": "^3.1.1",
"fs-extra-p": "^4.5.2",
"is-ci": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-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": "~3.1.0",
"app-builder-bin": "1.4.0",
"app-builder-bin": "1.4.1",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.5",
"chromium-pickle-js": "^0.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export class LinuxTargetHelper {
sources.push(icnsPath)
}

sources.push("icon.icns")

sources.push(path.join(getTemplatePath("linux"), "electron-icons"))

const result = await packager.resolveIcon(sources, "set")
Expand Down
32 changes: 32 additions & 0 deletions test/out/linux/__snapshots__/linuxPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,38 @@ Object {
}
`;

exports[`icons from ICNS if nothing specified 1`] = `
Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
},
},
],
}
`;

exports[`icons from dir and one icon with suffix 1`] = `
Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
},
},
],
}
`;

exports[`no-author-email 1`] = `
"Please specify author 'email' in the application package.json
Expand Down
34 changes: 31 additions & 3 deletions test/src/linux/linuxPackagerTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Arch, build, Platform } from "electron-builder"
import { move, remove, rename } from "fs-extra-p"
import { copyFile, move, remove, rename } from "fs-extra-p"
import * as path from "path"
import { assertThat } from "../helpers/fileAssert"
import { app, appThrows, modifyPackageJson } from "../helpers/packTester"
Expand Down Expand Up @@ -83,8 +83,36 @@ test.ifNotWindows("icons from ICNS (mac)", app({
},
},
}, {
projectDirCreated: it => move(path.join(it, "build", "icon.icns"), path.join(it, "resources", "time.icns"))
.then(() => remove(path.join(it, "build"))),
projectDirCreated: async projectDir => {
await move(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "resources", "time.icns"))
await remove(path.join(projectDir, "build"))
},
packed: async context => {
const projectDir = context.getResources(Platform.LINUX)
await assertThat(projectDir).isDirectory()
},
}))

test.ifNotWindows("icons from ICNS if nothing specified", app({
targets: appImageTarget,
config: {
publish: null,
},
}, {
projectDirCreated: async projectDir => {
await remove(path.join(projectDir, "build", "icons"))
},
}))

test.ifNotWindows("icons from dir and one icon with suffix", app({
targets: appImageTarget,
config: {
publish: null,
},
}, {
projectDirCreated: async projectDir => {
await copyFile(path.join(projectDir, "build", "icons", "16x16.png"), path.join(projectDir, "build", "icons", "16x16-dev.png"))
},
packed: async context => {
const projectDir = context.getResources(Platform.LINUX)
await assertThat(projectDir).isDirectory()
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -275,25 +275,25 @@ anymatch@^1.3.0:
micromatch "^2.1.5"
normalize-path "^2.0.0"

[email protected].0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.4.0.tgz#8a5f1af5e4dd4c57efa00c2ba48864d872bad985"
[email protected].1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.4.1.tgz#00eca4fbd3e9bdb04073b94b06c5a2c4a659f3d1"

[email protected].0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.4.0.tgz#415c12362a055aac9859feb70a66f5384f654c09"
[email protected].1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.4.1.tgz#7385b1ed97e58ac4d8e3dc3b5dc6d76b67d97d8d"

[email protected].0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.4.0.tgz#2e0df892c8cf686c47a54cfeeb60d6fe77837e10"
[email protected].1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.4.1.tgz#30806d14b13bdb7fce4021a7d4f5a9c9ecc9708e"

[email protected].0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.4.0.tgz#4e0903bd65aad1e715f8b22b40bbb2cd611bd39f"
[email protected].1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.4.1.tgz#3ae86df2d3eb624ad93d097abe986fe07c2f5aca"
optionalDependencies:
app-builder-bin-linux "1.4.0"
app-builder-bin-mac "1.4.0"
app-builder-bin-win "1.4.0"
app-builder-bin-linux "1.4.1"
app-builder-bin-mac "1.4.1"
app-builder-bin-win "1.4.1"

append-transform@^0.4.0:
version "0.4.0"
Expand Down

0 comments on commit 2154934

Please sign in to comment.