Skip to content

Commit 8961594

Browse files
committed
8300997: Add curl support to createJMHBundle.sh
Backport-of: 61775c85b0989e4de310290e9441851f32cb84a3
1 parent e7fc89d commit 8961594

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

make/devkit/createJMHBundle.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22
#
3-
# Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
44
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
#
66
# This code is free software; you can redistribute it and/or modify it
@@ -40,10 +40,22 @@ mkdir -p $BUILD_DIR $JAR_DIR
4040
cd $JAR_DIR
4141
rm -f *
4242

43-
wget https://repo.maven.apache.org/maven2/org/apache/commons/commons-math3/$COMMONS_MATH3_VERSION/commons-math3-$COMMONS_MATH3_VERSION.jar
44-
wget https://repo.maven.apache.org/maven2/net/sf/jopt-simple/jopt-simple/$JOPT_SIMPLE_VERSION/jopt-simple-$JOPT_SIMPLE_VERSION.jar
45-
wget https://repo.maven.apache.org/maven2/org/openjdk/jmh/jmh-core/$JMH_VERSION/jmh-core-$JMH_VERSION.jar
46-
wget https://repo.maven.apache.org/maven2/org/openjdk/jmh/jmh-generator-annprocess/$JMH_VERSION/jmh-generator-annprocess-$JMH_VERSION.jar
43+
fetchJar() {
44+
url="https://repo.maven.apache.org/maven2/$1/$2/$3/$2-$3.jar"
45+
if command -v curl > /dev/null; then
46+
curl -O --fail $url
47+
elif command -v wget > /dev/null; then
48+
wget $url
49+
else
50+
echo "Could not find either curl or wget"
51+
exit 1
52+
fi
53+
}
54+
55+
fetchJar org/apache/commons commons-math3 $COMMONS_MATH3_VERSION
56+
fetchJar net/sf/jopt-simple jopt-simple $JOPT_SIMPLE_VERSION
57+
fetchJar org/openjdk/jmh jmh-core $JMH_VERSION
58+
fetchJar org/openjdk/jmh jmh-generator-annprocess $JMH_VERSION
4759

4860
tar -cvzf ../$BUNDLE_NAME *
4961

0 commit comments

Comments
 (0)