mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-21 15:10:27 +00:00
codegen: Clean up rust crate handling
This commit is contained in:
15
main.sh
15
main.sh
@@ -152,6 +152,7 @@ read_manifest() {
|
|||||||
local tool="$1"
|
local tool="$1"
|
||||||
local version="$2"
|
local version="$2"
|
||||||
local manifest
|
local manifest
|
||||||
|
rust_crate=$(jq -r ".rust_crate" "${manifest_dir}/${tool}.json")
|
||||||
manifest=$(jq -r ".\"${version}\"" "${manifest_dir}/${tool}.json")
|
manifest=$(jq -r ".\"${version}\"" "${manifest_dir}/${tool}.json")
|
||||||
if [[ "${manifest}" == "null" ]]; then
|
if [[ "${manifest}" == "null" ]]; then
|
||||||
download_info="null"
|
download_info="null"
|
||||||
@@ -220,15 +221,14 @@ read_download_info() {
|
|||||||
template=$(jq -r ".template.${host_platform}" "${manifest_dir}/${tool}.json")
|
template=$(jq -r ".template.${host_platform}" "${manifest_dir}/${tool}.json")
|
||||||
url=$(jq <<<"${template}" -r '.url')
|
url=$(jq <<<"${template}" -r '.url')
|
||||||
url="${url//\$\{version\}/${exact_version}}"
|
url="${url//\$\{version\}/${exact_version}}"
|
||||||
bin_dir=$(jq <<<"${template}" -r '.bin_dir')
|
|
||||||
bin_dir="${bin_dir//\$\{version\}/${exact_version}}"
|
|
||||||
bin_in_archive=$(jq <<<"${template}" -r '.bin')
|
bin_in_archive=$(jq <<<"${template}" -r '.bin')
|
||||||
bin_in_archive="${bin_in_archive//\$\{version\}/${exact_version}}"
|
bin_in_archive="${bin_in_archive//\$\{version\}/${exact_version}}"
|
||||||
else
|
else
|
||||||
bin_dir=$(jq <<<"${download_info}" -r '.bin_dir')
|
|
||||||
bin_in_archive=$(jq <<<"${download_info}" -r '.bin')
|
bin_in_archive=$(jq <<<"${download_info}" -r '.bin')
|
||||||
fi
|
fi
|
||||||
if [[ "${bin_dir}" == "null" ]]; then
|
if [[ "${rust_crate}" == "null" ]]; then
|
||||||
|
bin_dir="/usr/local/bin"
|
||||||
|
else
|
||||||
bin_dir="${cargo_bin}"
|
bin_dir="${cargo_bin}"
|
||||||
fi
|
fi
|
||||||
if [[ "${bin_in_archive}" == "null" ]]; then
|
if [[ "${bin_in_archive}" == "null" ]]; then
|
||||||
@@ -563,10 +563,13 @@ for tool in "${tools[@]}"; do
|
|||||||
# Use cargo-binstall fallback if tool is available but the specified version not available.
|
# Use cargo-binstall fallback if tool is available but the specified version not available.
|
||||||
read_manifest "${tool}" "${version}"
|
read_manifest "${tool}" "${version}"
|
||||||
if [[ "${download_info}" == "null" ]]; then
|
if [[ "${download_info}" == "null" ]]; then
|
||||||
|
if [[ "${rust_crate}" == "null" ]]; then
|
||||||
|
bail "${tool}@${version} for '${host_os}' is not supported"
|
||||||
|
fi
|
||||||
warn "${tool}@${version} for '${host_os}' is not supported; fallback to cargo-binstall"
|
warn "${tool}@${version} for '${host_os}' is not supported; fallback to cargo-binstall"
|
||||||
case "${version}" in
|
case "${version}" in
|
||||||
latest) unsupported_tools+=("${tool}") ;;
|
latest) unsupported_tools+=("${rust_crate}") ;;
|
||||||
*) unsupported_tools+=("${tool}@${version}") ;;
|
*) unsupported_tools+=("${rust_crate}@${version}") ;;
|
||||||
esac
|
esac
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|||||||
1
manifests/cargo-binstall.json
generated
1
manifests/cargo-binstall.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-binstall",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/cargo-bins/cargo-binstall/releases/download/v${version}/cargo-binstall-x86_64-unknown-linux-musl.tgz"
|
"url": "https://github.com/cargo-bins/cargo-binstall/releases/download/v${version}/cargo-binstall-x86_64-unknown-linux-musl.tgz"
|
||||||
|
|||||||
1
manifests/cargo-careful.json
generated
1
manifests/cargo-careful.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-careful",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/RalfJung/cargo-careful/releases/download/v${version}/cargo-careful.x86_64-unknown-linux-musl"
|
"url": "https://github.com/RalfJung/cargo-careful/releases/download/v${version}/cargo-careful.x86_64-unknown-linux-musl"
|
||||||
|
|||||||
1
manifests/cargo-deny.json
generated
1
manifests/cargo-deny.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-deny",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/EmbarkStudios/cargo-deny/releases/download/${version}/cargo-deny-${version}-x86_64-unknown-linux-musl.tar.gz",
|
"url": "https://github.com/EmbarkStudios/cargo-deny/releases/download/${version}/cargo-deny-${version}-x86_64-unknown-linux-musl.tar.gz",
|
||||||
|
|||||||
1
manifests/cargo-dinghy.json
generated
1
manifests/cargo-dinghy.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-dinghy",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/sonos/dinghy/releases/download/${version}/cargo-dinghy-linux-${version}.tgz",
|
"url": "https://github.com/sonos/dinghy/releases/download/${version}/cargo-dinghy-linux-${version}.tgz",
|
||||||
|
|||||||
1
manifests/cargo-hack.json
generated
1
manifests/cargo-hack.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-hack",
|
||||||
"template": null,
|
"template": null,
|
||||||
"latest": {
|
"latest": {
|
||||||
"version": "0.5.28"
|
"version": "0.5.28"
|
||||||
|
|||||||
1
manifests/cargo-llvm-cov.json
generated
1
manifests/cargo-llvm-cov.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-llvm-cov",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/taiki-e/cargo-llvm-cov/releases/download/v${version}/cargo-llvm-cov-x86_64-unknown-linux-musl.tar.gz"
|
"url": "https://github.com/taiki-e/cargo-llvm-cov/releases/download/v${version}/cargo-llvm-cov-x86_64-unknown-linux-musl.tar.gz"
|
||||||
|
|||||||
1
manifests/cargo-make.json
generated
1
manifests/cargo-make.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-make",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/sagiegurari/cargo-make/releases/download/${version}/cargo-make-v${version}-x86_64-unknown-linux-musl.zip",
|
"url": "https://github.com/sagiegurari/cargo-make/releases/download/${version}/cargo-make-v${version}-x86_64-unknown-linux-musl.zip",
|
||||||
|
|||||||
1
manifests/cargo-minimal-versions.json
generated
1
manifests/cargo-minimal-versions.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-minimal-versions",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/taiki-e/cargo-minimal-versions/releases/download/v${version}/cargo-minimal-versions-x86_64-unknown-linux-musl.tar.gz"
|
"url": "https://github.com/taiki-e/cargo-minimal-versions/releases/download/v${version}/cargo-minimal-versions-x86_64-unknown-linux-musl.tar.gz"
|
||||||
|
|||||||
1
manifests/cargo-nextest.json
generated
1
manifests/cargo-nextest.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-nextest",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-${version}/cargo-nextest-${version}-x86_64-unknown-linux-gnu.tar.gz"
|
"url": "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-${version}/cargo-nextest-${version}-x86_64-unknown-linux-gnu.tar.gz"
|
||||||
|
|||||||
1
manifests/cargo-no-dev-deps.json
generated
1
manifests/cargo-no-dev-deps.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-no-dev-deps",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/taiki-e/cargo-no-dev-deps/releases/download/v${version}/cargo-no-dev-deps-x86_64-unknown-linux-musl.tar.gz"
|
"url": "https://github.com/taiki-e/cargo-no-dev-deps/releases/download/v${version}/cargo-no-dev-deps-x86_64-unknown-linux-musl.tar.gz"
|
||||||
|
|||||||
1
manifests/cargo-tarpaulin.json
generated
1
manifests/cargo-tarpaulin.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-tarpaulin",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/xd009642/tarpaulin/releases/download/${version}/cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz"
|
"url": "https://github.com/xd009642/tarpaulin/releases/download/${version}/cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz"
|
||||||
|
|||||||
1
manifests/cargo-udeps.json
generated
1
manifests/cargo-udeps.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-udeps",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/est31/cargo-udeps/releases/download/v${version}/cargo-udeps-v${version}-x86_64-unknown-linux-gnu.tar.gz",
|
"url": "https://github.com/est31/cargo-udeps/releases/download/v${version}/cargo-udeps-v${version}-x86_64-unknown-linux-gnu.tar.gz",
|
||||||
|
|||||||
1
manifests/cargo-valgrind.json
generated
1
manifests/cargo-valgrind.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cargo-valgrind",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/jfrimmel/cargo-valgrind/releases/download/v${version}/cargo-valgrind-${version}-x86_64-unknown-linux-musl.tar.gz"
|
"url": "https://github.com/jfrimmel/cargo-valgrind/releases/download/v${version}/cargo-valgrind-${version}-x86_64-unknown-linux-musl.tar.gz"
|
||||||
|
|||||||
1
manifests/cross.json
generated
1
manifests/cross.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "cross",
|
||||||
"template": null,
|
"template": null,
|
||||||
"latest": {
|
"latest": {
|
||||||
"version": "0.2.5"
|
"version": "0.2.5"
|
||||||
|
|||||||
1
manifests/dprint.json
generated
1
manifests/dprint.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "dprint",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/dprint/dprint/releases/download/${version}/dprint-x86_64-unknown-linux-gnu.zip"
|
"url": "https://github.com/dprint/dprint/releases/download/${version}/dprint-x86_64-unknown-linux-gnu.zip"
|
||||||
|
|||||||
1
manifests/grcov.json
generated
1
manifests/grcov.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "grcov",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/mozilla/grcov/releases/download/v${version}/grcov-x86_64-unknown-linux-musl.tar.bz2"
|
"url": "https://github.com/mozilla/grcov/releases/download/v${version}/grcov-x86_64-unknown-linux-musl.tar.bz2"
|
||||||
|
|||||||
1
manifests/just.json
generated
1
manifests/just.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "just",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/casey/just/releases/download/${version}/just-${version}-x86_64-unknown-linux-musl.tar.gz"
|
"url": "https://github.com/casey/just/releases/download/${version}/just-${version}-x86_64-unknown-linux-musl.tar.gz"
|
||||||
|
|||||||
1
manifests/mdbook-linkcheck.json
generated
1
manifests/mdbook-linkcheck.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "mdbook-linkcheck",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v${version}/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip"
|
"url": "https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v${version}/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip"
|
||||||
|
|||||||
1
manifests/mdbook.json
generated
1
manifests/mdbook.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "mdbook",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/rust-lang/mdBook/releases/download/v${version}/mdbook-v${version}-x86_64-unknown-linux-gnu.tar.gz"
|
"url": "https://github.com/rust-lang/mdBook/releases/download/v${version}/mdbook-v${version}-x86_64-unknown-linux-gnu.tar.gz"
|
||||||
|
|||||||
1
manifests/parse-changelog.json
generated
1
manifests/parse-changelog.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "parse-changelog",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/taiki-e/parse-changelog/releases/download/v${version}/parse-changelog-x86_64-unknown-linux-gnu.tar.gz"
|
"url": "https://github.com/taiki-e/parse-changelog/releases/download/v${version}/parse-changelog-x86_64-unknown-linux-gnu.tar.gz"
|
||||||
|
|||||||
1
manifests/protoc.json
generated
1
manifests/protoc.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": null,
|
||||||
"template": null,
|
"template": null,
|
||||||
"latest": {
|
"latest": {
|
||||||
"version": "3.23.4"
|
"version": "3.23.4"
|
||||||
|
|||||||
5
manifests/shellcheck.json
generated
5
manifests/shellcheck.json
generated
@@ -1,23 +1,20 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": null,
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.linux.x86_64.tar.xz",
|
"url": "https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.linux.x86_64.tar.xz",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "shellcheck-v${version}/shellcheck"
|
"bin": "shellcheck-v${version}/shellcheck"
|
||||||
},
|
},
|
||||||
"x86_64_macos": {
|
"x86_64_macos": {
|
||||||
"url": "https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.darwin.x86_64.tar.xz",
|
"url": "https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.darwin.x86_64.tar.xz",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "shellcheck-v${version}/shellcheck"
|
"bin": "shellcheck-v${version}/shellcheck"
|
||||||
},
|
},
|
||||||
"x86_64_windows": {
|
"x86_64_windows": {
|
||||||
"url": "https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.zip",
|
"url": "https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.zip",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "shellcheck.exe"
|
"bin": "shellcheck.exe"
|
||||||
},
|
},
|
||||||
"aarch64_linux_gnu": {
|
"aarch64_linux_gnu": {
|
||||||
"url": "https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.linux.aarch64.tar.xz",
|
"url": "https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.linux.aarch64.tar.xz",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "shellcheck-v${version}/shellcheck"
|
"bin": "shellcheck-v${version}/shellcheck"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
16
manifests/shfmt.json
generated
16
manifests/shfmt.json
generated
@@ -1,24 +1,20 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": null,
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_linux_amd64",
|
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_linux_amd64"
|
||||||
"bin_dir": "/usr/local/bin"
|
|
||||||
},
|
},
|
||||||
"x86_64_macos": {
|
"x86_64_macos": {
|
||||||
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_darwin_amd64",
|
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_darwin_amd64"
|
||||||
"bin_dir": "/usr/local/bin"
|
|
||||||
},
|
},
|
||||||
"x86_64_windows": {
|
"x86_64_windows": {
|
||||||
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_windows_amd64.exe",
|
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_windows_amd64.exe"
|
||||||
"bin_dir": "/usr/local/bin"
|
|
||||||
},
|
},
|
||||||
"aarch64_linux_gnu": {
|
"aarch64_linux_gnu": {
|
||||||
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_linux_arm64",
|
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_linux_arm64"
|
||||||
"bin_dir": "/usr/local/bin"
|
|
||||||
},
|
},
|
||||||
"aarch64_macos": {
|
"aarch64_macos": {
|
||||||
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_darwin_arm64",
|
"url": "https://github.com/mvdan/sh/releases/download/v${version}/shfmt_v${version}_darwin_arm64"
|
||||||
"bin_dir": "/usr/local/bin"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"latest": {
|
"latest": {
|
||||||
|
|||||||
6
manifests/syft.json
generated
6
manifests/syft.json
generated
@@ -1,28 +1,24 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": null,
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_linux_amd64.tar.gz",
|
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_linux_amd64.tar.gz",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "syft"
|
"bin": "syft"
|
||||||
},
|
},
|
||||||
"x86_64_macos": {
|
"x86_64_macos": {
|
||||||
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_darwin_amd64.tar.gz",
|
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_darwin_amd64.tar.gz",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "syft"
|
"bin": "syft"
|
||||||
},
|
},
|
||||||
"x86_64_windows": {
|
"x86_64_windows": {
|
||||||
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_windows_amd64.zip",
|
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_windows_amd64.zip",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "syft.exe"
|
"bin": "syft.exe"
|
||||||
},
|
},
|
||||||
"aarch64_linux_musl": {
|
"aarch64_linux_musl": {
|
||||||
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_linux_arm64.tar.gz",
|
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_linux_arm64.tar.gz",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "syft"
|
"bin": "syft"
|
||||||
},
|
},
|
||||||
"aarch64_macos": {
|
"aarch64_macos": {
|
||||||
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_darwin_arm64.tar.gz",
|
"url": "https://github.com/anchore/syft/releases/download/v${version}/syft_${version}_darwin_arm64.tar.gz",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "syft"
|
"bin": "syft"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
1
manifests/wasm-pack.json
generated
1
manifests/wasm-pack.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "wasm-pack",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_musl": {
|
"x86_64_linux_musl": {
|
||||||
"url": "https://github.com/rustwasm/wasm-pack/releases/download/v${version}/wasm-pack-v${version}-x86_64-unknown-linux-musl.tar.gz",
|
"url": "https://github.com/rustwasm/wasm-pack/releases/download/v${version}/wasm-pack-v${version}-x86_64-unknown-linux-musl.tar.gz",
|
||||||
|
|||||||
1
manifests/wasmtime.json
generated
1
manifests/wasmtime.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "wasmtime-cli",
|
||||||
"template": null,
|
"template": null,
|
||||||
"latest": {
|
"latest": {
|
||||||
"version": "11.0.1"
|
"version": "11.0.1"
|
||||||
|
|||||||
1
manifests/zola.json
generated
1
manifests/zola.json
generated
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"rust_crate": "zola",
|
||||||
"template": {
|
"template": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"url": "https://github.com/getzola/zola/releases/download/v${version}/zola-v${version}-x86_64-unknown-linux-gnu.tar.gz"
|
"url": "https://github.com/getzola/zola/releases/download/v${version}/zola-v${version}-x86_64-unknown-linux-gnu.tar.gz"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/cargo-bins/cargo-binstall",
|
"repository": "https://github.com/cargo-bins/cargo-binstall",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${rust_target}.tgz",
|
"asset_name": "${package}-${rust_target}.tgz",
|
||||||
"version_range": "latest",
|
"version_range": "latest",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/RalfJung/cargo-careful",
|
"repository": "https://github.com/RalfJung/cargo-careful",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}.${rust_target}",
|
"asset_name": "${package}.${rust_target}",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_musl": {},
|
"x86_64_linux_musl": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/EmbarkStudios/cargo-deny",
|
"repository": "https://github.com/EmbarkStudios/cargo-deny",
|
||||||
"tag_prefix": "",
|
"tag_prefix": "",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${version}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${version}-${rust_target}.tar.gz",
|
||||||
"bin": "${package}-${version}-${rust_target}/${package}${exe}",
|
"bin": "${package}-${version}-${rust_target}/${package}${exe}",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/sonos/dinghy",
|
"repository": "https://github.com/sonos/dinghy",
|
||||||
"tag_prefix": "",
|
"tag_prefix": "",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${os_name}-${version}.tgz",
|
"asset_name": "${package}-${os_name}-${version}.tgz",
|
||||||
"bin": "${package}-${version}/${package}${exe}",
|
"bin": "${package}-${version}/${package}${exe}",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/taiki-e/cargo-hack",
|
"repository": "https://github.com/taiki-e/cargo-hack",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": [
|
"asset_name": [
|
||||||
"${package}-${rust_target}.tar.gz",
|
"${package}-${rust_target}.tar.gz",
|
||||||
"${package}-v${version}-${rust_target}.tar.gz"
|
"${package}-v${version}-${rust_target}.tar.gz"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/taiki-e/cargo-llvm-cov",
|
"repository": "https://github.com/taiki-e/cargo-llvm-cov",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_musl": {},
|
"x86_64_linux_musl": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/sagiegurari/cargo-make",
|
"repository": "https://github.com/sagiegurari/cargo-make",
|
||||||
"tag_prefix": "",
|
"tag_prefix": "",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-v${version}-${rust_target}.zip",
|
"asset_name": "${package}-v${version}-${rust_target}.zip",
|
||||||
"bin": "${package}-v${version}-${rust_target}/${package}${exe}",
|
"bin": "${package}-v${version}-${rust_target}/${package}${exe}",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/taiki-e/cargo-minimal-versions",
|
"repository": "https://github.com/taiki-e/cargo-minimal-versions",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_musl": {},
|
"x86_64_linux_musl": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/nextest-rs/nextest",
|
"repository": "https://github.com/nextest-rs/nextest",
|
||||||
"tag_prefix": "cargo-nextest-",
|
"tag_prefix": "cargo-nextest-",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${version}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${version}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_gnu": {},
|
"x86_64_linux_gnu": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/taiki-e/cargo-no-dev-deps",
|
"repository": "https://github.com/taiki-e/cargo-no-dev-deps",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_musl": {},
|
"x86_64_linux_musl": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/xd009642/tarpaulin",
|
"repository": "https://github.com/xd009642/tarpaulin",
|
||||||
"tag_prefix": "",
|
"tag_prefix": "",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${rust_target}.tar.gz",
|
||||||
"version_range": "> 0.22.0",
|
"version_range": "> 0.22.0",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/est31/cargo-udeps",
|
"repository": "https://github.com/est31/cargo-udeps",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
|
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
|
||||||
"bin": "./${package}-v${version}-${rust_target}/${package}${exe}",
|
"bin": "./${package}-v${version}-${rust_target}/${package}${exe}",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/jfrimmel/cargo-valgrind",
|
"repository": "https://github.com/jfrimmel/cargo-valgrind",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${version}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${version}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_musl": {},
|
"x86_64_linux_musl": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/cross-rs/cross",
|
"repository": "https://github.com/cross-rs/cross",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": [
|
"asset_name": [
|
||||||
"${package}-${rust_target}.tar.gz",
|
"${package}-${rust_target}.tar.gz",
|
||||||
"${package}-v${version}-${rust_target}.tar.gz"
|
"${package}-v${version}-${rust_target}.tar.gz"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/dprint/dprint",
|
"repository": "https://github.com/dprint/dprint",
|
||||||
"tag_prefix": "",
|
"tag_prefix": "",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${rust_target}.zip",
|
"asset_name": "${package}-${rust_target}.zip",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_gnu": {},
|
"x86_64_linux_gnu": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/mozilla/grcov",
|
"repository": "https://github.com/mozilla/grcov",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${rust_target}.tar.bz2",
|
"asset_name": "${package}-${rust_target}.tar.bz2",
|
||||||
"version_range": ">= 0.8.7",
|
"version_range": ">= 0.8.7",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/casey/just",
|
"repository": "https://github.com/casey/just",
|
||||||
"tag_prefix": "",
|
"tag_prefix": "",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${version}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${version}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_musl": {},
|
"x86_64_linux_musl": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/Michael-F-Bryan/mdbook-linkcheck",
|
"repository": "https://github.com/Michael-F-Bryan/mdbook-linkcheck",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}.${rust_target}.zip",
|
"asset_name": "${package}.${rust_target}.zip",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_gnu": {},
|
"x86_64_linux_gnu": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/rust-lang/mdBook",
|
"repository": "https://github.com/rust-lang/mdBook",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
|
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_musl": {},
|
"x86_64_linux_musl": {},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/taiki-e/parse-changelog",
|
"repository": "https://github.com/taiki-e/parse-changelog",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-${rust_target}.tar.gz",
|
"asset_name": "${package}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_gnu": {},
|
"x86_64_linux_gnu": {},
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/koalaman/shellcheck",
|
"repository": "https://github.com/koalaman/shellcheck",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "${package}-v${version}/${package}${exe}",
|
"bin": "${package}-v${version}/${package}${exe}",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/mvdan/sh",
|
"repository": "https://github.com/mvdan/sh",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"asset_name": "${package}_v${version}_linux_amd64"
|
"asset_name": "${package}_v${version}_linux_amd64"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/anchore/syft",
|
"repository": "https://github.com/anchore/syft",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
"bin_dir": "/usr/local/bin",
|
|
||||||
"bin": "${package}${exe}",
|
"bin": "${package}${exe}",
|
||||||
"version_range": ">= 0.83.0",
|
"version_range": ">= 0.83.0",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/rustwasm/wasm-pack",
|
"repository": "https://github.com/rustwasm/wasm-pack",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
|
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
|
||||||
"bin": "${package}-v${version}-${rust_target}/${package}${exe}",
|
"bin": "${package}-v${version}-${rust_target}/${package}${exe}",
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/bytecodealliance/wasmtime",
|
"repository": "https://github.com/bytecodealliance/wasmtime",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "wasmtime-cli",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_gnu": {
|
"x86_64_linux_gnu": {
|
||||||
"asset_name": "${package}-v${version}-x86_64-linux.tar.xz",
|
"asset_name": "${package}-v${version}-x86_64-linux.tar.xz",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repository": "https://github.com/getzola/zola",
|
"repository": "https://github.com/getzola/zola",
|
||||||
"tag_prefix": "v",
|
"tag_prefix": "v",
|
||||||
|
"rust_crate": "${package}",
|
||||||
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
|
"asset_name": "${package}-v${version}-${rust_target}.tar.gz",
|
||||||
"platform": {
|
"platform": {
|
||||||
"x86_64_linux_gnu": {},
|
"x86_64_linux_gnu": {},
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ fn main() -> Result<()> {
|
|||||||
fs::create_dir_all(manifest_path.parent().unwrap())?;
|
fs::create_dir_all(manifest_path.parent().unwrap())?;
|
||||||
fs::create_dir_all(download_cache_dir)?;
|
fs::create_dir_all(download_cache_dir)?;
|
||||||
|
|
||||||
let base_info: BaseManifest = serde_json::from_slice(&fs::read(
|
let mut base_info: BaseManifest = serde_json::from_slice(&fs::read(
|
||||||
workspace_root
|
workspace_root
|
||||||
.join("tools/codegen/base")
|
.join("tools/codegen/base")
|
||||||
.join(format!("{package}.json")),
|
.join(format!("{package}.json")),
|
||||||
@@ -75,10 +75,15 @@ fn main() -> Result<()> {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut crates_io_info = None;
|
let mut crates_io_info = None;
|
||||||
if base_info.bin_dir.is_none() {
|
base_info.rust_crate = base_info
|
||||||
eprintln!("downloading crate info from https://crates.io/api/v1/crates/{package}");
|
.rust_crate
|
||||||
|
.as_ref()
|
||||||
|
.map(|s| replace_vars(s, package, None, None))
|
||||||
|
.transpose()?;
|
||||||
|
if let Some(crate_name) = &base_info.rust_crate {
|
||||||
|
eprintln!("downloading crate info from https://crates.io/api/v1/crates/{crate_name}");
|
||||||
crates_io_info = Some(
|
crates_io_info = Some(
|
||||||
download(&format!("https://crates.io/api/v1/crates/{package}"))?
|
download(&format!("https://crates.io/api/v1/crates/{crate_name}"))?
|
||||||
.into_json::<crates_io::Crate>()?,
|
.into_json::<crates_io::Crate>()?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -106,10 +111,6 @@ fn main() -> Result<()> {
|
|||||||
for (platform, d) in &mut manifest.download_info {
|
for (platform, d) in &mut manifest.download_info {
|
||||||
let template = &template.download_info[platform];
|
let template = &template.download_info[platform];
|
||||||
d.url = Some(template.url.replace("${version}", version));
|
d.url = Some(template.url.replace("${version}", version));
|
||||||
d.bin_dir = template
|
|
||||||
.bin_dir
|
|
||||||
.as_ref()
|
|
||||||
.map(|s| s.replace("${version}", version));
|
|
||||||
d.bin = template
|
d.bin = template
|
||||||
.bin
|
.bin
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@@ -186,7 +187,7 @@ fn main() -> Result<()> {
|
|||||||
.with_context(|| format!("asset_name is needed for {package} on {platform:?}"))?
|
.with_context(|| format!("asset_name is needed for {package} on {platform:?}"))?
|
||||||
.as_slice()
|
.as_slice()
|
||||||
.iter()
|
.iter()
|
||||||
.map(|asset_name| replace_vars(asset_name, package, version, platform))
|
.map(|asset_name| replace_vars(asset_name, package, Some(version), Some(platform)))
|
||||||
.collect::<Result<Vec<_>>>()?;
|
.collect::<Result<Vec<_>>>()?;
|
||||||
let (url, asset_name) = match asset_names.iter().find_map(|asset_name| {
|
let (url, asset_name) = match asset_names.iter().find_map(|asset_name| {
|
||||||
release
|
release
|
||||||
@@ -227,16 +228,11 @@ fn main() -> Result<()> {
|
|||||||
ManifestDownloadInfo {
|
ManifestDownloadInfo {
|
||||||
url: Some(url),
|
url: Some(url),
|
||||||
checksum: hash,
|
checksum: hash,
|
||||||
bin_dir: base_download_info
|
|
||||||
.bin_dir
|
|
||||||
.as_ref()
|
|
||||||
.or(base_info.bin_dir.as_ref())
|
|
||||||
.cloned(),
|
|
||||||
bin: base_download_info
|
bin: base_download_info
|
||||||
.bin
|
.bin
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.or(base_info.bin.as_ref())
|
.or(base_info.bin.as_ref())
|
||||||
.map(|s| replace_vars(s, package, version, platform))
|
.map(|s| replace_vars(s, package, Some(version), Some(platform)))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -369,10 +365,9 @@ fn main() -> Result<()> {
|
|||||||
let t = template.as_mut().unwrap();
|
let t = template.as_mut().unwrap();
|
||||||
for (platform, d) in &mut manifest.download_info {
|
for (platform, d) in &mut manifest.download_info {
|
||||||
let template_url = d.url.take().unwrap().replace(version, "${version}");
|
let template_url = d.url.take().unwrap().replace(version, "${version}");
|
||||||
let template_bin_dir = d.bin_dir.take().map(|s| s.replace(version, "${version}"));
|
|
||||||
let template_bin = d.bin.take().map(|s| s.replace(version, "${version}"));
|
let template_bin = d.bin.take().map(|s| s.replace(version, "${version}"));
|
||||||
if let Some(d) = t.download_info.get(platform) {
|
if let Some(d) = t.download_info.get(platform) {
|
||||||
if template_url != d.url || template_bin_dir != d.bin_dir || template_bin != d.bin {
|
if template_url != d.url || template_bin != d.bin {
|
||||||
template = None;
|
template = None;
|
||||||
break 'outer;
|
break 'outer;
|
||||||
}
|
}
|
||||||
@@ -381,7 +376,6 @@ fn main() -> Result<()> {
|
|||||||
*platform,
|
*platform,
|
||||||
ManifestTemplateDownloadInfo {
|
ManifestTemplateDownloadInfo {
|
||||||
url: template_url,
|
url: template_url,
|
||||||
bin_dir: template_bin_dir,
|
|
||||||
bin: template_bin,
|
bin: template_bin,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -394,6 +388,8 @@ fn main() -> Result<()> {
|
|||||||
manifests.template = template;
|
manifests.template = template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
manifests.rust_crate = base_info.rust_crate;
|
||||||
|
|
||||||
let mut buf = serde_json::to_vec_pretty(&manifests)?;
|
let mut buf = serde_json::to_vec_pretty(&manifests)?;
|
||||||
buf.push(b'\n');
|
buf.push(b'\n');
|
||||||
fs::write(manifest_path, buf)?;
|
fs::write(manifest_path, buf)?;
|
||||||
@@ -408,14 +404,22 @@ fn workspace_root() -> PathBuf {
|
|||||||
dir
|
dir
|
||||||
}
|
}
|
||||||
|
|
||||||
fn replace_vars(s: &str, package: &str, version: &str, platform: HostPlatform) -> Result<String> {
|
fn replace_vars(
|
||||||
let s = s
|
s: &str,
|
||||||
.replace("${package}", package)
|
package: &str,
|
||||||
.replace("${tool}", package)
|
version: Option<&str>,
|
||||||
|
platform: Option<HostPlatform>,
|
||||||
|
) -> Result<String> {
|
||||||
|
let mut s = s.replace("${package}", package).replace("${tool}", package);
|
||||||
|
if let Some(platform) = platform {
|
||||||
|
s = s
|
||||||
.replace("${rust_target}", platform.rust_target())
|
.replace("${rust_target}", platform.rust_target())
|
||||||
.replace("${os_name}", platform.os_name())
|
.replace("${os_name}", platform.os_name())
|
||||||
.replace("${version}", version)
|
|
||||||
.replace("${exe}", platform.exe_suffix());
|
.replace("${exe}", platform.exe_suffix());
|
||||||
|
}
|
||||||
|
if let Some(version) = version {
|
||||||
|
s = s.replace("${version}", version);
|
||||||
|
}
|
||||||
if s.contains('$') {
|
if s.contains('$') {
|
||||||
bail!("variable not fully replaced: '{s}'");
|
bail!("variable not fully replaced: '{s}'");
|
||||||
}
|
}
|
||||||
@@ -587,6 +591,7 @@ impl<'de> Deserialize<'de> for Version {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||||
struct Manifests {
|
struct Manifests {
|
||||||
|
rust_crate: Option<String>,
|
||||||
template: Option<ManifestTemplate>,
|
template: Option<ManifestTemplate>,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
map: BTreeMap<Reverse<Version>, ManifestRef>,
|
map: BTreeMap<Reverse<Version>, ManifestRef>,
|
||||||
@@ -610,9 +615,6 @@ struct ManifestDownloadInfo {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
url: Option<String>,
|
url: Option<String>,
|
||||||
checksum: String,
|
checksum: String,
|
||||||
/// Default to ${cargo_bin}
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
bin_dir: Option<String>,
|
|
||||||
/// Default to ${tool}${exe}
|
/// Default to ${tool}${exe}
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
bin: Option<String>,
|
bin: Option<String>,
|
||||||
@@ -627,9 +629,6 @@ struct ManifestTemplate {
|
|||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
struct ManifestTemplateDownloadInfo {
|
struct ManifestTemplateDownloadInfo {
|
||||||
url: String,
|
url: String,
|
||||||
/// Default to ${cargo_bin}
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
bin_dir: Option<String>,
|
|
||||||
/// Default to ${tool}${exe}
|
/// Default to ${tool}${exe}
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
bin: Option<String>,
|
bin: Option<String>,
|
||||||
@@ -642,11 +641,11 @@ struct BaseManifest {
|
|||||||
repository: String,
|
repository: String,
|
||||||
/// Prefix of release tag.
|
/// Prefix of release tag.
|
||||||
tag_prefix: String,
|
tag_prefix: String,
|
||||||
|
/// Crate name, if this is Rust crate.
|
||||||
|
rust_crate: Option<String>,
|
||||||
default_major_version: Option<String>,
|
default_major_version: Option<String>,
|
||||||
/// Asset name patterns.
|
/// Asset name patterns.
|
||||||
asset_name: Option<StringOrArray>,
|
asset_name: Option<StringOrArray>,
|
||||||
/// Directory where binary is installed. Default to `${cargo_bin}`.
|
|
||||||
bin_dir: Option<String>,
|
|
||||||
/// Path to binary in archive. Default to `${tool}${exe}`.
|
/// Path to binary in archive. Default to `${tool}${exe}`.
|
||||||
bin: Option<String>,
|
bin: Option<String>,
|
||||||
platform: BTreeMap<HostPlatform, BaseManifestPlatformInfo>,
|
platform: BTreeMap<HostPlatform, BaseManifestPlatformInfo>,
|
||||||
@@ -661,8 +660,6 @@ struct BaseManifest {
|
|||||||
struct BaseManifestPlatformInfo {
|
struct BaseManifestPlatformInfo {
|
||||||
/// Asset name patterns. Default to the value at `BaseManifest::asset_name`.
|
/// Asset name patterns. Default to the value at `BaseManifest::asset_name`.
|
||||||
asset_name: Option<StringOrArray>,
|
asset_name: Option<StringOrArray>,
|
||||||
/// Directory where binary is installed. Default to the value at `BaseManifest::bin_dir`.
|
|
||||||
bin_dir: Option<String>,
|
|
||||||
/// Path to binary in archive. Default to the value at `BaseManifest::bin`.
|
/// Path to binary in archive. Default to the value at `BaseManifest::bin`.
|
||||||
bin: Option<String>,
|
bin: Option<String>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user