Skip to content

Commit

Permalink
feat: rename --no-goma option to --no-remote (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 authored Jan 17, 2024
1 parent 9be9685 commit 8a6af3a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
20 changes: 12 additions & 8 deletions src/e-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function ensureGNGen(config) {
return runGNGen(config);
}

function runNinja(config, target, useGoma, ninjaArgs) {
if (useGoma && config.goma !== 'none') {
function runNinja(config, target, useRemote, ninjaArgs) {
if (useRemote && config.goma !== 'none') {
goma.downloadAndPrepare(config);

// maybe authenticate with Goma
Expand All @@ -45,7 +45,7 @@ function runNinja(config, target, useGoma, ninjaArgs) {
if (!ninjaArgs.includes('-j') && !ninjaArgs.find(arg => /^-j[0-9]+$/.test(arg.trim()))) {
ninjaArgs.push('-j', 200);
}
} else if (config.reclient !== 'none') {
} else if (useRemote && config.reclient !== 'none') {
reclient.downloadAndPrepare(config);
reclient.auth(config);

Expand All @@ -54,7 +54,7 @@ function runNinja(config, target, useGoma, ninjaArgs) {
ninjaArgs.push('-j', 200);
}
} else {
console.info(`${color.info} Building ${target} with Goma disabled`);
console.info(`${color.info} Building ${target} with remote execution disabled`);
}

depot.ensure(config);
Expand All @@ -68,8 +68,12 @@ function runNinja(config, target, useGoma, ninjaArgs) {
const args = [...ninjaArgs, target];
const opts = {
cwd: evmConfig.outDir(config),
...(useGoma ? {} : { env: { GOMA_DISABLED: true } }),
};
if (!useRemote && config.goma !== 'none') {
opts.env = { GOMA_DISABLED: true };
} else if (!useRemote && config.reclient !== 'none') {
opts.env = { RBE_remote_disabled: true };
}
depot.execFileSync(config, exec, args, opts);
}

Expand All @@ -79,7 +83,7 @@ program
.option('--list-targets', 'Show all supported build targets', false)
.option('--gen', 'Force a re-run of `gn gen` before building', false)
.option('-t|--target [target]', 'Forces a specific ninja target')
.option('--no-goma', 'Build without goma')
.option('--no-remote', 'Build without remote execution (entirely locally)')
.allowUnknownOption()
.action((target, ninjaArgs, options) => {
try {
Expand Down Expand Up @@ -132,15 +136,15 @@ program
}

try {
runNinja(config, target, options.goma, ninjaArgs);
runNinja(config, target, options.remote, ninjaArgs);
} catch (ex) {
if (target === targets['node:headers']) {
// Older versions of electron use a different target for node headers so try that if the new one fails.
const olderTarget = 'third_party/electron_node:headers';
console.info(
`${color.info} Error building ${target}; trying older ${olderTarget} target`,
);
runNinja(config, olderTarget, options.goma, ninjaArgs);
runNinja(config, olderTarget, options.remote, ninjaArgs);
} else {
throw ex;
}
Expand Down
7 changes: 5 additions & 2 deletions src/e-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ program
.option('--electronVersion <version>', 'Electron release to run tests against')
.option('--node', 'Run node spec runner', false)
.option('--nan', 'Run nan spec runner', false)
.option('--no-goma', 'Build test runner components (e.g. node:headers) without goma')
.option(
'--no-remote',
'Build test runner components (e.g. node:headers) without remote execution',
)
.addOption(
new program.Option(
'--runners <runner>',
Expand Down Expand Up @@ -68,7 +71,7 @@ program
script = './script/nan-spec-runner.js';
}
if (!options.electronVersion) {
ensureNodeHeaders(config, options.goma);
ensureNodeHeaders(config, options.remote);
}
runSpecRunner(config, script, specRunnerArgs);
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
const evmConfig = require('../evm-config');
const { ensureDir } = require('./paths');

function ensureNodeHeaders(config, useGoma) {
function ensureNodeHeaders(config, useRemote) {
const src_dir = path.resolve(config.root, 'src');
const out_dir = evmConfig.outDir(config);
const node_headers_dir = path.resolve(out_dir, 'gen', 'node_headers');
Expand All @@ -24,7 +24,7 @@ function ensureNodeHeaders(config, useGoma) {
if (needs_build) {
const exec = process.execPath;
const args = [path.resolve(__dirname, '..', 'e'), 'build', 'node:headers'];
if (!useGoma) args.push('--no-goma');
if (!useRemote) args.push('--no-remote');

const opts = { stdio: 'inherit', encoding: 'utf8' };
childProcess.execFileSync(exec, args, opts);
Expand Down

0 comments on commit 8a6af3a

Please sign in to comment.