diff --git a/README.md b/README.md index ef93f9b55..4e26818b8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,12 @@ To get out-of-the-box support, use the [GraalVM Gradle Plugin](https://graalvm.g ### 🔎 Check if Your Library or Framework Is Supported -To see whether your library or framework is supported, visit [this page](https://www.graalvm.org/native-image/libraries-and-frameworks/). It lists libraries and frameworks that are tested and ready for GraalVM Native Image. +To quickly check whether reachability metadata exists for a specific library, you can run the following command directly from your terminal (works on **Linux** and **macOS**, or on **Windows** with Git Bash / WSL): +```bash +curl -sSL https://raw.githubusercontent.com/oracle/graalvm-reachability-metadata/master/check-library-support.sh | bash -s "::" +``` + +For a broader overview of supported libraries and frameworks, you can visit [this page](https://www.graalvm.org/native-image/libraries-and-frameworks/). It lists libraries and frameworks that are tested and ready for GraalVM Native Image. If you’d like yours to appear there as well, open a pull request updating [this JSON file](https://github.com/oracle/graalvm-reachability-metadata/blob/master/library-and-framework-list.json). Before submitting a pull request, please read [this guide](docs/CONTRIBUTING.md#tested-libraries-and-frameworks). diff --git a/check-library-support.sh b/check-library-support.sh new file mode 100755 index 000000000..f28a72fbb --- /dev/null +++ b/check-library-support.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# Copyright and related rights waived via CC0 +# +# You should have received a copy of the CC0 legalcode along with this +# work. If not, see . + +set -euo pipefail + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 ::" + exit 1 +fi + +GAV="$1" + +if ! [[ "$GAV" =~ ^[^:]+:[^:]+:[^:]+$ ]]; then + echo "Invalid library format: '$GAV'" + echo "Expected format: ::" + exit 1 +fi + +IFS=':' read -r GROUP ARTIFACT VERSION <<< "$GAV" + +REMOTE_BASE_URL="https://raw.githubusercontent.com/oracle/graalvm-reachability-metadata/master/metadata" +REMOTE_INDEX_URL="$REMOTE_BASE_URL/$GROUP/$ARTIFACT/index.json" + +INDEX_CONTENT=$(curl -fsSL "$REMOTE_INDEX_URL" 2>/dev/null || true) + +if [[ -z "$INDEX_CONTENT" ]]; then + echo "Library $GAV is NOT supported by the GraalVM Reachability Metadata repository." + exit 1 +fi + +FOUND=$( + awk -v ver="$VERSION" ' + /"tested-versions"[[:space:]]*:/ {inside=1; next} + inside && /\]/ {inside=0} + inside && $0 ~ "\"" ver "\"" {print "yes"} + ' <<< "$INDEX_CONTENT" +) + +if [ "$FOUND" = "yes" ]; then + echo "Library $GAV is supported by the GraalVM Reachability Metadata repository." +else + echo "Library $GAV is NOT supported by the GraalVM Reachability Metadata repository." +fi