2017-08-07 22:31:12 +00:00
# Upgrading Chromium Workflow
This document is meant to serve as an overview of what steps are needed
on each Chromium upgrade in Electron.
2017-11-20 22:02:54 +00:00
- Upgrade libcc to a new Chromium version
- Make Electron code compatible with the new libcc
2017-11-21 07:18:12 +00:00
- Update Electron dependencies (crashpad, NodeJS, etc.) if needed
2017-11-20 22:02:54 +00:00
- Make internal builds of libcc and electron
- Update Electron docs if necessary
## Upgrade `libcc` to a new Chromium
### Steps
2017-11-21 14:19:33 +00:00
### 1. Get the code and initialize the project:
2017-11-22 09:43:24 +00:00
```sh
2017-11-21 14:19:33 +00:00
$ git clone git@github.com:electron/libchromiumcontent.git
$ cd libchromiumcontent
$ ./script/bootstrap -v
```
### 2. Find the new beta/stable Chromium version from [OmahaProxy](https://omahaproxy.appspot.com/).
### 3. Put it into the `libchromiumcontent/VERSION` file, then run `$ ./script/update`
2017-11-20 22:02:54 +00:00
- It will probably fail applying patches.
2017-11-21 14:19:33 +00:00
### 4. Fix `*.patch` files in the `/patches` and `/patches-mas` folders.
### 5. (Optional) Run a separate script to apply patches (`script/update` uses it internally):
2017-11-22 09:43:24 +00:00
```sh
2017-11-21 14:19:33 +00:00
$ ./script/apply-patches
```
2017-11-20 22:02:54 +00:00
- There is also another script `/script/patch.py` that could be more useful, check `--help` to learn how it works with `$ ./script/patch.py -h`
2017-11-21 14:19:33 +00:00
### 6. Run the build when all patches can be applied without errors
2017-11-22 09:43:24 +00:00
```sh
2017-11-21 14:19:33 +00:00
$ ./script/build
```
2017-11-20 22:02:54 +00:00
- If some patches are no longer compatible with the Chromium code, fix compilation errors.
2017-11-21 14:19:33 +00:00
### 7. When build succeeds, create a `dist` for Electron
2017-11-20 22:02:54 +00:00
`$ ./script/create-dist --no_zip`
- It will create `dist/main` folder in the root of the libcc repo, you will need it to build Electron.
2017-11-21 14:19:33 +00:00
### 8. (Optional) Update script contents if there are errors resultant of some files being removed or renamed. (`--no_zip` prevents script from create `dist` archives, you don't need them.)
2017-11-20 22:02:54 +00:00
## Update Electron Code
### Steps
2017-11-21 14:19:33 +00:00
### 1. Get the code:
2017-11-22 09:43:24 +00:00
```sh
2017-11-21 14:19:33 +00:00
$ git clone git@github.com:electron/electron.git
$ cd electron
```
### 2. If you already have libcc built on you machine in its own repo, you need to tell Electron explicitly to use it:
2017-11-22 09:43:24 +00:00
```sh
2017-11-20 22:02:54 +00:00
$ ./script/bootstrap.py -v \
--libcc_source_path < libcc_folder > /src \
--libcc_shared_library_path < libcc_folder > /shared_library \
--libcc_static_library_path < libcc_folder > /static_library
2017-11-21 14:19:33 +00:00
```
- If you haven't yet built libcc but it's already supposed to be upgraded to a new Chromium, bootstrap Electron as usual
`$ ./script/bootstrap.py -v`
2017-11-20 22:02:54 +00:00
- Ensure that libcc submodule (`vendor/libchromiumcontent`) points to a right revision
2017-11-21 14:19:33 +00:00
### 3. Set CLANG_REVISION in` script/update-clang.sh` to match the version Chromium is using.
- Located in `electron/libchromiumcontent/src/tools/clang/scripts/update.py`
2017-11-20 22:02:54 +00:00
2017-11-21 14:19:33 +00:00
### 4. Checkout Chromium if you haven't already: https://chromium.googlesource.com/chromium/src.git/+/{VERSION}/tools/clang/scripts/update.py
2017-11-20 22:02:54 +00:00
- (Replace the `{VERSION}` placeholder in the url above to the Chromium version libcc uses.)
2017-11-21 14:19:33 +00:00
### 5. Build Electron.
- Try to build Debug version first: `$ ./script/build.py -c D`
- You will need it to run tests
### 6. Fix compilation and linking errors
### 7. Ensure that Release build can be built too: `$ ./script/build.py -c R`
2017-11-21 07:18:12 +00:00
- Often the Release build will have different linking errors that you'll need to fix.
- Some compilation and linking errors are caused by missing source/object files in the libcc `dist`
2017-11-21 14:19:33 +00:00
### 8. Update `./script/create-dist` in the libcc repo, recreate a `dist`, and run Electron bootstrap script once again.
2017-11-20 22:02:54 +00:00
2017-11-21 14:19:33 +00:00
### Tips for fixing compilation errors
2017-11-20 22:02:54 +00:00
- Fix build config errors first
- Fix fatal errors first, like missing files and errors related to compiler flags or defines
2017-11-21 07:18:12 +00:00
- Try to identify complex errors as soon as possible.
2017-11-20 22:02:54 +00:00
- Ask for help if you're not sure how to fix them
- Disable all Electron features, fix the build, then enable them one by one
- Add more build flags to disable features in build-time.
2017-11-21 07:18:12 +00:00
When a Debug build of Electron succeeds, run the tests:
2017-11-20 22:02:54 +00:00
`$ ./script/test.py`
Fix the failing tests.
Follow all the steps above to fix Electron code on all supported platforms.
## Update Crashpad
- Electron's crashpad fork: https://github.com/electron/crashpad
- Primary crashpad repo: https://chromium.googlesource.com/crashpad/crashpad/
### Steps
If there are any compilation errors related to the Crashpad, it probably means you need to update the fork to a newer revision:
2017-11-21 14:19:33 +00:00
### 1. Clone Electron's fork of the Crashpad, add the main repo as another remote:
2017-11-22 09:43:24 +00:00
```sh
$ git clone https://github.com/electron/crashpad & & cd crashpad
2017-11-21 14:19:33 +00:00
$ git remote add upstream https://chromium.googlesource.com/crashpad/crashpad/ & & git fetch upstream
```
### 2. Find a revision Chromium uses in src/third_party/crashpad/README.chromium
### 3. Rebase the master branch to that REVISION
2017-11-22 09:43:24 +00:00
```sh
2017-11-21 14:19:33 +00:00
$ git rebase REVISION
2017-11-20 22:02:54 +00:00
```
- If there are nontrivial conflicts during rebase, consult with the commit's author.
2017-11-21 14:19:33 +00:00
### 4. Add a tag with the next Electron version to a top commit in the master branch
2017-11-20 22:02:54 +00:00
- e.g. if current Electron version is `1.11.*` , then use tag `electron-1.12.0` , because it will be used in the next version.
2017-11-21 14:19:33 +00:00
### 5. Ensure Electron-specific commits in the master branch on GitHub are properly tagged
2017-11-20 22:02:54 +00:00
- If they aren't, force push will make them orphans and they'll be lost.
2017-11-21 14:19:33 +00:00
### 6. Force push to Electron's crashpad fork.
### 7. Update `/vendor/crashpad` submodule in the Electron's upgrade branch to point to the updated crashpad.
2017-11-20 22:02:54 +00:00
## Update NodeJS
2017-01-25 20:31:06 +00:00
2017-08-07 22:31:12 +00:00
- Upgrade `vendor/node` to the Node release that corresponds to the v8 version
being used in the new Chromium release. See the v8 versions in Node on
https://nodejs.org/en/download/releases for more details.
- You can find v8 version Chromium is using on [OmahaProxy ](http://omahaproxy.appspot.com ).
If it's not available check `v8/include/v8-version.h`
in the Chromium checkout.
2017-03-29 22:08:06 +00:00
## Verify ffmpeg Support
2017-03-29 22:07:30 +00:00
Electron ships with a version of `ffmpeg` that includes proprietary codecs by
default. A version without these codecs is built and distributed with each
release as well. Each Chrome upgrade should verify that switching this version is
still supported.
You can verify Electron's support for multiple `ffmpeg` builds by loading the
following page. It should work with the default `ffmpeg` library distributed
with Electron and not work with the `ffmpeg` library built without proprietary
codecs.
```html
<!DOCTYPE html>
< html >
< head >
< meta charset = "utf-8" >
< title > Proprietary Codec Check< / title >
< / head >
< body >
< p > Checking if Electron is using proprietary codecs by loading video from http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4< / p >
< p id = "outcome" > < / p >
< video style = "display:none" src = "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4" autoplay > < / video >
< script >
const video = document.querySelector('video')
video.addEventListener('error', ({target}) => {
if (target.error.code === target.error.MEDIA_ERR_SRC_NOT_SUPPORTED) {
document.querySelector('#outcome').textContent = 'Not using proprietary codecs, video emitted source not supported error event.'
} else {
document.querySelector('#outcome').textContent = `Unexpected error: ${target.error.code}`
}
})
video.addEventListener('playing', () => {
document.querySelector('#outcome').textContent = 'Using proprietary codecs, video started playing.'
})
< / script >
< / body >
< / html >
```
2017-08-07 22:31:12 +00:00
## Useful Links
2017-01-25 20:31:06 +00:00
- [Chrome Release Schedule ](https://www.chromium.org/developers/calendar )
2017-08-07 22:31:12 +00:00
- [OmahaProxy ](http://omahaproxy.appspot.com )
- [Chromium Issue Tracker ](https://bugs.chromium.org/p/chromium )