diff --git a/testHeadlessComponents.sh b/testHeadlessComponents.sh index efd47b6..6d65830 100755 --- a/testHeadlessComponents.sh +++ b/testHeadlessComponents.sh @@ -42,45 +42,6 @@ else exit 1 fi -function unwrap_file_to_location() { - if [ "$OS" == "mac" -o "$OS" == "linux" ]; then - tar --strip-components=1 -xf $1 -C $2 - elif [ "$OS" == "windows" ]; then - unzip $1 -d $2 - # Get the name of the extracted folder (assuming only one folder is present) - ls $2 - extracted_folder_name=$(ls $2) - - # Ensure only one folder is found - if [ "$(ls $2 | wc -l)" -eq 1 ]; then - # Move the contents to the desired destination without creating a new directory - mv "$2/$extracted_folder_name"/* "$2" - else - echo "Error: More than one directory found in $2." - fi - fi -} - -function installAlternativeJDK() { - ARCH=$( uname -m ) - if [ "x$BOOTJDK_DIR" == "x" ]; then - BOOTJDK_DIR=~/bootjdk - fi - if [ "x$BOOTJDK_ARCHIVE_DIR" == "x" ]; then - BOOTJDK_ARCHIVE_DIR=$WORKSPACE/bootjdkarchive - mkdir -p $BOOTJDK_ARCHIVE_DIR - cd $BOOTJDK_ARCHIVE_DIR - curl -OLJks "https://api.adoptopenjdk.net/v3/binary/latest/$OJDK_VERSION_NUMBER/ga/$OS/$ARCH/jdk/hotspot/normal/adoptopenjdk" - rm -rf ${BOOTJDK_DIR} - mkdir -p ${BOOTJDK_DIR} - unwrap_file_to_location ${BOOTJDK_ARCHIVE_DIR}/* ${BOOTJDK_DIR} - else - rm -rf ${BOOTJDK_DIR} - mkdir -p ${BOOTJDK_DIR} - ls ${BOOTJDK_ARCHIVE_DIR} - unwrap_file_to_location ${BOOTJDK_ARCHIVE_DIR}/*${ARCH}.tarxz ${BOOTJDK_DIR} - fi -} function run_java_with_headless { COMPONENTS_TO_TEST=$2 @@ -174,12 +135,16 @@ LOGFILE=$TMPRESULTS/testHeadlessComponent.log installAlternativeJDK -JAVAC_BINARY="${BOOTJDK_DIR}/bin/javac" -if [ "$OS" == "mac" ]; then +#JAVA_COMMAND always contains link to the java from the SDK + +JAVAC_BINARY="${JAVA_COMMAND}c" +if [ "$OS" == "mac1" ]; then JAVAC_BINARY="${BOOTJDK_DIR}/Contents/Home/bin/javac" fi -#use bootjdk javac +#JAVA_TO_TEST can contain either link to SDK or JRE java, however always the java that we want to test with +JAVA=$JAVA_TO_TEST + #other classes depend on this one, so we might as well just compile the main class cp -r $SCRIPT_DIR/testHeadlessComponents $WORKSPACE ls $WORKSPACE