(target, filename)
| 360 | const gnRefsCache = new Map(); |
| 361 | |
| 362 | function gnRefsForTarget(target, filename) { |
| 363 | let gnRefsPerTarget = gnRefsCache.get(target); |
| 364 | if (!gnRefsPerTarget) { |
| 365 | gnRefsPerTarget = new Map(); |
| 366 | gnRefsCache.set(target, gnRefsPerTarget); |
| 367 | } |
| 368 | let gnRef = gnRefsPerTarget.get(filename); |
| 369 | if (!gnRef) { |
| 370 | gnRef = (async () => { |
| 371 | const cwd = rootPath(); |
| 372 | const outDir = path.join(rootPath(), 'out', target); |
| 373 | const gnExe = vpython3ExecutablePath(); |
| 374 | const gnArgs = [gnPyPath(), 'refs', outDir, '--as=output', filename]; |
| 375 | const { stdout } = await spawn(gnExe, gnArgs, { cwd }); |
| 376 | return stdout.trim().split('\n'); |
| 377 | })(); |
| 378 | gnRefsPerTarget.set(filename, gnRef); |
| 379 | } |
| 380 | return gnRef; |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * |
no test coverage detected