Skip to content

Commit

Permalink
Gate appending electron args by meson feature
Browse files Browse the repository at this point in the history
  • Loading branch information
gasinvein committed Jun 9, 2024
1 parent a9e384b commit f401bf9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions editor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ function update_display_server_args () {
fi
fi

# shellcheck disable=SC2050
if [ "@ELECTRON_ENABLED@" -eq 0 ]; then
return 0
fi

if [ -e "$wayland_socket" ]; then
DISPLAY_SERVER_ARGS=(
"--ozone-platform=wayland"
Expand Down
12 changes: 12 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ else
sdk_version = get_option('sdk_version')
endif

if get_option('electron').enabled()
electron_enabled = true
elif get_option('electron').auto()
electron_enabled = get_option('zypak').enabled()
else
if get_option('zypak').enabled()
error('`electron` feature is required if `zypak` is enabled')
endif
electron_enabled = false
endif

editor_args = []
foreach arg : get_option('editor_args')
editor_args += '"@0@"'.format(arg)
Expand Down Expand Up @@ -67,6 +78,7 @@ wrapper_data = configuration_data({
'WRAPPER_PATH': wrapper_path,
'EDITOR_BINARY': editor_path,
'EDITOR_ARGS': ' '.join(editor_args),
'ELECTRON_ENABLED': electron_enabled.to_int(),
'ZYPAK_ARGS': ' '.join(zypak_args),
'EXPORT_ENVS': ' && '.join(export_envs),
'EXPORT_ENVS_INNER': ' && '.join(export_envs_inner),
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ option('first_run_template', type: 'string', value: 'first_run.txt')
option('sdk_update_template', type: 'string', value: 'sdk_update.txt')
option('flagfile_prefix', type: 'string', value: 'flatpak-vscode')
option('default_loglevel', type: 'string', value: '1')
option('electron', type: 'feature', value: 'auto')
option('zypak', type: 'feature', value: 'disabled')
option('zypak_args', type: 'array', value: ['host'])
option('envs', type: 'array', value: [])
Expand Down

0 comments on commit f401bf9

Please sign in to comment.