Skip to content

Commit d58d323

Browse files
committed
fix(linux): depends for deb in LinuxOptions
Close #1420
1 parent e1e3832 commit d58d323

File tree

17 files changed

+493
-147
lines changed

17 files changed

+493
-147
lines changed

.idea/dictionaries/develar.xml

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

docs/Developer API.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
<dd></dd>
2222
<dt><a href="#module_electron-builder/out/macPackager">electron-builder/out/macPackager</a></dt>
2323
<dd></dd>
24+
<dt><a href="#module_electron-builder/out/options/linuxOptions">electron-builder/out/options/linuxOptions</a></dt>
25+
<dd></dd>
2426
<dt><a href="#module_electron-builder/out/packager/dirPackager">electron-builder/out/packager/dirPackager</a></dt>
2527
<dd></dd>
2628
<dt><a href="#module_electron-builder/out/packager/mac">electron-builder/out/packager/mac</a></dt>
@@ -1188,6 +1190,44 @@
11881190
| --- | --- |
11891191
| executableFile | <code>string</code> |
11901192

1193+
<a name="module_electron-builder/out/options/linuxOptions"></a>
1194+
1195+
## electron-builder/out/options/linuxOptions
1196+
1197+
* [electron-builder/out/options/linuxOptions](#module_electron-builder/out/options/linuxOptions)
1198+
* [`.CommonLinuxOptions`](#CommonLinuxOptions)
1199+
* [`.LinuxTargetSpecificOptions`](#LinuxTargetSpecificOptions) ⇐ <code>[CommonLinuxOptions](#CommonLinuxOptions)</code>
1200+
1201+
<a name="CommonLinuxOptions"></a>
1202+
1203+
### `CommonLinuxOptions`
1204+
**Kind**: interface of <code>[electron-builder/out/options/linuxOptions](#module_electron-builder/out/options/linuxOptions)</code>
1205+
**Properties**
1206+
1207+
| Name | Type |
1208+
| --- | --- |
1209+
| synopsis| <code>string</code> \| <code>null</code> |
1210+
| description| <code>string</code> \| <code>null</code> |
1211+
| category| <code>string</code> \| <code>null</code> |
1212+
| packageCategory| <code>string</code> \| <code>null</code> |
1213+
| desktop| <code>Object&lt;string, any&gt;</code> \| <code>null</code> |
1214+
| vendor| <code>string</code> \| <code>null</code> |
1215+
| maintainer| <code>string</code> \| <code>null</code> |
1216+
| afterInstall| <code>string</code> \| <code>null</code> |
1217+
| afterRemove| <code>string</code> \| <code>null</code> |
1218+
1219+
<a name="LinuxTargetSpecificOptions"></a>
1220+
1221+
### `LinuxTargetSpecificOptions` ⇐ <code>[CommonLinuxOptions](#CommonLinuxOptions)</code>
1222+
**Kind**: interface of <code>[electron-builder/out/options/linuxOptions](#module_electron-builder/out/options/linuxOptions)</code>
1223+
**Extends**: <code>[CommonLinuxOptions](#CommonLinuxOptions)</code>
1224+
**Properties**
1225+
1226+
| Name | Type | Description |
1227+
| --- | --- | --- |
1228+
| depends| <code>Array&lt;string&gt;</code> \| <code>null</code> | <a name="LinuxTargetSpecificOptions-depends"></a>Package dependencies. |
1229+
| icon| <code>string</code> | <a name="LinuxTargetSpecificOptions-icon"></a> |
1230+
11911231
<a name="module_electron-builder/out/packager/dirPackager"></a>
11921232

11931233
## electron-builder/out/packager/dirPackager
@@ -1933,7 +1973,7 @@
19331973

19341974
| Name | Type |
19351975
| --- | --- |
1936-
| options = <code>Object.assign({}, this.packager.platformSpecificBuildOptions, (&lt;any&gt;this.packager.config)[this.name])</code>| <code>any</code> |
1976+
| options = <code>Object.assign({}, this.packager.platformSpecificBuildOptions, (&lt;any&gt;this.packager.config)[this.name])</code>| <code>[LinuxTargetSpecificOptions](#LinuxTargetSpecificOptions)</code> |
19371977

19381978

19391979
* [.FpmTarget](#FpmTarget) ⇐ <code>[Target](#Target)</code>
@@ -1961,7 +2001,7 @@
19612001

19622002
* [electron-builder/out/targets/LinuxTargetHelper](#module_electron-builder/out/targets/LinuxTargetHelper)
19632003
* [.LinuxTargetHelper](#LinuxTargetHelper)
1964-
* [`.computeDesktopEntry(platformSpecificBuildOptions, exec, destination, extra)`](#module_electron-builder/out/targets/LinuxTargetHelper.LinuxTargetHelper+computeDesktopEntry) ⇒ <code>Promise&lt;string&gt;</code>
2004+
* [`.computeDesktopEntry(targetSpecificOptions, exec, destination, extra)`](#module_electron-builder/out/targets/LinuxTargetHelper.LinuxTargetHelper+computeDesktopEntry) ⇒ <code>Promise&lt;string&gt;</code>
19652005
* [`.getDescription(options)`](#module_electron-builder/out/targets/LinuxTargetHelper.LinuxTargetHelper+getDescription) ⇒ <code>string</code>
19662006

19672007
<a name="LinuxTargetHelper"></a>
@@ -1977,17 +2017,17 @@
19772017

19782018

19792019
* [.LinuxTargetHelper](#LinuxTargetHelper)
1980-
* [`.computeDesktopEntry(platformSpecificBuildOptions, exec, destination, extra)`](#module_electron-builder/out/targets/LinuxTargetHelper.LinuxTargetHelper+computeDesktopEntry) ⇒ <code>Promise&lt;string&gt;</code>
2020+
* [`.computeDesktopEntry(targetSpecificOptions, exec, destination, extra)`](#module_electron-builder/out/targets/LinuxTargetHelper.LinuxTargetHelper+computeDesktopEntry) ⇒ <code>Promise&lt;string&gt;</code>
19812021
* [`.getDescription(options)`](#module_electron-builder/out/targets/LinuxTargetHelper.LinuxTargetHelper+getDescription) ⇒ <code>string</code>
19822022

19832023
<a name="module_electron-builder/out/targets/LinuxTargetHelper.LinuxTargetHelper+computeDesktopEntry"></a>
19842024

1985-
#### `linuxTargetHelper.computeDesktopEntry(platformSpecificBuildOptions, exec, destination, extra)` ⇒ <code>Promise&lt;string&gt;</code>
2025+
#### `linuxTargetHelper.computeDesktopEntry(targetSpecificOptions, exec, destination, extra)` ⇒ <code>Promise&lt;string&gt;</code>
19862026
**Kind**: instance method of <code>[LinuxTargetHelper](#LinuxTargetHelper)</code>
19872027

19882028
| Param | Type |
19892029
| --- | --- |
1990-
| platformSpecificBuildOptions | <code>[LinuxBuildOptions](Options#LinuxBuildOptions)</code> |
2030+
| targetSpecificOptions | <code>[LinuxTargetSpecificOptions](#LinuxTargetSpecificOptions)</code> |
19912031
| exec | <code>string</code> |
19922032
| destination | <code>string</code> \| <code>null</code> |
19932033
| extra | <code>Object&lt;string, any&gt;</code> |

docs/Options.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ You can use [file macros](#file-macros) in the `from` and `to` fields as well.
104104
* [`.BuildResult`](#BuildResult)
105105
* [`.CliOptions`](#CliOptions) ⇐ <code>[PublishOptions](Developer-API#PublishOptions)</code>
106106
* [`.Config`](#Config) ⇐ <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
107-
* [`.DebOptions`](#DebOptions) ⇐ <code>[LinuxBuildOptions](#LinuxBuildOptions)</code>
107+
* [`.DebOptions`](#DebOptions) ⇐ <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code>
108108
* [`.DmgContent`](#DmgContent)
109109
* [`.DmgOptions`](#DmgOptions) ⇐ <code>[TargetSpecificOptions](Developer-API#TargetSpecificOptions)</code>
110110
* [`.DmgWindow`](#DmgWindow)
111-
* [`.LinuxBuildOptions`](#LinuxBuildOptions) ⇐ <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
111+
* [`.LinuxBuildOptions`](#LinuxBuildOptions) ⇐ <code>[CommonLinuxOptions](Developer-API#CommonLinuxOptions)</code>
112112
* [`.MacOptions`](#MacOptions) ⇐ <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
113113
* [`.MasBuildOptions`](#MasBuildOptions) ⇐ <code>[MacOptions](#MacOptions)</code>
114114
* [`.Metadata`](#Metadata)
@@ -282,25 +282,24 @@ Configuration Options
282282
| linux| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-linux"></a> |
283283
| deb| <code>[DebOptions](#DebOptions)</code> \| <code>null</code> | <a name="Config-deb"></a> |
284284
| snap| <code>[SnapOptions](#SnapOptions)</code> \| <code>null</code> | <a name="Config-snap"></a> |
285-
| appimage| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-appimage"></a> |
286-
| pacman| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-pacman"></a> |
287-
| rpm| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-rpm"></a> |
288-
| freebsd| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-freebsd"></a> |
289-
| p5p| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-p5p"></a> |
290-
| apk| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-apk"></a> |
285+
| appimage| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-appimage"></a> |
286+
| pacman| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-pacman"></a> |
287+
| rpm| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-rpm"></a> |
288+
| freebsd| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-freebsd"></a> |
289+
| p5p| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-p5p"></a> |
290+
| apk| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-apk"></a> |
291291

292292
<a name="DebOptions"></a>
293293

294-
### `DebOptions` ⇐ <code>[LinuxBuildOptions](#LinuxBuildOptions)</code>
294+
### `DebOptions` ⇐ <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code>
295295
Debian Package Specific Options
296296

297297
**Kind**: interface of <code>[electron-builder](#module_electron-builder)</code>
298-
**Extends**: <code>[LinuxBuildOptions](#LinuxBuildOptions)</code>
298+
**Extends**: <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code>
299299
**Properties**
300300

301301
| Name | Type | Description |
302302
| --- | --- | --- |
303-
| synopsis| <code>string</code> \| <code>null</code> | <a name="DebOptions-synopsis"></a>The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). |
304303
| compression = <code>xz</code>| <code>"gz"</code> \| <code>"bzip2"</code> \| <code>"xz"</code> \| <code>null</code> | <a name="DebOptions-compression"></a>The compression type. |
305304
| priority| <code>string</code> \| <code>null</code> | <a name="DebOptions-priority"></a>The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute. |
306305
| depends| <code>Array&lt;string&gt;</code> \| <code>null</code> | <a name="DebOptions-depends"></a>Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]`. |
@@ -374,11 +373,11 @@ DMG Windows Position and Size
374373

375374
<a name="LinuxBuildOptions"></a>
376375

377-
### `LinuxBuildOptions` ⇐ <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
376+
### `LinuxBuildOptions` ⇐ <code>[CommonLinuxOptions](Developer-API#CommonLinuxOptions)</code>
378377
Linux Options
379378

380379
**Kind**: interface of <code>[electron-builder](#module_electron-builder)</code>
381-
**Extends**: <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
380+
**Extends**: <code>[CommonLinuxOptions](Developer-API#CommonLinuxOptions)</code>
382381
**Properties**
383382

384383
| Name | Type | Description |
@@ -390,11 +389,9 @@ Linux Options
390389
| maintainer| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-maintainer"></a>The maintainer. Defaults to [author](#AppMetadata-author). |
391390
| vendor| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-vendor"></a>The vendor. Defaults to [author](#AppMetadata-author). |
392391
| desktop| <code>Object&lt;string, any&gt;</code> \| <code>null</code> | <a name="LinuxBuildOptions-desktop"></a>The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value). |
393-
| afterInstall| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-afterInstall"></a> |
394-
| afterRemove| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-afterRemove"></a> |
395-
| depends| <code>Array&lt;string&gt;</code> \| <code>null</code> | <a name="LinuxBuildOptions-depends"></a>Package dependencies. Consider to specify in the target options (e.g. in the `deb` or `rpm`). |
396392
| executableName| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-executableName"></a>The executable name. Defaults to `productName`. Cannot be specified per target, allowed only in the `linux`. |
397393
| icon| <code>string</code> | <a name="LinuxBuildOptions-icon"></a>The path to icon set directory, relative to the the [build resources](https://github.com/electron-userland/electron-builder/wiki/Options#MetadataDirectories-buildResources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon. By default will be generated automatically based on the macOS icns file. |
394+
| synopsis| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-synopsis"></a>The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). |
398395

399396
<a name="MacOptions"></a>
400397

packages/electron-builder/src/metadata.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Arch, AsarOptions, AuthorMetadata, BeforeBuildContext, CompressionLevel, FileAssociation, FilePattern, MetadataDirectories, PlatformSpecificBuildOptions, Protocol, RepositoryInfo, Target } from "electron-builder-core"
22
import { Publish } from "electron-builder-http/out/publishOptions"
3-
import { DebOptions, LinuxBuildOptions, SnapOptions } from "./options/linuxOptions"
3+
import { DebOptions, LinuxBuildOptions, LinuxTargetSpecificOptions, SnapOptions } from "./options/linuxOptions"
44
import { DmgOptions, MacOptions, MasBuildOptions, PkgOptions } from "./options/macOptions"
55
import { AppXOptions, NsisOptions, NsisWebOptions, SquirrelWindowsOptions, WinBuildOptions } from "./options/winOptions"
66
import { PlatformPackager } from "./platformPackager"
@@ -217,12 +217,12 @@ export interface Config extends PlatformSpecificBuildOptions {
217217
readonly linux?: LinuxBuildOptions | null
218218
readonly deb?: DebOptions | null
219219
readonly snap?: SnapOptions | null
220-
readonly appimage?: LinuxBuildOptions | null
221-
readonly pacman?: LinuxBuildOptions | null
222-
readonly rpm?: LinuxBuildOptions | null
223-
readonly freebsd?: LinuxBuildOptions | null
224-
readonly p5p?: LinuxBuildOptions | null
225-
readonly apk?: LinuxBuildOptions | null
220+
readonly appimage?: LinuxTargetSpecificOptions | null
221+
readonly pacman?: LinuxTargetSpecificOptions | null
222+
readonly rpm?: LinuxTargetSpecificOptions | null
223+
readonly freebsd?: LinuxTargetSpecificOptions | null
224+
readonly p5p?: LinuxTargetSpecificOptions | null
225+
readonly apk?: LinuxTargetSpecificOptions | null
226226

227227
/**
228228
* @private

packages/electron-builder/src/options/linuxOptions.ts

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { PlatformSpecificBuildOptions, TargetConfigType } from "electron-builder-core"
1+
import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from "electron-builder-core"
22

33
/**
44
* Linux Options
55
*/
6-
export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
6+
export interface LinuxBuildOptions extends PlatformSpecificBuildOptions, CommonLinuxOptions {
77
/**
88
* The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).
99
*/
@@ -39,22 +39,14 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
3939
*/
4040
readonly vendor?: string | null
4141

42-
/**
43-
* should be not documented, only to experiment
44-
* @private
45-
*/
46-
readonly fpm?: Array<string> | null
47-
4842
/**
4943
* The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value).
5044
*/
5145
readonly desktop?: { [key: string]: string; } | null
5246

53-
readonly afterInstall?: string | null
54-
readonly afterRemove?: string | null
55-
5647
/**
57-
* Package dependencies. Consider to specify in the target options (e.g. in the `deb` or `rpm`).
48+
* @deprecated
49+
* @private
5850
*/
5951
readonly depends?: string[] | null
6052

@@ -69,17 +61,48 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
6961
* By default will be generated automatically based on the macOS icns file.
7062
*/
7163
readonly icon?: string
72-
}
7364

74-
/**
75-
* Debian Package Specific Options
76-
*/
77-
export interface DebOptions extends LinuxBuildOptions {
7865
/**
7966
* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
8067
*/
8168
readonly synopsis?: string | null
69+
}
70+
71+
export interface CommonLinuxOptions {
72+
readonly synopsis?: string | null
73+
readonly description?: string | null
74+
75+
readonly category?: string | null
76+
readonly packageCategory?: string | null
77+
78+
readonly desktop?: { [key: string]: string; } | null
8279

80+
readonly vendor?: string | null
81+
readonly maintainer?: string | null
82+
83+
readonly afterInstall?: string | null
84+
readonly afterRemove?: string | null
85+
86+
/**
87+
* should be not documented, only to experiment
88+
* @private
89+
*/
90+
readonly fpm?: Array<string> | null
91+
}
92+
93+
export interface LinuxTargetSpecificOptions extends TargetSpecificOptions, CommonLinuxOptions {
94+
/**
95+
* Package dependencies.
96+
*/
97+
readonly depends?: string[] | null
98+
99+
readonly icon?: string
100+
}
101+
102+
/**
103+
* Debian Package Specific Options
104+
*/
105+
export interface DebOptions extends LinuxTargetSpecificOptions {
83106
/**
84107
* The compression type.
85108
* @default xz

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { statOrNull } from "electron-builder-util/out/fs"
44
import { ensureDir, outputFile, readdir } from "fs-extra-p"
55
import * as path from "path"
66
import { LinuxPackager } from "../linuxPackager"
7-
import { LinuxBuildOptions } from "../options/linuxOptions"
7+
import { LinuxBuildOptions, LinuxTargetSpecificOptions } from "../options/linuxOptions"
88

99
export const installPrefix = "/opt"
1010

@@ -101,21 +101,21 @@ export class LinuxTargetHelper {
101101
return options.description || this.packager.appInfo.description
102102
}
103103

104-
async computeDesktopEntry(platformSpecificBuildOptions: LinuxBuildOptions, exec?: string, destination?: string | null, extra?: { [key: string]: string; }): Promise<string> {
104+
async computeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, destination?: string | null, extra?: { [key: string]: string; }): Promise<string> {
105105
const appInfo = this.packager.appInfo
106106

107107
const productFilename = appInfo.productFilename
108108

109109
const desktopMeta: any = Object.assign({
110110
Name: appInfo.productName,
111-
Comment: this.getDescription(platformSpecificBuildOptions),
111+
Comment: this.getDescription(targetSpecificOptions),
112112
Exec: exec == null ? `"${installPrefix}/${productFilename}/${this.packager.executableName}"` : exec,
113113
Terminal: "false",
114114
Type: "Application",
115115
Icon: this.packager.executableName,
116-
}, extra, platformSpecificBuildOptions.desktop)
116+
}, extra, targetSpecificOptions.desktop)
117117

118-
const category = platformSpecificBuildOptions.category
118+
const category = targetSpecificOptions.category
119119
if (!isEmptyOrSpaces(category)) {
120120
if (category)
121121
desktopMeta.Categories = category + (category.endsWith(";") ? "" : ";")

0 commit comments

Comments
 (0)