MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / _cargo_build

Function _cargo_build

misc/python/materialize/cli/run.py:444–497  ·  view source on GitHub ↗
(
    args: argparse.Namespace, extra_programs: list[str] = []
)

Source from the content-addressed store, hash-verified

442
443
444def _cargo_build(
445 args: argparse.Namespace, extra_programs: list[str] = []
446) -> tuple[int, list[str]]:
447 env = dict(os.environ)
448 command = _cargo_command(args, "build")
449 features = []
450
451 if args.coverage:
452 env["RUSTFLAGS"] = (
453 env.get("RUSTFLAGS", "") + " " + " ".join(rustc_flags.coverage)
454 )
455 env["LLVM_PROFILE_FILE"] = "/dev/null"
456 if args.sanitizer != "none":
457 env["RUSTFLAGS"] = (
458 env.get("RUSTFLAGS", "")
459 + " "
460 + " ".join(rustc_flags.sanitizer[args.sanitizer])
461 )
462 env["CFLAGS"] = (
463 env.get("CFLAGS", "")
464 + " "
465 + " ".join(rustc_flags.sanitizer_cflags[args.sanitizer])
466 )
467 env["CXXFLAGS"] = (
468 env.get("CXXFLAGS", "")
469 + " "
470 + " ".join(rustc_flags.sanitizer_cflags[args.sanitizer])
471 )
472 env["LDFLAGS"] = (
473 env.get("LDFLAGS", "")
474 + " "
475 + " ".join(rustc_flags.sanitizer_cflags[args.sanitizer])
476 )
477 if args.foundationdb:
478 features.append("foundationdb")
479 if args.features:
480 features.extend(args.features.split(","))
481 if features:
482 command += [f"--features={','.join(features)}"]
483
484 programs = [*REQUIRED_SERVICES, *extra_programs]
485 for program in programs:
486 command += ["--bin", program]
487 completed_proc = spawn.runv(
488 command,
489 env=env,
490 cwd=pathlib.Path(
491 os.path.abspath(os.path.join(os.path.realpath(sys.argv[0]), "../.."))
492 ),
493 )
494
495 artifacts = [str(_cargo_artifact_path(args, program)) for program in programs]
496
497 return (completed_proc.returncode, artifacts)
498
499
500def _cargo_command(args: argparse.Namespace, *subcommands: str) -> list[str]:

Callers 1

mainFunction · 0.85

Calls 7

_cargo_commandFunction · 0.85
_cargo_artifact_pathFunction · 0.85
getMethod · 0.45
joinMethod · 0.45
appendMethod · 0.45
extendMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected