MCPcopy Index your code
hub / github.com/nodejs/node / build

Method build

deps/v8/tools/dev/gm.py:456–517  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

454 _write(args_gn, new_gn_args, log=False)
455
456 def build(self):
457 self.update_build_distribution_args()
458 # If the target is to just build args.gn then we are done here; otherwise
459 # drop that target because it's not something ninja can build.
460 if 'gn_args' in self.targets:
461 self.targets.remove('gn_args')
462 if len(self.targets) == 0:
463 return 0
464 # When printing, print a relative path for conciseness.
465 cwd = Path.cwd()
466 if cwd == V8_DIR:
467 try:
468 printable_path = self.path.relative_to(cwd)
469 except:
470 printable_path = self.path
471 else:
472 printable_path = self.path
473 build_ninja = self.path / "build.ninja"
474 if not build_ninja.exists():
475 code = _call(f"gn gen {printable_path}")
476 if code != 0:
477 return code
478 elif self.clean:
479 code = _call(f"gn clean {printable_path}")
480 if code != 0:
481 return code
482 targets = " ".join(self.targets)
483 quiet = "--quiet " if QUIET else ""
484 cmd = f"autoninja {quiet}-C {printable_path} {targets}"
485
486 # The implementation of mksnapshot failure detection relies on
487 # the "pty" module and GDB presence, so skip it on non-Linux.
488 if not USE_PTY:
489 return _call(cmd)
490
491 return_code, output = _call_with_output(cmd)
492 if return_code != 0 and "FAILED:" in output:
493 if "snapshot_blob" in output:
494 if "gen-static-roots.py" in output:
495 _notify("V8 build requires your attention",
496 "Please re-generate static roots.")
497 return return_code
498 csa_trap = re.compile("Specify option( --csa-trap-on-node=[^ ]*)")
499 match = csa_trap.search(output)
500 extra_opt = match.group(1) if match else ""
501 cmdline = re.compile("python3 ../../tools/run.py ./mksnapshot (.*)")
502 orig_cmdline = cmdline.search(output).group(1).strip()
503 cmdline = (
504 prepare_mksnapshot_cmdline(orig_cmdline, self.path) + extra_opt)
505 _notify("V8 build requires your attention",
506 "Detected mksnapshot failure, re-running in GDB...")
507 _call(cmdline)
508 elif "run.py ./torque" in output and not ": Torque Error: " in output:
509 # Torque failed/crashed without printing an error message.
510 cmdline = re.compile("python3 ../../tools/run.py ./torque (.*)")
511 orig_cmdline = cmdline.search(output).group(1).strip()
512 cmdline = f"gdb --args "
513 cmdline = prepare_torque_cmdline(orig_cmdline, self.path)

Callers 2

buildMethod · 0.45
mainFunction · 0.45

Calls 11

_callFunction · 0.85
_call_with_outputFunction · 0.85
_notifyFunction · 0.85
prepare_torque_cmdlineFunction · 0.85
removeMethod · 0.45
existsMethod · 0.45
joinMethod · 0.45
compileMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected