This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Use the "ELECTRON_CUSTOM_VERSION" env var in build scripts #20879
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requirements for Adding, Changing, or Removing a Feature
Issue or RFC Endorsed by Atom's Maintainers
Useful for #20764, but applicable to
masterbranch as well.Description of the Change
Use an environment variable,
ELECTRON_CUSTOM_VERSION, to decouple the version of Electron-vendored binaries we want to download (chromedriver,mksnapshot), from the versions of the download helper modules we use to do the downloading (electron-chromedriverandelectron-mksnapshot).Implementation details (click to expand).
This is handled during the bootstrap process here:
https://github.com/DeeDeeG/atom/blob/3e7b532/script/lib/install-script-dependencies.js#L7
Also, make sure this is handled if an Atom developer manually runs
npm installin thescript/directory. Handled here:https://github.com/DeeDeeG/atom/blob/3e7b532/script/redownload-electron-bins.js
and
https://github.com/DeeDeeG/atom/blob/3e7b532/script/package.json#L53
(This is important, because
electron-chromedriverandelectron-mksnapshotdownload chromedriver and mksnapshot as npm postinstall scripts, which are only run the first time they are downloaded. Installing the scripts npm packages the first time, ifELECTRON_CUSTOM_VERSIONisn't set, the wrong Electron-vendored would be downloaded and would persist for further builds.)Alternate Designs
Maybe
script/redownload-electron-bins.jsshould be moved underscript/libs/instead?Possible Drawbacks
Adds complexity to the build scripts.
Users manually running
npm installin thescriptdir will download two versions each ofchromedriverandmksnapshot, unless they have manually setELECTRON_CUSTOM_VERSIONto matchelectronVersionfrom the main Atom package.json beforehand.script/redownload-electron-bins.jsThe second (correct) versions that get downloaded replace the first (incorrect) versions.)script/bootstrap, becauseELECTRON_CUSTOM_VERSIONwill always be set during the bootstrap process.)Verification Process
script/bootstrapwith these changes, on an Ubuntu machine and two Windows machines.npm installfrom inside thescript/directory, on the same three machines.More testing details (click to expand).
You can observe
~/.cache/electron/on Linux, andC:\Users\[User]\AppData\Local\electron\Cacheon Windows to see which versions ofchromedriverandmksnapshotare being downloaded.You can also run
script/node_modules/electron-chromedriver/bin/chromedriver --versionto note what the output is. This should be different across major versions of Electron. e.g.:Release Notes
N/A (this is an Atom-developer-oriented change, not an Atom-user-oriented change.)