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

Method build

misc/python/materialize/mzbuild.py:765–845  ·  view source on GitHub ↗
(self, build_output: dict[str, Any])

Source from the content-addressed store, hash-verified

763 return prep
764
765 def build(self, build_output: dict[str, Any]) -> None:
766 cargo_profile = (
767 "release"
768 if self.rd.profile == Profile.RELEASE
769 else "optimized" if self.rd.profile == Profile.OPTIMIZED else "debug"
770 )
771
772 def copy(src: Path, relative_dst: Path) -> None:
773 exe_path = self.path / relative_dst
774 exe_path.parent.mkdir(parents=True, exist_ok=True)
775 shutil.copy(src, exe_path)
776
777 if self.strip:
778 # The debug information is large enough that it slows down CI,
779 # since we're packaging these binaries up into Docker images and
780 # shipping them around.
781 spawn.runv(
782 [*self.rd.tool("strip"), "--strip-debug", exe_path],
783 cwd=self.rd.root,
784 )
785 else:
786 # Even if we've been asked not to strip the binary, remove the
787 # `.debug_pubnames` and `.debug_pubtypes` sections. These are just
788 # indexes that speed up launching a debugger against the binary,
789 # and we're happy to have slower debugger start up in exchange for
790 # smaller binaries. Plus the sections have been obsoleted by a
791 # `.debug_names` section in DWARF 5, and so debugger support for
792 # `.debug_pubnames`/`.debug_pubtypes` is minimal anyway.
793 # See: https://github.com/rust-lang/rust/issues/46034
794 spawn.runv(
795 [
796 *self.rd.tool("objcopy"),
797 "-R",
798 ".debug_pubnames",
799 "-R",
800 ".debug_pubtypes",
801 exe_path,
802 ],
803 cwd=self.rd.root,
804 )
805
806 for bin in self.bins:
807 src_path = self.rd.cargo_target_dir() / cargo_profile / bin
808 copy(src_path, bin)
809 for example in self.examples:
810 src_path = (
811 self.rd.cargo_target_dir() / cargo_profile / Path("examples") / example
812 )
813 copy(src_path, Path("examples") / example)
814
815 if self.extract:
816 cargo_build_json_output = build_output["cargo"]
817
818 target_dir = self.rd.cargo_target_dir()
819 for line in cargo_build_json_output.split("\n"):
820 if line.strip() == "" or not line.startswith("{"):
821 continue
822 message = json.loads(line)

Callers 4

runMethod · 0.95
acquireMethod · 0.45
build_depMethod · 0.45

Calls 6

copyFunction · 0.85
cargo_target_dirMethod · 0.80
splitMethod · 0.45
itemsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected