Skip to content

Commit

Permalink
Get rid of BUILD.in generation (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
goffrie authored Dec 7, 2023
1 parent 25e97ca commit 977bcdb
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions pb-jelly-gen/codegen/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 977bcdb

Please sign in to comment.