|
42 | 42 | exit 1 |
43 | 43 | fi |
44 | 44 |
|
45 | | -function unwrap_file_to_location() { |
46 | | - if [ "$OS" == "mac" -o "$OS" == "linux" ]; then |
47 | | - tar --strip-components=1 -xf $1 -C $2 |
48 | | - elif [ "$OS" == "windows" ]; then |
49 | | - unzip $1 -d $2 |
50 | | - # Get the name of the extracted folder (assuming only one folder is present) |
51 | | - ls $2 |
52 | | - extracted_folder_name=$(ls $2) |
53 | | - |
54 | | - # Ensure only one folder is found |
55 | | - if [ "$(ls $2 | wc -l)" -eq 1 ]; then |
56 | | - # Move the contents to the desired destination without creating a new directory |
57 | | - mv "$2/$extracted_folder_name"/* "$2" |
58 | | - else |
59 | | - echo "Error: More than one directory found in $2." |
60 | | - fi |
61 | | - fi |
62 | | -} |
63 | | - |
64 | | -function installAlternativeJDK() { |
65 | | - ARCH=$( uname -m ) |
66 | | - if [ "x$BOOTJDK_DIR" == "x" ]; then |
67 | | - BOOTJDK_DIR=~/bootjdk |
68 | | - fi |
69 | | - if [ "x$BOOTJDK_ARCHIVE_DIR" == "x" ]; then |
70 | | - BOOTJDK_ARCHIVE_DIR=$WORKSPACE/bootjdkarchive |
71 | | - mkdir -p $BOOTJDK_ARCHIVE_DIR |
72 | | - cd $BOOTJDK_ARCHIVE_DIR |
73 | | - curl -OLJks "https://api.adoptopenjdk.net/v3/binary/latest/$OJDK_VERSION_NUMBER/ga/$OS/$ARCH/jdk/hotspot/normal/adoptopenjdk" |
74 | | - rm -rf ${BOOTJDK_DIR} |
75 | | - mkdir -p ${BOOTJDK_DIR} |
76 | | - unwrap_file_to_location ${BOOTJDK_ARCHIVE_DIR}/* ${BOOTJDK_DIR} |
77 | | - else |
78 | | - rm -rf ${BOOTJDK_DIR} |
79 | | - mkdir -p ${BOOTJDK_DIR} |
80 | | - ls ${BOOTJDK_ARCHIVE_DIR} |
81 | | - unwrap_file_to_location ${BOOTJDK_ARCHIVE_DIR}/*${ARCH}.tarxz ${BOOTJDK_DIR} |
82 | | - fi |
83 | | -} |
84 | 45 |
|
85 | 46 | function run_java_with_headless { |
86 | 47 | COMPONENTS_TO_TEST=$2 |
@@ -174,12 +135,16 @@ LOGFILE=$TMPRESULTS/testHeadlessComponent.log |
174 | 135 |
|
175 | 136 | installAlternativeJDK |
176 | 137 |
|
177 | | -JAVAC_BINARY="${BOOTJDK_DIR}/bin/javac" |
178 | | -if [ "$OS" == "mac" ]; then |
| 138 | +#JAVA_COMMAND always contains link to the java from the SDK |
| 139 | + |
| 140 | +JAVAC_BINARY="${JAVA_COMMAND}c" |
| 141 | +if [ "$OS" == "mac1" ]; then |
179 | 142 | JAVAC_BINARY="${BOOTJDK_DIR}/Contents/Home/bin/javac" |
180 | 143 | fi |
181 | 144 |
|
182 | | -#use bootjdk javac |
| 145 | +#JAVA_TO_TEST can contain either link to SDK or JRE java, however always the java that we want to test with |
| 146 | +JAVA=$JAVA_TO_TEST |
| 147 | + |
183 | 148 | #other classes depend on this one, so we might as well just compile the main class |
184 | 149 | cp -r $SCRIPT_DIR/testHeadlessComponents $WORKSPACE |
185 | 150 | ls $WORKSPACE |
|
0 commit comments