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

workaround electron-rebuild bug #10429

Merged
merged 2 commits into from
Nov 23, 2021
Merged

workaround electron-rebuild bug #10429

merged 2 commits into from
Nov 23, 2021

Conversation

paul-marechal
Copy link
Member

See electron/rebuild#888

The way we invoke electron-rebuild should allow Theia application
developers to run theia rebuild:* from the root of their monorepos,
but because of a bug in electron-rebuild it will only build
dependencies listed in the package.json file located in cwd.

Implement a workaround that modifies or creates a package.json file to
list the dependencies to rebuild.

Add exit hooks to cleanup in case users do Ctrl+C while theia rebuild
is running so that we don't pollute user workspaces.

How to test

  • Run npx theia rebuild:electron and npx theia rebuild:browser from Theia's monorepo root. It should properly rebuild modules for the specified target.
  • Doing Ctrl+C while theia rebuild:electron is running should revert the modules back to the browser version.
  • Doing Ctrl+C while theia rebuild:browser is running should not prevent the process from finishing.

Review checklist

Reminder for reviewers

@paul-marechal paul-marechal added bug bugs found in the application electron issues related to the electron target theia-cli issues related to the theia-cli labels Nov 17, 2021
@paul-marechal paul-marechal added this to the 1.20.0 milestone Nov 17, 2021
@paul-marechal
Copy link
Member Author

Just updated the signals to listen to: I mixed up SIGKILL and SIGTERM. The former cannot be prevented.

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

I confirmed that the changes work well:

  • yarn browser rebuild
  • yarn electron rebuild
  • npx theia rebuild:electron (root) works well
  • npx theia rebuild:browser (root) works well
  • starting the browser app after the browser rebuild works
  • starting the electron app after the electron rebuild works
  • performing ctrl+c will revert the rebuild properly for yarn {app} rebuild
  • performing ctrl+c will revert the rebuild properly for npx theia rebuild:{app}

@paul-marechal
Copy link
Member Author

paul-marechal commented Nov 17, 2021

@vince-fugnitto the value of this PR lies in being able to do npx theia rebuild:browser and npx theia rebuild:electron from the root of the repo. yarn browser rebuild and yarn electron rebuild change the cwd so that the bug doesn't happen in the first place. Have you tried the former or just the latter?

See electron/rebuild#888

The way we invoke `electron-rebuild` should allow Theia application
developers to run `theia rebuild:*` from the root of their monorepos,
but because of a bug in `electron-rebuild` it will only build
dependencies listed in the `package.json` file located in `cwd`.

Implement a workaround that modifies or creates a `package.json` file to
list the dependencies to rebuild.

Add exit hooks to cleanup in case users do `Ctrl+C` while theia rebuild
is running so that we don't pollute user workspaces.
@vince-fugnitto
Copy link
Member

Have you tried the former or just the latter?

@paul-marechal both :) I updated my comment #10429 (review).

Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

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

Only very minor punctuation comments on the code.

More substantively, I'm able to run npx theia rebuild:* from the Theia repo root on master (29ebe4c), so if that's the main objective of this PR, I'm not sure it's necessary. Is there something I'm missing there?

dev-packages/application-manager/src/rebuild.ts Outdated Show resolved Hide resolved
dev-packages/application-manager/src/rebuild.ts Outdated Show resolved Hide resolved
dev-packages/application-manager/src/rebuild.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

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

My comments re: punctuation stand, though they don't really need to be addressed. My comment re: ability to run npx theia rebuild:* in the current state of master appears to have been erroneous: that runs afoul of the electron rebuild bug, and a module fails to self register.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application electron issues related to the electron target theia-cli issues related to the theia-cli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants