Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app-builder-lib): support to set executableArgs in linux config #4364

Merged
merged 2 commits into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 134 additions & 5 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@
"desktop": {
"description": "The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value)."
},
"executableArgs": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The executable parameters. Pass to executableName"
},
"license": {
"description": "The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.",
"type": [
Expand Down Expand Up @@ -373,6 +387,10 @@
"string"
]
},
"requestHeaders": {
"$ref": "#/definitions/OutgoingHttpHeaders",
"description": "Any custom request headers"
},
"token": {
"type": [
"null",
Expand Down Expand Up @@ -423,6 +441,10 @@
}
]
},
"requestHeaders": {
"$ref": "#/definitions/OutgoingHttpHeaders",
"description": "Any custom request headers"
},
"updaterCacheDirName": {
"type": [
"null",
Expand Down Expand Up @@ -505,6 +527,20 @@
"desktop": {
"description": "The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value)."
},
"executableArgs": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The executable parameters. Pass to executableName"
},
"fpm": {
"anyOf": [
{
Expand Down Expand Up @@ -1029,6 +1065,10 @@
}
]
},
"requestHeaders": {
"$ref": "#/definitions/OutgoingHttpHeaders",
"description": "Any custom request headers"
},
"updaterCacheDirName": {
"type": [
"null",
Expand Down Expand Up @@ -1141,6 +1181,10 @@
"string"
]
},
"requestHeaders": {
"$ref": "#/definitions/OutgoingHttpHeaders",
"description": "Any custom request headers"
},
"token": {
"description": "The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update#appupdatersetfeedurloptions).",
"type": [
Expand Down Expand Up @@ -1273,6 +1317,20 @@
"string"
]
},
"executableArgs": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The executable parameters. Pass to executableName"
},
"executableName": {
"description": "The executable name. Defaults to `productName`.\nCannot be specified per target, allowed only in the `linux`.",
"type": [
Expand Down Expand Up @@ -1608,6 +1666,20 @@
"desktop": {
"description": "The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value)."
},
"executableArgs": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The executable parameters. Pass to executableName"
},
"fpm": {
"anyOf": [
{
Expand Down Expand Up @@ -3484,6 +3556,25 @@
},
"type": "object"
},
"OutgoingHttpHeaders": {
"additionalProperties": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": [
"string",
"number"
]
}
]
},
"type": "object"
},
"PkgBackgroundOptions": {
"additionalProperties": false,
"description": "Options for the background image in a PKG installer",
Expand Down Expand Up @@ -4037,6 +4128,10 @@
"string"
]
},
"requestHeaders": {
"$ref": "#/definitions/OutgoingHttpHeaders",
"description": "Any custom request headers"
},
"storageClass": {
"anyOf": [
{
Expand Down Expand Up @@ -4108,6 +4203,11 @@
],
"description": "The list of features that must be supported by the core in order for this snap to install."
},
"autoStart": {
"default": false,
"description": "Whether or not the snap should automatically start on login.",
"type": "boolean"
},
"buildPackages": {
"anyOf": [
{
Expand Down Expand Up @@ -4170,6 +4270,20 @@
],
"description": "The custom environment. Defaults to `{\"TMPDIR: \"$XDG_RUNTIME_DIR\"}`. If you set custom, it will be merged with default."
},
"executableArgs": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The executable parameters. Pass to executableName"
},
"grade": {
"anyOf": [
{
Expand Down Expand Up @@ -4325,10 +4439,6 @@
"useTemplateApp": {
"description": "Whether to use template snap. Defaults to `true` if `stagePackages` not specified.",
"type": "boolean"
},
"autoStart": {
"description": "Whether or not the snap should automatically start on login.",
"type": "boolean"
}
},
"type": "object"
Expand Down Expand Up @@ -4379,6 +4489,10 @@
}
]
},
"requestHeaders": {
"$ref": "#/definitions/OutgoingHttpHeaders",
"description": "Any custom request headers"
},
"updaterCacheDirName": {
"type": [
"null",
Expand Down Expand Up @@ -4460,6 +4574,10 @@
"description": "The region (e.g. `nyc3`).",
"type": "string"
},
"requestHeaders": {
"$ref": "#/definitions/OutgoingHttpHeaders",
"description": "Any custom request headers"
},
"updaterCacheDirName": {
"type": [
"null",
Expand Down Expand Up @@ -5537,6 +5655,17 @@
],
"description": "MAS (Mac Application Store) options."
},
"masDev": {
"anyOf": [
{
"$ref": "#/definitions/MasConfiguration"
},
{
"type": "null"
}
],
"description": "MAS (Mac Application Store) development options (`mas-dev` target)."
},
"msi": {
"anyOf": [
{
Expand Down Expand Up @@ -5835,4 +5964,4 @@
}
},
"type": "object"
}
}
7 changes: 6 additions & 1 deletion packages/app-builder-lib/src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ export interface CommonLinuxOptions {
* The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value).
*/
readonly desktop?: any | null

/**
* The executable parameters. Pass to executableName
*/
readonly executableArgs?: Array<string> | null
}

// fpm-only specific options
Expand Down Expand Up @@ -123,4 +128,4 @@ export interface AppImageOptions extends CommonLinuxOptions, TargetSpecificOptio
* The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.
*/
readonly license?: string | null
}
}
6 changes: 5 additions & 1 deletion packages/app-builder-lib/src/targets/LinuxTargetHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ export class LinuxTargetHelper {
const appInfo = packager.appInfo

const productFilename = appInfo.productFilename

const executableArgs = targetSpecificOptions.executableArgs
if (exec == null) {
exec = `${installPrefix}/${productFilename}/${packager.executableName}`
if (!/^[/0-9A-Za-z._-]+$/.test(exec)) {
exec = `"${exec}"`
}
if (executableArgs) {
exec += " "
exec += executableArgs.join(" ")
}
exec += " %U"
}

Expand Down