Skip to content

Commit 4bd1a83

Browse files
committed
Make the script work from command line without cloning the repo using curl and update README.md
1 parent 600eac8 commit 4bd1a83

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ To see whether your library or framework is supported, visit [this page](https:/
1313
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).
1414
Before submitting a pull request, please read [this guide](docs/CONTRIBUTING.md#tested-libraries-and-frameworks).
1515

16+
You can also check if metadata for a library exists on the repository directly from your terminal without cloning it using:
17+
```
18+
curl -sSL https://raw.githubusercontent.com/oracle/graalvm-reachability-metadata/master/check-library-support.sh | bash -s "<groupId>:<artifactId>:<version>"
19+
```
20+
1621
### 📚 Request Support for a New Library
1722

1823
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 (🤖).

check-library-support.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,33 @@
22
set -euo pipefail
33

44
if [ "$#" -ne 1 ]; then
5-
echo "Usage: $0 <groupId:artifactId:version>"
5+
echo "Usage: $0 <groupId>:<artifactId>:<version>"
66
exit 1
77
fi
88

99
GAV="$1"
1010
IFS=':' read -r GROUP ARTIFACT VERSION <<< "$GAV"
1111

12-
INDEX_FILE="metadata/$GROUP/$ARTIFACT/index.json"
12+
REMOTE_BASE_URL="https://raw.githubusercontent.com/oracle/graalvm-reachability-metadata/master/metadata"
13+
REMOTE_INDEX_URL="$REMOTE_BASE_URL/$GROUP/$ARTIFACT/index.json"
1314

14-
if [ ! -f "$INDEX_FILE" ]; then
15+
INDEX_CONTENT=$(curl -fsSL "$REMOTE_INDEX_URL" 2>/dev/null || true)
16+
17+
if [[ -z "$INDEX_CONTENT" ]]; then
1518
echo "Library $GAV is NOT supported by the GraalVM Reachability Metadata repository."
1619
exit 1
1720
fi
1821

19-
# Check if the version exists in any tested-versions (exact match)
20-
MATCH=$(jq --arg ver "$VERSION" 'any(.[]["tested-versions"][]?; . == $ver)' "$INDEX_FILE")
22+
FOUND=$(
23+
awk -v ver="$VERSION" '
24+
/"tested-versions"[[:space:]]*:/ {inside=1; next}
25+
inside && /\]/ {inside=0}
26+
inside && $0 ~ "\"" ver "\"" {print "yes"}
27+
' <<< "$INDEX_CONTENT"
28+
)
2129

22-
if [ "$MATCH" = "true" ]; then
23-
echo "Library $GAV is supported by the GraalVM Reachability Metadata repository."
30+
if [ "$FOUND" = "yes" ]; then
31+
echo "Library $GAV is supported by the GraalVM Reachability Metadata repository."
2432
else
2533
echo "Library $GAV is NOT supported by the GraalVM Reachability Metadata repository."
2634
fi

0 commit comments

Comments
 (0)