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

feat: use reclient on init instead of goma #537

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions evm-config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"minLength": 1
},
"goma": {
"$comment": "Deprecated, use reclient instead",
"description": "Goma mode to use",
"type": "string",
"enum": [
Expand Down
5 changes: 3 additions & 2 deletions example-configs/evm.base.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
root: /path/to/your/developer/folder
reclient: remote_exec
remotes:
electron:
# SSH or HTTPS url
Expand All @@ -7,8 +8,8 @@ remotes:
origin: [email protected]:electron/electron.git
gen:
args:
# path to goma for faster builds (https://notgoma.com)
- import("/Users/user_name/.electron_build_tools/third_party/goma.gn")
# Enable reclient
- use_remoteexec = true
out: Testing
env:
GIT_CACHE_PATH: /Users/user_name/.git_cache
Expand Down
4 changes: 2 additions & 2 deletions example-configs/evm.chromium.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
root: /path/to/chromium/
reclient: remote_exec
defaultTarget: chrome
gen:
args:
# path to goma for faster builds (https://notgoma.com)
- import("/Users/user_name/.electron_build_tools/third_party/goma.gn")
- use_remoteexec = true
- is_debug = false
out: Default
env:
Expand Down
28 changes: 12 additions & 16 deletions src/e-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { URI } = require('vscode-uri');
const evmConfig = require('./evm-config');
const { color, fatal } = require('./utils/logging');
const { resolvePath, ensureDir } = require('./utils/paths');
const goma = require('./utils/goma');
const reclient = require('./utils/reclient');
const depot = require('./utils/depot-tools');
const { checkGlobalGitConfig } = require('./utils/git');

Expand All @@ -27,8 +27,8 @@ function createConfig(options) {
// build the `gn gen` args
const gn_args = [`import("//electron/build/args/${options.import}.gn")`];

if (options.goma !== 'none') {
gn_args.push(`import("${goma.gnFilePath}")`);
if (options.reclient !== 'none') {
gn_args.push(`use_remoteexec = true`);
}

if (options.asan) gn_args.push('is_asan=true');
Expand All @@ -51,7 +51,8 @@ function createConfig(options) {

return {
$schema: URI.file(path.resolve(__dirname, '..', 'evm-config.schema.json')).toString(),
goma: options.goma,
goma: 'none',
reclient: options.reclient,
root,
remotes: {
electron,
Expand All @@ -65,11 +66,6 @@ function createConfig(options) {
GIT_CACHE_PATH: process.env.GIT_CACHE_PATH
? resolvePath(process.env.GIT_CACHE_PATH)
: path.resolve(homedir, '.git_cache'),
GOMA_CACHE_DIR: path.resolve(homedir, '.goma_cache'),
GOMA_DEPS_CACHE_FILE: 'deps-cache',
GOMA_COMPILER_INFO_CACHE_FILE: 'compiler-info-cache',
GOMA_LOCAL_OUTPUT_CACHE_DIR: path.resolve(homedir, '.goma_output_cache'),
...(options.goma !== 'cluster' && { GOMACTL_SKIP_AUTH: 'true' }),
},
};
}
Expand Down Expand Up @@ -133,11 +129,11 @@ program
.option('--bootstrap', 'Run `e sync` and `e build` after creating the build config.')
.addOption(
new Option(
'--goma <target>',
`Use Electron's custom deployment of Goma. The "cluster" mode is only available to maintainers`,
'--reclient <target>',
`Use Electron's RBE backend. The "remote_exec" mode will fall back to cache-only depending on the auth provided`,
)
.choices(['cache-only', 'cluster', 'none'])
.default('cache-only'),
.choices(['remote_exec', 'none'])
.default('remote_exec'),
)
.option(
'--use-https',
Expand Down Expand Up @@ -190,9 +186,9 @@ program
childProcess.execFileSync(process.execPath, [e, 'sync', '-v'], opts);
}

// maybe authenticate with Goma
if (config.goma === 'cluster') {
goma.auth(config);
// maybe authenticate with RBE
if (process.env.NODE_ENV !== 'test' && config.reclient === 'remote_exec') {
childProcess.execFileSync(process.execPath, [e, 'd', 'rbe', 'login'], opts);
}

// (maybe) build Electron
Expand Down
2 changes: 1 addition & 1 deletion tests/e-init-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('e-init', () => {

const config = require(configPath);
expect(config).toHaveProperty('$schema');
expect(config.goma).toStrictEqual('cache-only');
expect(config.reclient).toStrictEqual('remote_exec');

expect(config.remotes).toHaveProperty('electron');
expect(config.remotes).not.toHaveProperty('node');
Expand Down
1 change: 1 addition & 0 deletions tests/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function createSandbox() {
const execOptions = {
encoding: 'utf8',
env: {
NODE_ENV: process.env.NODE_ENV,
// have `e` use our test sandbox's build-tools config dir
EVM_CONFIG: evm_config_dir,

Expand Down