Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ To see whether your library or framework is supported, visit [this page](https:/
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).

You can also check if metadata for a library exists on the repository directly from your terminal without cloning it using:
Copy link
Member

Choose a reason for hiding this comment

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

Put this first. Do we have tickets for running with preserve and detecting libraries that don't require metadata?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, the command is referenced first in the README now. I've also opened the ticket.

```
curl -sSL https://raw.githubusercontent.com/oracle/graalvm-reachability-metadata/master/check-library-support.sh | bash -s "<groupId>:<artifactId>:<version>"
```

### 📚 Request Support for a New Library

Open a [library-request ticket](https://github.com/oracle/graalvm-reachability-metadata/issues/new?template=01_support_new_library.yml), include the Maven coordinates, and our automation will take it from there (🤖).
Expand Down
40 changes: 40 additions & 0 deletions check-library-support.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/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"
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