dump crate licenses as part of update run

This commit is contained in:
Damien Elmes 2020-11-12 17:41:47 +10:00
parent 1b3922d6a5
commit 835c29f8ca
3 changed files with 2449 additions and 0 deletions

View File

@ -452,3 +452,5 @@ alias(
"manual",
],
)
exports_files(["licenses.json"])

2432
cargo/licenses.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -68,8 +68,23 @@ input("hit enter to proceed")
if os.path.exists("remote"):
shutil.rmtree("remote")
subprocess.run(["cargo-raze"], check=True)
# dump licenses
result = subprocess.check_output(["cargo", "license", "-j"])
with open("licenses.json", "wb") as file:
file.write(result)
os.remove("Cargo.toml")
# export license file
with open("BUILD.bazel", "a", encoding="utf8") as file:
file.write(
"""
exports_files(["licenses.json"])
"""
)
# update shallow-since references for git crates
output_lines = []
commit_re = re.compile('\s+commit = "([0-9a-f]+)",')
with open("crates.bzl") as file: