From 71962cee77f28f16611be17a518ffc9e6bbe7860 Mon Sep 17 00:00:00 2001 From: Alberto Sartori Date: Tue, 23 Jul 2024 11:47:59 +0200 Subject: rules-rust: just-import-cargo: allow for '{}' as a valid repos.json template... ...to simplify the transition of a Rust-only Cargo-based project. --- bin/just-import-cargo.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/just-import-cargo.py b/bin/just-import-cargo.py index 9eb0d0a..ad22478 100755 --- a/bin/just-import-cargo.py +++ b/bin/just-import-cargo.py @@ -652,6 +652,16 @@ def main(): ) parse_metadata(metadata, tree_out) + # if the provided repos.template.json does not contain a "main" let's assume it is the current project + # this should be useful only when transitioning a Rust-only Cargo-based project + if "main" not in base_config: + base_config["main"] = root_name + if "repositories" not in base_config: + base_config["repositories"] = {} + + # let's sort to have "main" at the beginning of repos.json + base_config = {k: v for k, v in sorted(base_config.items())} + if compute_index: index = sorted(repos_json.keys()) repos_json["index"] = { -- cgit v1.2.3