Skip to content

Commit 05baad5

Browse files
committed
feat(linux): Install libappindicator1 and libnotify as a dependency of the linux package
1 parent 153e857 commit 05baad5

File tree

7 files changed

+50
-8
lines changed

7 files changed

+50
-8
lines changed

.idea/dictionaries/develar.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ MAS (Mac Application Store) specific options (in addition to `build.osx`).
105105
| maintainer | <a name="LinuxBuildOptions-maintainer"></a>The maintainer. Defaults to [author](#AppMetadata-author).
106106
| vendor | <a name="LinuxBuildOptions-vendor"></a>The vendor. Defaults to [author](#AppMetadata-author).
107107
| compression | <a name="LinuxBuildOptions-compression"></a>*deb-only.* The compression type, one of `gz`, `bzip2`, `xz` (default: `xz`).
108+
| depends | <a name="LinuxBuildOptions-depends"></a>Package dependencies. Defaults to `["libappindicator1", "libnotify"]`.
108109

109110
<a name="MetadataDirectories"></a>
110111
## `.directories`

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"debug": "^2.2.0",
6666
"deep-assign": "^2.0.0",
6767
"electron-osx-sign-tf": "0.4.0-beta.0",
68-
"electron-packager-tf": "^7.0.2-beta.0",
68+
"electron-packager-tf": "~7.1.0",
6969
"electron-winstaller-fixed": "~2.8.2",
7070
"fs-extra-p": "^1.0.1",
7171
"globby": "^4.0.0",
@@ -107,7 +107,7 @@
107107
"ts-babel": "^0.8.6",
108108
"tsconfig-glob": "^0.4.3",
109109
"tslint": "3.10.0-dev.1",
110-
"typescript": "1.9.0-dev.20160513",
110+
"typescript": "1.9.0-dev.20160515",
111111
"whitespace": "^2.0.0"
112112
},
113113
"babel": {

src/linuxPackager.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,23 @@ Icon=${this.metadata.name}
214214
"--url", projectUrl,
215215
]
216216

217+
let depends = options.depends
218+
if (depends == null) {
219+
depends = ["libappindicator1", "libnotify"]
220+
}
221+
else if (!Array.isArray(depends)) {
222+
if (typeof depends === "string") {
223+
depends = [<string>depends]
224+
}
225+
else {
226+
throw new Error(`depends must be Array or String, but specified as: ${depends}`)
227+
}
228+
}
229+
230+
for (let dep of depends) {
231+
args.push("--depends", dep)
232+
}
233+
217234
use(this.metadata.license || this.devMetadata.license, it => args.push("--license", it!))
218235
use(this.computeBuildNumber(), it => args.push("--iteration", it!))
219236

src/metadata.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ export interface LinuxBuildOptions {
283283
*deb-only.* The compression type, one of `gz`, `bzip2`, `xz` (default: `xz`).
284284
*/
285285
readonly compression?: string | null
286+
287+
/*
288+
Package dependencies. Defaults to `["libappindicator1", "libnotify"]`.
289+
*/
290+
readonly depends?: string[] | null
286291
}
287292

288293
/*

test/src/helpers/packTester.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ interface AssertPackOptions {
2828
readonly packed?: (projectDir: string) => Promise<any>
2929
readonly expectedContents?: Array<string>
3030
readonly expectedArtifacts?: Array<string>
31+
32+
readonly expectedDepends?: string
3133
}
3234

3335
export async function assertPack(fixtureName: string, packagerOptions: PackagerOptions, checkOptions?: AssertPackOptions): Promise<void> {
@@ -104,15 +106,15 @@ async function packAndCheck(projectDir: string, packagerOptions: PackagerOptions
104106
await checkOsXResult(packager, packagerOptions, checkOptions, artifacts.get(Platform.OSX))
105107
}
106108
else if (platform === Platform.LINUX) {
107-
await checkLinuxResult(projectDir, packager, packagerOptions)
109+
await checkLinuxResult(projectDir, packager, packagerOptions, checkOptions)
108110
}
109111
else if (platform === Platform.WINDOWS) {
110112
await checkWindowsResult(packager, packagerOptions, checkOptions, artifacts.get(Platform.WINDOWS))
111113
}
112114
}
113115
}
114116

115-
async function checkLinuxResult(projectDir: string, packager: Packager, packagerOptions: PackagerOptions) {
117+
async function checkLinuxResult(projectDir: string, packager: Packager, packagerOptions: PackagerOptions, checkOptions: AssertPackOptions) {
116118
const productName = getProductName(packager.metadata, packager.devMetadata)
117119
const expectedContents = expectedLinuxContents.map(it => {
118120
if (it === "/opt/TestApp/TestApp") {
@@ -142,6 +144,7 @@ async function checkLinuxResult(projectDir: string, packager: Packager, packager
142144
Vendor: "Foo Bar <foo@example.com>",
143145
Package: "testapp",
144146
Description: " \n Test Application (test quite \" #378)",
147+
Depends: checkOptions == null || checkOptions.expectedDepends == null ? "libappindicator1, libnotify" : checkOptions.expectedDepends,
145148
})
146149
}
147150

test/src/linuxPackagerTest.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,25 @@ const __awaiter = require("out/awaiter")
99

1010
test.ifNotWindows("linux", () => assertPack("test-app-one", platform(Platform.LINUX)))
1111

12-
test.ifNotWindows("linux - icons from ICNS", async () => {
13-
await assertPack("test-app-one", {
12+
test.ifNotWindows("icons from ICNS", () => assertPack("test-app-one", {
13+
platform: [Platform.LINUX],
14+
}, {
15+
tempDirCreated: it => remove(path.join(it, "build", "icons"))
16+
}))
17+
18+
test.ifNotWindows("custom configuration", () => assertPack("test-app-one", {
1419
platform: [Platform.LINUX],
15-
}, {tempDirCreated: (projectDir) => remove(path.join(projectDir, "build", "icons"))})
16-
})
20+
devMetadata: {
21+
build: {
22+
linux: {
23+
depends: ["foo"],
24+
}
25+
}
26+
}
27+
},
28+
{
29+
expectedDepends: "foo"
30+
}))
1731

1832
test.ifNotWindows("no-author-email", t => {
1933
t.throws(assertPack("test-app-one", platform(Platform.LINUX), {

0 commit comments

Comments
 (0)