Skip to content

Commit 3b54890

Browse files
pfaffeDevtools-frontend LUCI CQ
authored andcommitted
Partially revert crrev.com/c/6403238
Undo the test script changes, which broke the integrated checkout workflow. Bug: none Change-Id: I1a29f605949265510c15725b1fd370b9ddd369ec Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6415791 Auto-Submit: Philip Pfaffe <[email protected]> Reviewed-by: Simon Zünd <[email protected]> Commit-Queue: Philip Pfaffe <[email protected]>
1 parent f591172 commit 3b54890

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

scripts/run_on_target.mjs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import * as path from 'path';
88
import yargs from 'yargs';
99
import unparse from 'yargs-unparser';
1010

11-
import {isInChromiumDirectory, nodeModulesPath, rootPath} from './devtools_paths.js';
12-
1311
const argv = yargs(process.argv.slice(2))
1412
.parserConfiguration({
1513
'strip-aliased': true,
@@ -26,22 +24,32 @@ let script = argv.script;
2624
delete argv.target;
2725
delete argv.script;
2826

29-
const sourceRoot = rootPath();
27+
let sourceRoot = path.dirname(path.dirname(path.resolve(argv['$0'])));
3028

3129
// Ensure that we can find the node_modules folder even if the out folder is
3230
// not a sibling of the node_modules folder.
3331
const env = process.env;
34-
env.NODE_PATH = nodeModulesPath();
32+
env.NODE_PATH = path.join(sourceRoot, 'node_modules');
3533

36-
const cwd = path.join(sourceRoot, 'out', target);
34+
let cwd = path.join(sourceRoot, 'out', target);
3735

38-
if (isInChromiumDirectory().isInChromium) {
39-
// Check if we need to change the location of the gen folder.
40-
const pathParts = script.split(path.sep);
41-
if (pathParts[0] === 'gen') {
42-
pathParts.shift();
43-
pathParts.unshift('gen', 'third_party', 'devtools-frontend', 'src');
44-
script = pathParts.join(path.sep);
36+
if (!fs.existsSync(cwd)) {
37+
// Check if we are in a Chromium checkout and look for the out folder there.
38+
const maybeChromiumRoot = path.dirname(
39+
path.dirname(path.dirname(sourceRoot)),
40+
);
41+
if (
42+
sourceRoot ===
43+
path.join(maybeChromiumRoot, 'third_party', 'devtools-frontend', 'src')
44+
) {
45+
sourceRoot = maybeChromiumRoot;
46+
cwd = path.join(sourceRoot, 'out', target);
47+
const pathParts = script.split(path.sep);
48+
if (pathParts[0] === 'gen') {
49+
pathParts.shift();
50+
pathParts.unshift('gen', 'third_party', 'devtools-frontend', 'src');
51+
script = pathParts.join(path.sep);
52+
}
4553
}
4654
}
4755

0 commit comments

Comments
 (0)