summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2024-07-23 11:47:59 +0200
committerAlberto Sartori <alberto.sartori@huawei.com>2024-07-31 16:21:15 +0200
commit71962cee77f28f16611be17a518ffc9e6bbe7860 (patch)
tree0995c04e9b546490ac89e50f184a33551aee6d13
parent132dadc0f34d3cdf0dc2a63bd7644af6d91d67ec (diff)
downloadrules-rust-71962cee77f28f16611be17a518ffc9e6bbe7860.tar.gz
rules-rust: just-import-cargo: allow for '{}' as a valid repos.json template...
...to simplify the transition of a Rust-only Cargo-based project.
-rwxr-xr-xbin/just-import-cargo.py10
1 files changed, 10 insertions, 0 deletions
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"] = {