(target, options = {})
| 431 | * @returns a `BuildResult` with statistics for the build. |
| 432 | */ |
| 433 | export async function build(target, options = {}) { |
| 434 | const startTime = performance.now(); |
| 435 | const outDir = path.join(rootPath(), 'out', target); |
| 436 | |
| 437 | // Build just the devtools-frontend resources in |outDir|. This is important |
| 438 | // since we might be running in a full Chromium checkout and certainly don't |
| 439 | // want to build all of Chromium first. |
| 440 | const buildTargets = await computeBuildTargetsForFiles( |
| 441 | target, |
| 442 | options.filenames, |
| 443 | ); |
| 444 | try { |
| 445 | const autoninjaExe = vpython3ExecutablePath(); |
| 446 | const autoninjaArgs = [autoninjaPyPath(), '-C', outDir, ...buildTargets]; |
| 447 | await spawn(autoninjaExe, autoninjaArgs, { |
| 448 | signal: options.signal, |
| 449 | }); |
| 450 | } catch (cause) { |
| 451 | if (cause.name === 'AbortError') { |
| 452 | throw cause; |
| 453 | } |
| 454 | throw new BuildError(BuildStep.AUTONINJA, { cause, outDir, target }); |
| 455 | } |
| 456 | |
| 457 | // Report the build result. |
| 458 | const time = (performance.now() - startTime) / 1000; |
| 459 | return { time }; |
| 460 | } |
no test coverage detected