From 977bcdbfb3bca77aacd98dfd0fbb86c10dc14607 Mon Sep 17 00:00:00 2001 From: Geoffry Song Date: Thu, 7 Dec 2023 09:08:10 -0800 Subject: [PATCH] Get rid of BUILD.in generation (#156) --- pb-jelly-gen/codegen/codegen.py | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/pb-jelly-gen/codegen/codegen.py b/pb-jelly-gen/codegen/codegen.py index 095b8ea..c955675 100755 --- a/pb-jelly-gen/codegen/codegen.py +++ b/pb-jelly-gen/codegen/codegen.py @@ -1836,11 +1836,6 @@ def mod_tree_dfs( content = RS_HEADER + LIB_RS_HEADER + librs.content.getvalue() yield filename, content - def get_build_file(self) -> Iterator[Tuple[Text, Text]]: - for crate in self.deps_map: - build_file = BUILD_TEMPLATE.format(crate=crate) - yield crate, build_file - def get_spec_toml_file( self, derive_serde: bool, include_sso: bool ) -> Iterator[Tuple[Text, Text]]: @@ -1928,23 +1923,6 @@ def crate_from_proto_filename( return crate_name, mod_parts[1:] -BUILD_TEMPLATE = """ -package(default_visibility = ["//visibility:public"]) - -rust_library( - name = "{crate}", - crate_type = "lib", - edition = "2018", -) - - -rust_doc( - name = "{crate}_doc", - crate = ":{crate}", - edition = "2018", -) -""" - SPEC_TOML_TEMPLATE = ( """# @""" + """generated, do not edit @@ -2079,10 +2057,11 @@ def add_mod(writer: CodeWriter) -> None: output.content = content if "generate_build_files" in request.parameter: - for crate, build_file in ctx.get_build_file(): + for crate in ctx.deps_map: + # Create a stub file for later generation output = response.file.add() output.name = file_prefix + crate + "/BUILD.in-gen-proto~" - output.content = build_file + output.content = "" elif "generate_spec_toml" in request.parameter: for crate, spec_toml_file in ctx.get_spec_toml_file(derive_serde, include_sso): output = response.file.add()