豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 17a2bdf

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
Rebuild inside script and not output file
This moves the rebuild logic outside the generated `run.ts` to make sure that itself is also generated from the latest version. It also makes sure that the target is always up to date when the script is involved. Fixed: 458676656 Change-Id: I897b4d24add429148b7ccabb8e61041f2755981c Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7572126 Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org> Reviewed-by: Philip Pfaffe <pfaffe@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org>
1 parent 5d869f9 commit 17a2bdf

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

scripts/run_on_target.mjs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,24 @@ const argv = yargs(process.argv.slice(2))
1818
.option('target', {
1919
alias: 't',
2020
type: 'string',
21-
default: getEnvString(ENV.TARGET, 'Default')
21+
default: getEnvString(ENV.TARGET, 'Default'),
22+
})
23+
.option('skip-ninja', {
24+
type: 'boolean',
25+
default: false,
26+
})
27+
.option('debug', {
28+
type: 'boolean',
29+
default: false,
2230
})
2331
.help(false)
2432
.version(false)
2533
.parseSync();
2634

2735
const target = argv.target;
2836
let script = argv.script;
37+
const skipNinja = argv.skipNinja;
38+
const debug = argv.debug;
2939

3040
delete argv.target;
3141
delete argv.script;
@@ -69,22 +79,24 @@ if (
6979
);
7080
process.exit(1);
7181
}
72-
const scriptPath = path.resolve(cwd, script);
73-
if (!fs.existsSync(scriptPath)) {
74-
console.error(`Script path ${scriptPath} does not exist, trying ninja...`);
75-
const { error, status } = childProcess.spawnSync(
82+
83+
if (!skipNinja) {
84+
const { error, status, stdout, stderr } = childProcess.spawnSync(
7685
'autoninja',
7786
['-C', cwd, script],
78-
{ stdio: 'inherit', cwd: sourceRoot },
87+
{ stdio: debug ? 'inherit' : 'pipe', cwd: sourceRoot },
7988
);
80-
if (error) {
81-
throw error;
82-
}
83-
if (status) {
84-
process.exit(status);
89+
if (status || error) {
90+
console.log(stdout.toString());
91+
console.log(stderr.toString());
92+
if (error) {
93+
console.error(error);
94+
}
95+
process.exit(status ?? 1);
8596
}
8697
}
8798

99+
const scriptPath = path.resolve(cwd, script);
88100
const { argv0 } = process;
89101
const { status } = childProcess.spawnSync(
90102
argv0,

0 commit comments

Comments
 (0)