Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<groupId>:<artifactId>:<version>"
```

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).
Expand Down
47 changes: 47 additions & 0 deletions check-library-support.sh
Original file line number Diff line number Diff line change
@@ -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 <http://creativecommons.org/publicdomain/zero/1.0/>.

set -euo pipefail

if [ "$#" -ne 1 ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On which OS-es does this script work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention that in the readme.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script should have native support on Linux and macOS, while Windows can run it through channels such as WSL or Windows Git Bash. I've added a line in the README explaining this.

echo "Usage: $0 <groupId>:<artifactId>:<version>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the library is not parsing properly we need to display nice errors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an additional check if the argument provided to the command is in the GAV format (displaying an error if wrong format is used).

exit 1
fi

GAV="$1"

if ! [[ "$GAV" =~ ^[^:]+:[^:]+:[^:]+$ ]]; then
echo "Invalid library format: '$GAV'"
echo "Expected format: <groupId>:<artifactId>:<version>"
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
Loading