Skip to content

Commit

Permalink
fix(linux): depends for deb in LinuxOptions
Browse files Browse the repository at this point in the history
Close #1420
  • Loading branch information
develar committed Apr 5, 2017
1 parent e1e3832 commit d58d323
Show file tree
Hide file tree
Showing 17 changed files with 493 additions and 147 deletions.
1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

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

50 changes: 45 additions & 5 deletions docs/Developer API.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<dd></dd>
<dt><a href="#module_electron-builder/out/macPackager">electron-builder/out/macPackager</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/options/linuxOptions">electron-builder/out/options/linuxOptions</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/packager/dirPackager">electron-builder/out/packager/dirPackager</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder/out/packager/mac">electron-builder/out/packager/mac</a></dt>
Expand Down Expand Up @@ -1188,6 +1190,44 @@
| --- | --- |
| executableFile | <code>string</code> |

<a name="module_electron-builder/out/options/linuxOptions"></a>

## electron-builder/out/options/linuxOptions

* [electron-builder/out/options/linuxOptions](#module_electron-builder/out/options/linuxOptions)
* [`.CommonLinuxOptions`](#CommonLinuxOptions)
* [`.LinuxTargetSpecificOptions`](#LinuxTargetSpecificOptions) ⇐ <code>[CommonLinuxOptions](#CommonLinuxOptions)</code>

<a name="CommonLinuxOptions"></a>

### `CommonLinuxOptions`
**Kind**: interface of <code>[electron-builder/out/options/linuxOptions](#module_electron-builder/out/options/linuxOptions)</code>
**Properties**

| Name | Type |
| --- | --- |
| synopsis| <code>string</code> \| <code>null</code> |
| description| <code>string</code> \| <code>null</code> |
| category| <code>string</code> \| <code>null</code> |
| packageCategory| <code>string</code> \| <code>null</code> |
| desktop| <code>Object&lt;string, any&gt;</code> \| <code>null</code> |
| vendor| <code>string</code> \| <code>null</code> |
| maintainer| <code>string</code> \| <code>null</code> |
| afterInstall| <code>string</code> \| <code>null</code> |
| afterRemove| <code>string</code> \| <code>null</code> |

<a name="LinuxTargetSpecificOptions"></a>

### `LinuxTargetSpecificOptions` ⇐ <code>[CommonLinuxOptions](#CommonLinuxOptions)</code>
**Kind**: interface of <code>[electron-builder/out/options/linuxOptions](#module_electron-builder/out/options/linuxOptions)</code>
**Extends**: <code>[CommonLinuxOptions](#CommonLinuxOptions)</code>
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| depends| <code>Array&lt;string&gt;</code> \| <code>null</code> | <a name="LinuxTargetSpecificOptions-depends"></a>Package dependencies. |
| icon| <code>string</code> | <a name="LinuxTargetSpecificOptions-icon"></a> |

<a name="module_electron-builder/out/packager/dirPackager"></a>

## electron-builder/out/packager/dirPackager
Expand Down Expand Up @@ -1933,7 +1973,7 @@

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


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

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

<a name="LinuxTargetHelper"></a>
Expand All @@ -1977,17 +2017,17 @@


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

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

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

| Param | Type |
| --- | --- |
| platformSpecificBuildOptions | <code>[LinuxBuildOptions](Options#LinuxBuildOptions)</code> |
| targetSpecificOptions | <code>[LinuxTargetSpecificOptions](#LinuxTargetSpecificOptions)</code> |
| exec | <code>string</code> |
| destination | <code>string</code> \| <code>null</code> |
| extra | <code>Object&lt;string, any&gt;</code> |
Expand Down
29 changes: 13 additions & 16 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ You can use [file macros](#file-macros) in the `from` and `to` fields as well.
* [`.BuildResult`](#BuildResult)
* [`.CliOptions`](#CliOptions) ⇐ <code>[PublishOptions](Developer-API#PublishOptions)</code>
* [`.Config`](#Config) ⇐ <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
* [`.DebOptions`](#DebOptions) ⇐ <code>[LinuxBuildOptions](#LinuxBuildOptions)</code>
* [`.DebOptions`](#DebOptions) ⇐ <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code>
* [`.DmgContent`](#DmgContent)
* [`.DmgOptions`](#DmgOptions) ⇐ <code>[TargetSpecificOptions](Developer-API#TargetSpecificOptions)</code>
* [`.DmgWindow`](#DmgWindow)
* [`.LinuxBuildOptions`](#LinuxBuildOptions) ⇐ <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
* [`.LinuxBuildOptions`](#LinuxBuildOptions) ⇐ <code>[CommonLinuxOptions](Developer-API#CommonLinuxOptions)</code>
* [`.MacOptions`](#MacOptions) ⇐ <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
* [`.MasBuildOptions`](#MasBuildOptions) ⇐ <code>[MacOptions](#MacOptions)</code>
* [`.Metadata`](#Metadata)
Expand Down Expand Up @@ -282,25 +282,24 @@ Configuration Options
| linux| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-linux"></a> |
| deb| <code>[DebOptions](#DebOptions)</code> \| <code>null</code> | <a name="Config-deb"></a> |
| snap| <code>[SnapOptions](#SnapOptions)</code> \| <code>null</code> | <a name="Config-snap"></a> |
| appimage| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-appimage"></a> |
| pacman| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-pacman"></a> |
| rpm| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-rpm"></a> |
| freebsd| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-freebsd"></a> |
| p5p| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-p5p"></a> |
| apk| <code>[LinuxBuildOptions](#LinuxBuildOptions)</code> \| <code>null</code> | <a name="Config-apk"></a> |
| appimage| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-appimage"></a> |
| pacman| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-pacman"></a> |
| rpm| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-rpm"></a> |
| freebsd| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-freebsd"></a> |
| p5p| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-p5p"></a> |
| apk| <code>[LinuxTargetSpecificOptions](Developer-API#LinuxTargetSpecificOptions)</code> \| <code>null</code> | <a name="Config-apk"></a> |

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

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

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

| Name | Type | Description |
| --- | --- | --- |
| 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). |
| compression = <code>xz</code>| <code>"gz"</code> \| <code>"bzip2"</code> \| <code>"xz"</code> \| <code>null</code> | <a name="DebOptions-compression"></a>The compression type. |
| 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. |
| 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"]`. |
Expand Down Expand Up @@ -374,11 +373,11 @@ DMG Windows Position and Size

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

### `LinuxBuildOptions` ⇐ <code>[PlatformSpecificBuildOptions](Developer-API#PlatformSpecificBuildOptions)</code>
### `LinuxBuildOptions` ⇐ <code>[CommonLinuxOptions](Developer-API#CommonLinuxOptions)</code>
Linux Options

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

| Name | Type | Description |
Expand All @@ -390,11 +389,9 @@ Linux Options
| maintainer| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-maintainer"></a>The maintainer. Defaults to [author](#AppMetadata-author). |
| vendor| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-vendor"></a>The vendor. Defaults to [author](#AppMetadata-author). |
| 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). |
| afterInstall| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-afterInstall"></a> |
| afterRemove| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-afterRemove"></a> |
| 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`). |
| 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`. |
| 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. |
| 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). |

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

Expand Down
14 changes: 7 additions & 7 deletions packages/electron-builder/src/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Arch, AsarOptions, AuthorMetadata, BeforeBuildContext, CompressionLevel, FileAssociation, FilePattern, MetadataDirectories, PlatformSpecificBuildOptions, Protocol, RepositoryInfo, Target } from "electron-builder-core"
import { Publish } from "electron-builder-http/out/publishOptions"
import { DebOptions, LinuxBuildOptions, SnapOptions } from "./options/linuxOptions"
import { DebOptions, LinuxBuildOptions, LinuxTargetSpecificOptions, SnapOptions } from "./options/linuxOptions"
import { DmgOptions, MacOptions, MasBuildOptions, PkgOptions } from "./options/macOptions"
import { AppXOptions, NsisOptions, NsisWebOptions, SquirrelWindowsOptions, WinBuildOptions } from "./options/winOptions"
import { PlatformPackager } from "./platformPackager"
Expand Down Expand Up @@ -217,12 +217,12 @@ export interface Config extends PlatformSpecificBuildOptions {
readonly linux?: LinuxBuildOptions | null
readonly deb?: DebOptions | null
readonly snap?: SnapOptions | null
readonly appimage?: LinuxBuildOptions | null
readonly pacman?: LinuxBuildOptions | null
readonly rpm?: LinuxBuildOptions | null
readonly freebsd?: LinuxBuildOptions | null
readonly p5p?: LinuxBuildOptions | null
readonly apk?: LinuxBuildOptions | null
readonly appimage?: LinuxTargetSpecificOptions | null
readonly pacman?: LinuxTargetSpecificOptions | null
readonly rpm?: LinuxTargetSpecificOptions | null
readonly freebsd?: LinuxTargetSpecificOptions | null
readonly p5p?: LinuxTargetSpecificOptions | null
readonly apk?: LinuxTargetSpecificOptions | null

/**
* @private
Expand Down
57 changes: 40 additions & 17 deletions packages/electron-builder/src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PlatformSpecificBuildOptions, TargetConfigType } from "electron-builder-core"
import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from "electron-builder-core"

/**
* Linux Options
*/
export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
export interface LinuxBuildOptions extends PlatformSpecificBuildOptions, CommonLinuxOptions {
/**
* The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).
*/
Expand Down Expand Up @@ -39,22 +39,14 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
*/
readonly vendor?: string | null

/**
* should be not documented, only to experiment
* @private
*/
readonly fpm?: Array<string> | null

/**
* The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value).
*/
readonly desktop?: { [key: string]: string; } | null

readonly afterInstall?: string | null
readonly afterRemove?: string | null

/**
* Package dependencies. Consider to specify in the target options (e.g. in the `deb` or `rpm`).
* @deprecated
* @private
*/
readonly depends?: string[] | null

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

/**
* Debian Package Specific Options
*/
export interface DebOptions extends LinuxBuildOptions {
/**
* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
*/
readonly synopsis?: string | null
}

export interface CommonLinuxOptions {
readonly synopsis?: string | null
readonly description?: string | null

readonly category?: string | null
readonly packageCategory?: string | null

readonly desktop?: { [key: string]: string; } | null

readonly vendor?: string | null
readonly maintainer?: string | null

readonly afterInstall?: string | null
readonly afterRemove?: string | null

/**
* should be not documented, only to experiment
* @private
*/
readonly fpm?: Array<string> | null
}

export interface LinuxTargetSpecificOptions extends TargetSpecificOptions, CommonLinuxOptions {
/**
* Package dependencies.
*/
readonly depends?: string[] | null

readonly icon?: string
}

/**
* Debian Package Specific Options
*/
export interface DebOptions extends LinuxTargetSpecificOptions {
/**
* The compression type.
* @default xz
Expand Down
10 changes: 5 additions & 5 deletions packages/electron-builder/src/targets/LinuxTargetHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { statOrNull } from "electron-builder-util/out/fs"
import { ensureDir, outputFile, readdir } from "fs-extra-p"
import * as path from "path"
import { LinuxPackager } from "../linuxPackager"
import { LinuxBuildOptions } from "../options/linuxOptions"
import { LinuxBuildOptions, LinuxTargetSpecificOptions } from "../options/linuxOptions"

export const installPrefix = "/opt"

Expand Down Expand Up @@ -101,21 +101,21 @@ export class LinuxTargetHelper {
return options.description || this.packager.appInfo.description
}

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

const productFilename = appInfo.productFilename

const desktopMeta: any = Object.assign({
Name: appInfo.productName,
Comment: this.getDescription(platformSpecificBuildOptions),
Comment: this.getDescription(targetSpecificOptions),
Exec: exec == null ? `"${installPrefix}/${productFilename}/${this.packager.executableName}"` : exec,
Terminal: "false",
Type: "Application",
Icon: this.packager.executableName,
}, extra, platformSpecificBuildOptions.desktop)
}, extra, targetSpecificOptions.desktop)

const category = platformSpecificBuildOptions.category
const category = targetSpecificOptions.category
if (!isEmptyOrSpaces(category)) {
if (category)
desktopMeta.Categories = category + (category.endsWith(";") ? "" : ";")
Expand Down
Loading

0 comments on commit d58d323

Please sign in to comment.