Skip to content

Commit cc14a6f

Browse files
authored
Merge branch 'electron:main' into main
2 parents b321c71 + f89a920 commit cc14a6f

26 files changed

+1142
-417
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
git config --global core.eol lf
2727
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2
2828
- name: Setup Node.js
29-
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # tag: v4.2.0
29+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # tag: v4.4.0
3030
with:
3131
node-version: lts/-1
3232
- name: Cache node_modules
3333
id: cache-node-modules
34-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # tag: v4.2.0
34+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # tag: v4.2.3
3535
with:
3636
path: node_modules
3737
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-node-modules

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,19 @@ jobs:
3030
git config --global core.eol lf
3131
git config --global core.filemode false
3232
git config --global core.fscache true
33+
git config --global core.longpaths true
3334
git config --global core.preloadindex true
3435
git config --global branch.autosetuprebase always
3536
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2
3637
with:
3738
fetch-depth: 1
3839
- name: Setup Node.js
39-
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # tag: v4.2.0
40+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # tag: v4.4.0
4041
with:
4142
node-version: lts/-1
4243
- name: Cache node_modules
4344
id: cache-node-modules
44-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # tag: v4.2.0
45+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # tag: v4.2.3
4546
with:
4647
path: node_modules
4748
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-node-modules

.github/workflows/validate-configs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ jobs:
1616
- name: Checkout
1717
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1818
- name: Validate JSON schema
19-
uses: dsanders11/json-schema-validate-action@ec60131eddf6f51ed0c737fdcd28616ae1a0e564 # v1.2.0
19+
uses: dsanders11/json-schema-validate-action@79b2d95a446a0d786f7f244ae7764f8370ff3657 # v1.4.0
2020
with:
2121
schema: json-schema
2222
files: evm-config.schema.json
2323
- name: Validate GitHub Actions workflows
24-
uses: dsanders11/json-schema-validate-action@ec60131eddf6f51ed0c737fdcd28616ae1a0e564 # v1.2.0
24+
uses: dsanders11/json-schema-validate-action@79b2d95a446a0d786f7f244ae7764f8370ff3657 # v1.4.0
2525
with:
2626
schema: https://json.schemastore.org/github-workflow.json
2727
files: .github/workflows/*.yml
2828
- name: Validate .prettierrc.json
29-
uses: dsanders11/json-schema-validate-action@ec60131eddf6f51ed0c737fdcd28616ae1a0e564 # v1.2.0
29+
uses: dsanders11/json-schema-validate-action@79b2d95a446a0d786f7f244ae7764f8370ff3657 # v1.4.0
3030
with:
3131
schema: https://json.schemastore.org/prettierrc.json
3232
files: .prettierrc.json

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ To see all potential options for this command, run:
194194
$ e build --help
195195
```
196196
197-
Once you have the source, the next step is to build it with `e build [target]`.
197+
Once you have the source, the next step is to build it with `e build --target [target]`.
198198
Some of the build targets you may want to build include:
199199
200200
| Target | Description |
@@ -248,6 +248,12 @@ For example, running `e d gn ls out/Testing | grep "//ui/views/"` produces somet
248248
249249
You could then run `e build --target ui/views/examples:views_examples_with_content` to produce Chrome's `//ui/views` example executable and run it with `./out/Testing/views_examples_with_content`.
250250
251+
When first run, `e build` will try to set up reclient to speed up your builds. The permission prompt
252+
can look scary because GitHub's UI is less than optimal
253+
([related discussion](https://github.com/orgs/community/discussions/37117)). However, Electron only
254+
obtains user profile access and `read:org` permission. No permission is granted to any of your
255+
repositories or content.
256+
251257
## Using Electron
252258
253259
After you've built Electron, it's time to use it!

evm-config.schema.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@
2929
"type": "string",
3030
"minLength": 1
3131
},
32-
"reclient": {
33-
"description": "Whether to use the Electron RBE infrastructure",
32+
"remoteBuild": {
33+
"description": "Whether to use remote builds and what system to use",
3434
"type": "string",
3535
"enum": [
36-
"remote_exec",
36+
"reclient",
37+
"siso",
3738
"none"
3839
]
3940
},
40-
"reclientHelperPath": {
41+
"rbeHelperPath": {
4142
"description": "Path to alternative reclient credential helper",
4243
"type": "string"
4344
},
44-
"reclientServiceAddress": {
45+
"rbeServiceAddress": {
4546
"description": "Alternative RBE cluster address",
4647
"type": "string"
4748
},

example-configs/evm.base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
root: /path/to/your/developer/folder
2-
reclient: remote_exec
2+
remoteBuild: reclient
33
preserveSDK: 5
44
remotes:
55
electron:

example-configs/evm.chromium.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
root: /path/to/chromium/
2-
reclient: remote_exec
2+
remoteBuild: reclient
33
defaultTarget: chrome
44
execName: Chromium
55
gen:

src/download.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,21 @@ const { progressStream } = require('./utils/download');
88
const write = fs.createWriteStream(process.argv[3]);
99

1010
async function tryDownload(attemptsLeft = 3) {
11-
const response = await fetch(process.argv[2]);
11+
const url = process.argv[2];
12+
if (!url) {
13+
return fatal('No URL provided for download');
14+
}
15+
16+
const response = await fetch(url);
17+
18+
if (!response.ok) {
19+
if (attemptsLeft === 0) {
20+
return fatal(`Download failed - ${response.status} ${response.statusText}`);
21+
}
22+
console.log(`Download failed - trying ${attemptsLeft} more times`);
23+
return tryDownload(attemptsLeft - 1);
24+
}
25+
1226
const total = parseInt(response.headers.get('content-length'), 10);
1327
const progress = progressStream(total, '[:bar] :mbRateMB/s :percent :etas');
1428

src/e

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ program
9595
.action((args) => {
9696
try {
9797
const exec = evmConfig.execOf(evmConfig.current());
98+
if (!fs.existsSync(exec)) {
99+
fatal(`Could not find Electron executable at ${color.path(exec)}`);
100+
}
101+
98102
const opts = { stdio: 'inherit' };
99103
console.log(color.childExec(exec, args, opts));
100104
cp.execFileSync(exec, args, opts);
@@ -179,13 +183,18 @@ program
179183
'Opens a PR to electron/electron that backport the given CL into our patches folder',
180184
)
181185
.alias('auto-cherry-pick')
182-
.command('gh-auth', 'Generates a device oauth token');
186+
.command('gh-auth', 'Generates a device oauth token')
187+
.command(
188+
'rcv <roll-pr> [chromium-version]',
189+
'Attempts to reconstruct an intermediate Chromium version from a roll PR',
190+
)
191+
.alias('reconstruct-chromium-version');
183192

184193
program
185-
.command('load-macos-sdk')
194+
.command('load-macos-sdk [version]')
186195
.description('Loads required versions of macOS SDKs and symlinks them (may require sudo)')
187-
.action(() => {
188-
ensureSDK();
196+
.action((version) => {
197+
ensureSDK(version);
189198
});
190199

191200
program

src/e-build.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const { color, fatal } = require('./utils/logging');
1010
const depot = require('./utils/depot-tools');
1111
const { ensureDir } = require('./utils/paths');
1212
const reclient = require('./utils/reclient');
13+
const siso = require('./utils/siso');
1314
const { ensureSDK, ensureSDKAndSymlink } = require('./utils/sdk');
1415

1516
function getGNArgs(config) {
@@ -42,7 +43,7 @@ function runGNGen(config) {
4243
fs.writeFileSync(argsFile, gnArgs, { encoding: 'utf8' });
4344
const execArgs = ['gen', `out/${config.gen.out}`];
4445
const execOpts = { cwd: path.resolve(config.root, 'src') };
45-
depot.execFileSync(config, gnPath, execArgs, execOpts);
46+
depot.spawnSync(config, gnPath, execArgs, execOpts);
4647
}
4748

4849
function ensureGNGen(config) {
@@ -58,13 +59,21 @@ function ensureGNGen(config) {
5859
}
5960

6061
function runNinja(config, target, ninjaArgs) {
61-
if (reclient.usingRemote && config.reclient !== 'none') {
62+
if (reclient.usingRemote && config.remoteBuild !== 'none') {
6263
reclient.auth(config);
6364

6465
// Autoninja sets this absurdly high, we take it down a notch
65-
if (!ninjaArgs.includes('-j') && !ninjaArgs.find((arg) => /^-j[0-9]+$/.test(arg.trim()))) {
66+
if (
67+
!ninjaArgs.includes('-j') &&
68+
!ninjaArgs.find((arg) => /^-j[0-9]+$/.test(arg.trim())) &&
69+
config.remoteBuild === 'reclient'
70+
) {
6671
ninjaArgs.push('-j', 200);
6772
}
73+
74+
if (config.remoteBuild === 'siso') {
75+
ninjaArgs.push(...siso.flags(config));
76+
}
6877
} else {
6978
console.info(`${color.info} Building ${target} with remote execution disabled`);
7079
}
@@ -84,7 +93,7 @@ function runNinja(config, target, ninjaArgs) {
8493
if (!reclient.usingRemote && config.reclient !== 'none') {
8594
opts.env = { RBE_remote_disabled: true };
8695
}
87-
depot.execFileSync(config, exec, args, opts);
96+
depot.spawnSync(config, exec, args, opts);
8897
}
8998

9099
program
@@ -94,7 +103,7 @@ program
94103
.option('-t|--target [target]', 'Build a specific ninja target')
95104
.option('--no-remote', 'Build without remote execution (entirely locally)')
96105
.allowUnknownOption()
97-
.action((ninjaArgs, options) => {
106+
.action(async (ninjaArgs, options) => {
98107
try {
99108
const config = evmConfig.current();
100109

@@ -109,7 +118,8 @@ program
109118
);
110119
}
111120

112-
reclient.downloadAndPrepare(config);
121+
reclient.downloadAndPrepareRBECredentialHelper(config);
122+
await siso.ensureBackendStarlark(config);
113123

114124
if (process.platform === 'darwin') {
115125
ensureSDK();

0 commit comments

Comments
 (0)