Skip to content

Commit 2154934

Browse files
committed
fix(linux): icon.icns is not used for Linux icon
Close #2617
1 parent 06008f6 commit 2154934

File tree

7 files changed

+83
-21
lines changed

7 files changed

+83
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"////": "All typings are added into root `package.json` to avoid duplication errors in the IDE compiler (several `node.d.ts` files).",
3030
"dependencies": {
3131
"7zip-bin": "~3.1.0",
32-
"app-builder-bin": "1.4.0",
32+
"app-builder-bin": "1.4.1",
3333
"archiver": "^2.1.1",
3434
"async-exit-hook": "^2.0.1",
3535
"aws-sdk": "^2.201.0",

packages/builder-util/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"out"
1212
],
1313
"dependencies": {
14-
"app-builder-bin": "1.4.0",
14+
"app-builder-bin": "1.4.1",
1515
"temp-file": "^3.1.1",
1616
"fs-extra-p": "^4.5.2",
1717
"is-ci": "^1.1.0",

packages/electron-builder-lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"homepage": "https://github.com/electron-userland/electron-builder",
4343
"dependencies": {
4444
"7zip-bin": "~3.1.0",
45-
"app-builder-bin": "1.4.0",
45+
"app-builder-bin": "1.4.1",
4646
"async-exit-hook": "^2.0.1",
4747
"bluebird-lst": "^1.0.5",
4848
"chromium-pickle-js": "^0.2.0",

packages/electron-builder-lib/src/targets/LinuxTargetHelper.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export class LinuxTargetHelper {
3636
sources.push(icnsPath)
3737
}
3838

39+
sources.push("icon.icns")
40+
3941
sources.push(path.join(getTemplatePath("linux"), "electron-icons"))
4042

4143
const result = await packager.resolveIcon(sources, "set")

test/out/linux/__snapshots__/linuxPackagerTest.js.snap

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,38 @@ Object {
176176
}
177177
`;
178178

179+
exports[`icons from ICNS if nothing specified 1`] = `
180+
Object {
181+
"linux": Array [
182+
Object {
183+
"arch": "x64",
184+
"file": "TestApp-1.1.0-x86_64.AppImage",
185+
"updateInfo": Object {
186+
"blockMapSize": "@blockMapSize",
187+
"sha512": "@sha512",
188+
"size": "@size",
189+
},
190+
},
191+
],
192+
}
193+
`;
194+
195+
exports[`icons from dir and one icon with suffix 1`] = `
196+
Object {
197+
"linux": Array [
198+
Object {
199+
"arch": "x64",
200+
"file": "TestApp-1.1.0-x86_64.AppImage",
201+
"updateInfo": Object {
202+
"blockMapSize": "@blockMapSize",
203+
"sha512": "@sha512",
204+
"size": "@size",
205+
},
206+
},
207+
],
208+
}
209+
`;
210+
179211
exports[`no-author-email 1`] = `
180212
"Please specify author 'email' in the application package.json
181213

test/src/linux/linuxPackagerTest.ts

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Arch, build, Platform } from "electron-builder"
2-
import { move, remove, rename } from "fs-extra-p"
2+
import { copyFile, move, remove, rename } from "fs-extra-p"
33
import * as path from "path"
44
import { assertThat } from "../helpers/fileAssert"
55
import { app, appThrows, modifyPackageJson } from "../helpers/packTester"
@@ -83,8 +83,36 @@ test.ifNotWindows("icons from ICNS (mac)", app({
8383
},
8484
},
8585
}, {
86-
projectDirCreated: it => move(path.join(it, "build", "icon.icns"), path.join(it, "resources", "time.icns"))
87-
.then(() => remove(path.join(it, "build"))),
86+
projectDirCreated: async projectDir => {
87+
await move(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "resources", "time.icns"))
88+
await remove(path.join(projectDir, "build"))
89+
},
90+
packed: async context => {
91+
const projectDir = context.getResources(Platform.LINUX)
92+
await assertThat(projectDir).isDirectory()
93+
},
94+
}))
95+
96+
test.ifNotWindows("icons from ICNS if nothing specified", app({
97+
targets: appImageTarget,
98+
config: {
99+
publish: null,
100+
},
101+
}, {
102+
projectDirCreated: async projectDir => {
103+
await remove(path.join(projectDir, "build", "icons"))
104+
},
105+
}))
106+
107+
test.ifNotWindows("icons from dir and one icon with suffix", app({
108+
targets: appImageTarget,
109+
config: {
110+
publish: null,
111+
},
112+
}, {
113+
projectDirCreated: async projectDir => {
114+
await copyFile(path.join(projectDir, "build", "icons", "16x16.png"), path.join(projectDir, "build", "icons", "16x16-dev.png"))
115+
},
88116
packed: async context => {
89117
const projectDir = context.getResources(Platform.LINUX)
90118
await assertThat(projectDir).isDirectory()

yarn.lock

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -275,25 +275,25 @@ anymatch@^1.3.0:
275275
micromatch "^2.1.5"
276276
normalize-path "^2.0.0"
277277

278-
app-builder-bin-linux@1.4.0:
279-
version "1.4.0"
280-
resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.4.0.tgz#8a5f1af5e4dd4c57efa00c2ba48864d872bad985"
278+
app-builder-bin-linux@1.4.1:
279+
version "1.4.1"
280+
resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.4.1.tgz#00eca4fbd3e9bdb04073b94b06c5a2c4a659f3d1"
281281

282-
app-builder-bin-mac@1.4.0:
283-
version "1.4.0"
284-
resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.4.0.tgz#415c12362a055aac9859feb70a66f5384f654c09"
282+
app-builder-bin-mac@1.4.1:
283+
version "1.4.1"
284+
resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.4.1.tgz#7385b1ed97e58ac4d8e3dc3b5dc6d76b67d97d8d"
285285

286-
app-builder-bin-win@1.4.0:
287-
version "1.4.0"
288-
resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.4.0.tgz#2e0df892c8cf686c47a54cfeeb60d6fe77837e10"
286+
app-builder-bin-win@1.4.1:
287+
version "1.4.1"
288+
resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.4.1.tgz#30806d14b13bdb7fce4021a7d4f5a9c9ecc9708e"
289289

290-
app-builder-bin@1.4.0:
291-
version "1.4.0"
292-
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.4.0.tgz#4e0903bd65aad1e715f8b22b40bbb2cd611bd39f"
290+
app-builder-bin@1.4.1:
291+
version "1.4.1"
292+
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.4.1.tgz#3ae86df2d3eb624ad93d097abe986fe07c2f5aca"
293293
optionalDependencies:
294-
app-builder-bin-linux "1.4.0"
295-
app-builder-bin-mac "1.4.0"
296-
app-builder-bin-win "1.4.0"
294+
app-builder-bin-linux "1.4.1"
295+
app-builder-bin-mac "1.4.1"
296+
app-builder-bin-win "1.4.1"
297297

298298
append-transform@^0.4.0:
299299
version "0.4.0"

0 commit comments

Comments
 (0)