MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / gnArgsForTarget

Function gnArgsForTarget

scripts/devtools_build.mjs:326–357  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

324 * @param {string} target
325 */
326export function gnArgsForTarget(target) {
327 let gnArgs = gnArgsCache.get(target);
328 if (!gnArgs) {
329 gnArgs = (async () => {
330 const outDir = path.join(rootPath(), 'out', target);
331 try {
332 const cwd = rootPath();
333 const gnExe = vpython3ExecutablePath();
334 const gnArgs = [
335 gnPyPath(),
336 '-q',
337 'args',
338 outDir,
339 '--json',
340 '--list',
341 '--short',
342 ];
343 const { stdout } = await spawn(gnExe, gnArgs, { cwd });
344 return new Map(
345 JSON.parse(stdout).map(arg => [
346 arg.name,
347 arg.current?.value ?? arg.default?.value,
348 ]),
349 );
350 } catch {
351 return new Map();
352 }
353 })();
354 gnArgsCache.set(target, gnArgs);
355 }
356 return gnArgs;
357}
358
359/** @type Map<string, Map<string, Promise<Array<string>>>> */
360const gnRefsCache = new Map();

Callers 3

findBrowserBinaryFunction · 0.90
prepareBuildFunction · 0.85

Calls 9

rootPathFunction · 0.90
vpython3ExecutablePathFunction · 0.90
gnPyPathFunction · 0.90
spawnFunction · 0.85
getMethod · 0.65
setMethod · 0.65
joinMethod · 0.45
mapMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected