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

plugins: add flag to 'download:plugins' script #7123

Merged
merged 1 commit into from
Feb 11, 2020
Merged

Conversation

vince-fugnitto
Copy link
Member

@vince-fugnitto vince-fugnitto commented Feb 10, 2020

What it does

Fixes #7122

The following pull-request adds a flag to the download:plugins script in order to control whether or not downloaded plugins should be packed or unpacked.

The default behavior is to unpack plugins (if no flag is provided), else an application may choose to specify whether or not to pack or unpack plugins using the -packed (-p) flag.

How to test

Call the download:plugins the following way:

Command Outcome
yarn theia download:plugins should download plugins and unpack (not .vsix)
yarn theia download:plugins -p=false should download plugins and unpack (not .vsix)
yarn theia download:plugins -p=true should download plugins and
not unpack (not .vsix)

One can also specify the full name as such:

yarn theia download:plugins -packed=true

Review checklist

Reminder for reviewers

Signed-off-by: Vincent Fugnitto vincent.fugnitto@ericsson.com

@vince-fugnitto vince-fugnitto added the builtins Issues related to VS Code builtin extensions label Feb 10, 2020
@vince-fugnitto vince-fugnitto self-assigned this Feb 10, 2020
handler: () => downloadPlugins()
describe: 'Download defined external plugins.',
builder: {
'preserveVsix': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better unpack which is false by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we discussed that perhaps we wanted the preservation of the .vsix file as to be the one which requires the flag to be turned on (requires an application to actually request such a feature), since most clients would it expect it to unpack?

The only client I know as of now that'd want to preserve is the theia-electron AppImage.
cc @marcdumais-work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that’s fine I just wanted to have shorter option name ) but it is also not so important

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree :) I updated the flag so it is shorter.
I use -packed or -p to control the behavior when downloading plugins.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only client I know as of now that'd want to preserve is the theia-electron AppImage.

Not only AppImage but potentially all OS-specific packagings for Electron to be safe (.deb, .rpm, .msi, .exe, .dmg, ...).

TL;DR: we noticed that the Java Language Support for Visual Studio Code by Red Hat extension writes to the extension's directory at runtime. This fails if the extension is unpacked in such a way that the Electron app user does not have write access to it, which happens when installing a packaged Electron app (except maybe if packages as simple .tar or .zip and extracted by end-user).

We are not sure if other VS Code extensions may also be also writing to their directory at runtime, so to be safe I would keep Electron-bundled extensions packed in .vsix format.

(note: I did not see this behavior on writing in one's own folder at runtime for built-in extensions)

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not tried, but code-wise it looks good. I would name option differently but it is mater of taste. Please merge if it works.

Fixes #7122

Adds the following flag to the `download:plugins` script
to control the behavior of how plugins should be packed/unpacked by
default.

The default is `false` and it means that plugins should not be preserved
as `.vsix` and instead should be unpacked. If `packed` is set to `true`
then plugins are successfully packed (kept as `.vsix`).

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
Copy link
Contributor

@marcdumais-work marcdumais-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I tested on Gitpod, validating that both packed and unpacked plugins work in the example browser application.

@vince-fugnitto
Copy link
Member Author

Thank you @akosyakov @marcdumais-work !

@vince-fugnitto vince-fugnitto merged commit 92de8c3 into master Feb 11, 2020
@vince-fugnitto vince-fugnitto deleted the vf/GH-7122 branch February 11, 2020 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins Issues related to VS Code builtin extensions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugins: add flag to 'download:plugins' script
3 participants