mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-21 15:10:27 +00:00
Add support for xbuild (#212)
Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
1
.github/.cspell/project-dictionary.txt
vendored
1
.github/.cspell/project-dictionary.txt
vendored
@@ -22,4 +22,5 @@ syft
|
||||
udeps
|
||||
wasmtime
|
||||
watchexec
|
||||
xbuild
|
||||
xscale
|
||||
|
||||
@@ -109,6 +109,7 @@ https://spdx.org/licenses
|
||||
| [**valgrind**](https://valgrind.org) | `/snap/bin` | [snap](https://snapcraft.io/install/valgrind/ubuntu) | Linux | [GPL-2.0-or-later](https://valgrind.org/docs/manual/license.gpl.html) |
|
||||
| [**wasm-pack**](https://github.com/rustwasm/wasm-pack) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/rustwasm/wasm-pack/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/rustwasm/wasm-pack/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/rustwasm/wasm-pack/blob/HEAD/LICENSE-MIT) |
|
||||
| [**wasmtime**](https://github.com/bytecodealliance/wasmtime) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/bytecodealliance/wasmtime/releases) | Linux, macOS, Windows | [Apache-2.0 WITH LLVM-exception](https://github.com/bytecodealliance/wasmtime/blob/HEAD/LICENSE) |
|
||||
| [**xbuild**](https://github.com/rust-mobile/xbuild) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/rust-mobile/xbuild/releases) | Linux, macOS, Windows | Apache-2.0 OR MIT |
|
||||
| [**zola**](https://github.com/getzola/zola) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/getzola/zola/releases) | Linux, macOS, Windows | [MIT](https://github.com/getzola/zola/blob/HEAD/LICENSE) |
|
||||
|
||||
If `$CARGO_HOME/bin` is not available, Rust-related binaries will be installed to `$HOME/.cargo/bin`.<br>
|
||||
|
||||
28
main.sh
28
main.sh
@@ -3,7 +3,7 @@
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
x() {
|
||||
rx() {
|
||||
local cmd="$1"
|
||||
shift
|
||||
(
|
||||
@@ -69,7 +69,12 @@ download_and_extract() {
|
||||
fi
|
||||
fi
|
||||
local installed_bin
|
||||
installed_bin="${bin_dir}/$(basename "${bin_in_archive}")"
|
||||
|
||||
# xbuild's binary name is "x", as opposed to the usual crate name
|
||||
case "${tool}" in
|
||||
xbuild) installed_bin="${bin_dir}/x" ;;
|
||||
*) installed_bin="${bin_dir}/$(basename "${bin_in_archive}")" ;;
|
||||
esac
|
||||
|
||||
local tar_args=()
|
||||
case "${url}" in
|
||||
@@ -246,7 +251,7 @@ install_cargo_binstall() {
|
||||
info "installing cargo-binstall"
|
||||
download_from_manifest "cargo-binstall" "latest"
|
||||
info "cargo-binstall installed at $(type -P "cargo-binstall${exe}")"
|
||||
x cargo binstall -V
|
||||
rx cargo binstall -V
|
||||
fi
|
||||
}
|
||||
apt_update() {
|
||||
@@ -578,27 +583,28 @@ for tool in "${tools[@]}"; do
|
||||
cargo-*)
|
||||
if type -P cargo &>/dev/null; then
|
||||
case "${tool}" in
|
||||
cargo-valgrind) x cargo "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
|
||||
cargo-valgrind) rx cargo "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
|
||||
*)
|
||||
if ! x cargo "${tool#cargo-}" --version; then
|
||||
x cargo "${tool#cargo-}" --help
|
||||
if ! rx cargo "${tool#cargo-}" --version; then
|
||||
rx cargo "${tool#cargo-}" --help
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
case "${tool}" in
|
||||
cargo-valgrind) x "${tool}" "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
|
||||
cargo-valgrind) rx "${tool}" "${tool#cargo-}" --help ;; # cargo-valgrind 2.1.0's --version option just calls cargo's --version option
|
||||
*)
|
||||
if ! x "${tool}" "${tool#cargo-}" --version; then
|
||||
x "${tool}" "${tool#cargo-}" --help
|
||||
if ! rx "${tool}" "${tool#cargo-}" --version; then
|
||||
rx "${tool}" "${tool#cargo-}" --help
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
xbuild) rx "x" --version ;;
|
||||
*)
|
||||
if ! x "${tool}" --version; then
|
||||
x "${tool}" --help
|
||||
if ! rx "${tool}" --version; then
|
||||
rx "${tool}" --help
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
34
manifests/xbuild.json
generated
Normal file
34
manifests/xbuild.json
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"rust_crate": "xbuild",
|
||||
"template": {
|
||||
"x86_64_linux_gnu": {
|
||||
"url": "https://github.com/rust-mobile/xbuild/releases/download/v${version}/xbuild-linux-x64",
|
||||
"bin": "xbuild-linux-x64"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"url": "https://github.com/rust-mobile/xbuild/releases/download/v${version}/xbuild-macos-x64",
|
||||
"bin": "xbuild-macos-x64"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"url": "https://github.com/rust-mobile/xbuild/releases/download/v${version}/xbuild-windows-x64.exe",
|
||||
"bin": "xbuild-windows-x64.exe"
|
||||
}
|
||||
},
|
||||
"latest": {
|
||||
"version": "0.2.0"
|
||||
},
|
||||
"0.2": {
|
||||
"version": "0.2.0"
|
||||
},
|
||||
"0.2.0": {
|
||||
"x86_64_linux_gnu": {
|
||||
"checksum": "9c294809ec3cb314b34e9f644b5bbf6ed262c25c1eeb78a3691836a95bc58e0d"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"checksum": "e357205fde5262d77b8b1dc1cb066a4f7b4edd0a83b71b3513ae466b08343305"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"checksum": "ce503cd64e6449d1c3e3bc2bfb621e9dd3ebfc775e99c97f98c2ab145e533946"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,11 @@ IFS=$'\n\t'
|
||||
cd "$(dirname "$0")"/../..
|
||||
|
||||
# They don't provide prebuilt binaries for musl or old glibc host.
|
||||
glibc_pre_2_34_incompat=(
|
||||
xbuild
|
||||
)
|
||||
glibc_pre_2_31_incompat=(
|
||||
"${glibc_pre_2_34_incompat[@]}"
|
||||
zola
|
||||
)
|
||||
glibc_pre_2_27_incompat=(
|
||||
@@ -41,13 +45,18 @@ case "$(uname -s)" in
|
||||
incompat_tools+=("${musl_incompat[@]}")
|
||||
else
|
||||
host_glibc_version=$(grep <<<"${ldd_version}" -E "GLIBC|GNU libc" | sed "s/.* //g")
|
||||
higher_glibc_version=$(sort <<<"2.31"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||
higher_glibc_version=$(sort <<<"2.34"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||
if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then
|
||||
higher_glibc_version=$(sort <<<"2.27"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||
if [[ "${higher_glibc_version}" == "${host_glibc_version}" ]]; then
|
||||
incompat_tools+=("${glibc_pre_2_31_incompat[@]}")
|
||||
higher_glibc_version=$(sort <<<"2.31"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||
if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then
|
||||
higher_glibc_version=$(sort <<<"2.27"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||
if [[ "${higher_glibc_version}" == "${host_glibc_version}" ]]; then
|
||||
incompat_tools+=("${glibc_pre_2_31_incompat[@]}")
|
||||
else
|
||||
incompat_tools+=("${glibc_pre_2_27_incompat[@]}")
|
||||
fi
|
||||
else
|
||||
incompat_tools+=("${glibc_pre_2_27_incompat[@]}")
|
||||
incompat_tools+=("${glibc_pre_2_34_incompat[@]}")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
13
tools/codegen/base/xbuild.json
Normal file
13
tools/codegen/base/xbuild.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"repository": "https://github.com/rust-mobile/xbuild",
|
||||
"tag_prefix": "v",
|
||||
"rust_crate": "${package}",
|
||||
"asset_name": "${package}-${os_name}-x64${exe}",
|
||||
"bin": "${package}-${os_name}-x64${exe}",
|
||||
"version_range": ">= 0.2.0",
|
||||
"platform": {
|
||||
"x86_64_linux_gnu": {},
|
||||
"x86_64_macos": {},
|
||||
"x86_64_windows": {}
|
||||
}
|
||||
}
|
||||
@@ -178,6 +178,12 @@ fn main() -> Result<()> {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Specifically skip versions of xbuild with build metadata.
|
||||
if base_info.rust_crate.as_deref() == Some("xbuild") && !semver_version.build.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut download_info = BTreeMap::new();
|
||||
for (&platform, base_download_info) in &base_info.platform {
|
||||
let asset_names = base_download_info
|
||||
|
||||
Reference in New Issue
Block a user