8300997: Add curl support to createJMHBundle.sh

Reviewed-by: erikj
This commit is contained in:
Eirik Bjorsnos 2023-01-25 14:01:03 +00:00 committed by Erik Joelsson
parent 8a47429dc0
commit 61775c85b0

View File

@ -1,6 +1,6 @@
#!/bin/bash -e
#
# Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -40,10 +40,22 @@ mkdir -p $BUILD_DIR $JAR_DIR
cd $JAR_DIR
rm -f *
wget https://repo.maven.apache.org/maven2/org/apache/commons/commons-math3/$COMMONS_MATH3_VERSION/commons-math3-$COMMONS_MATH3_VERSION.jar
wget https://repo.maven.apache.org/maven2/net/sf/jopt-simple/jopt-simple/$JOPT_SIMPLE_VERSION/jopt-simple-$JOPT_SIMPLE_VERSION.jar
wget https://repo.maven.apache.org/maven2/org/openjdk/jmh/jmh-core/$JMH_VERSION/jmh-core-$JMH_VERSION.jar
wget https://repo.maven.apache.org/maven2/org/openjdk/jmh/jmh-generator-annprocess/$JMH_VERSION/jmh-generator-annprocess-$JMH_VERSION.jar
fetchJar() {
url="https://repo.maven.apache.org/maven2/$1/$2/$3/$2-$3.jar"
if command -v curl > /dev/null; then
curl -O --fail $url
elif command -v wget > /dev/null; then
wget $url
else
echo "Could not find either curl or wget"
exit 1
fi
}
fetchJar org/apache/commons commons-math3 $COMMONS_MATH3_VERSION
fetchJar net/sf/jopt-simple jopt-simple $JOPT_SIMPLE_VERSION
fetchJar org/openjdk/jmh jmh-core $JMH_VERSION
fetchJar org/openjdk/jmh jmh-generator-annprocess $JMH_VERSION
tar -cvzf ../$BUNDLE_NAME *