mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-11 07:00:25 +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
|
udeps
|
||||||
wasmtime
|
wasmtime
|
||||||
watchexec
|
watchexec
|
||||||
|
xbuild
|
||||||
xscale
|
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) |
|
| [**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) |
|
| [**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) |
|
| [**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) |
|
| [**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>
|
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
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
x() {
|
rx() {
|
||||||
local cmd="$1"
|
local cmd="$1"
|
||||||
shift
|
shift
|
||||||
(
|
(
|
||||||
@@ -69,7 +69,12 @@ download_and_extract() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
local installed_bin
|
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=()
|
local tar_args=()
|
||||||
case "${url}" in
|
case "${url}" in
|
||||||
@@ -246,7 +251,7 @@ install_cargo_binstall() {
|
|||||||
info "installing cargo-binstall"
|
info "installing cargo-binstall"
|
||||||
download_from_manifest "cargo-binstall" "latest"
|
download_from_manifest "cargo-binstall" "latest"
|
||||||
info "cargo-binstall installed at $(type -P "cargo-binstall${exe}")"
|
info "cargo-binstall installed at $(type -P "cargo-binstall${exe}")"
|
||||||
x cargo binstall -V
|
rx cargo binstall -V
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
apt_update() {
|
apt_update() {
|
||||||
@@ -578,27 +583,28 @@ for tool in "${tools[@]}"; do
|
|||||||
cargo-*)
|
cargo-*)
|
||||||
if type -P cargo &>/dev/null; then
|
if type -P cargo &>/dev/null; then
|
||||||
case "${tool}" in
|
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
|
if ! rx cargo "${tool#cargo-}" --version; then
|
||||||
x cargo "${tool#cargo-}" --help
|
rx cargo "${tool#cargo-}" --help
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
case "${tool}" in
|
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
|
if ! rx "${tool}" "${tool#cargo-}" --version; then
|
||||||
x "${tool}" "${tool#cargo-}" --help
|
rx "${tool}" "${tool#cargo-}" --help
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
xbuild) rx "x" --version ;;
|
||||||
*)
|
*)
|
||||||
if ! x "${tool}" --version; then
|
if ! rx "${tool}" --version; then
|
||||||
x "${tool}" --help
|
rx "${tool}" --help
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
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")"/../..
|
cd "$(dirname "$0")"/../..
|
||||||
|
|
||||||
# They don't provide prebuilt binaries for musl or old glibc host.
|
# 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_31_incompat=(
|
||||||
|
"${glibc_pre_2_34_incompat[@]}"
|
||||||
zola
|
zola
|
||||||
)
|
)
|
||||||
glibc_pre_2_27_incompat=(
|
glibc_pre_2_27_incompat=(
|
||||||
@@ -41,6 +45,8 @@ case "$(uname -s)" in
|
|||||||
incompat_tools+=("${musl_incompat[@]}")
|
incompat_tools+=("${musl_incompat[@]}")
|
||||||
else
|
else
|
||||||
host_glibc_version=$(grep <<<"${ldd_version}" -E "GLIBC|GNU libc" | sed "s/.* //g")
|
host_glibc_version=$(grep <<<"${ldd_version}" -E "GLIBC|GNU libc" | sed "s/.* //g")
|
||||||
|
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.31"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
higher_glibc_version=$(sort <<<"2.31"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||||
if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then
|
if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then
|
||||||
higher_glibc_version=$(sort <<<"2.27"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
higher_glibc_version=$(sort <<<"2.27"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||||
@@ -49,6 +55,9 @@ case "$(uname -s)" in
|
|||||||
else
|
else
|
||||||
incompat_tools+=("${glibc_pre_2_27_incompat[@]}")
|
incompat_tools+=("${glibc_pre_2_27_incompat[@]}")
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
incompat_tools+=("${glibc_pre_2_34_incompat[@]}")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if ! type -P snap &>/dev/null; then
|
if ! type -P snap &>/dev/null; then
|
||||||
|
|||||||
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;
|
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();
|
let mut download_info = BTreeMap::new();
|
||||||
for (&platform, base_download_info) in &base_info.platform {
|
for (&platform, base_download_info) in &base_info.platform {
|
||||||
let asset_names = base_download_info
|
let asset_names = base_download_info
|
||||||
|
|||||||
Reference in New Issue
Block a user