-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add definition for truffleruby+graalvm GFTC dev build
Different releases contain different assets so attempt to loop through the releases to find the latest one with the desired asset.
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
find_asset_url () { | ||
local repo="$1" filename="$2" | ||
local releases_prefix="https://github.com/${repo}/releases" | ||
local assets_urls assets_url path | ||
IFS=$'\n' read -d '' -r -a assets_urls < <(curl -s "$releases_prefix" | grep -oE "$releases_prefix/expanded_assets/[^\"]+") | ||
for assets_url in "${assets_urls[@]}"; do | ||
path="$(curl -s "$assets_url" | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")" | ||
if [[ -n "$path" ]]; then | ||
echo "https://github.com/$path" | ||
return 0 | ||
fi | ||
done | ||
|
||
echo "Failed to find $repo release containing $filename" >&2 | ||
return 1 | ||
} | ||
|
||
truffleruby_asset_url () { | ||
find_asset_url "graalvm/oracle-graalvm-dev-builds" "$1" | ||
} | ||
|
||
platform="$(uname -s)-$(uname -m)" | ||
case $platform in | ||
Linux-x86_64) | ||
truffleruby_url="$(truffleruby_asset_url "truffleruby-jvm-dev-linux-amd64.tar.gz")" || return $? | ||
install_package "truffleruby+graalvm-gftc-dev" "$truffleruby_url" truffleruby | ||
;; | ||
Linux-aarch64) | ||
truffleruby_url="$(truffleruby_asset_url "/truffleruby-jvm-dev-linux-aarch64.tar.gz")" || return $? | ||
install_package "truffleruby+graalvm-gftc-dev" "$truffleruby_url" truffleruby | ||
;; | ||
Darwin-x86_64) | ||
truffleruby_url="$(truffleruby_asset_url "truffleruby-jvm-dev-macos-amd64.tar.gz")" || return $? | ||
install_package "truffleruby+graalvm-gftc-dev" "$truffleruby_url" truffleruby | ||
;; | ||
Darwin-arm64) | ||
truffleruby_url="$(truffleruby_asset_url "truffleruby-jvm-dev-macos-aarch64.tar.gz")" || return $? | ||
install_package "truffleruby+graalvm-gftc-dev" "$truffleruby_url" truffleruby | ||
;; | ||
*) | ||
colorize 1 "Unsupported platform: $platform" | ||
return 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters