3 # Licensed to the Apache Software Foundation (ASF) under one
4 # or more contributor license agreements. See the NOTICE file
5 # distributed with this work for additional information
6 # regarding copyright ownership. The ASF licenses this file
7 # to you under the Apache License, Version 2.0 (the
8 # "License"); you may not use this file except in compliance
9 # with the License. You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
23 SOURCE="${BASH_SOURCE[0]}"
24 while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
25 SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
26 SOURCE="$(readlink "$SOURCE")"
27 [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
29 SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
31 if [[ -z "${GRADLE_TASK}" ]]; then
32 echo "GRADLE_TASK must be set. exiting..."
36 REPODIR=$(cd geode; git rev-parse --show-toplevel)
38 if [[ ${PARALLEL_GRADLE:-"true"} == "true" ]]; then
39 PARALLEL_GRADLE="--parallel"
41 PARALLEL_GRADLE="--no-parallel"
43 DEFAULT_GRADLE_TASK_OPTIONS="${PARALLEL_GRADLE} --console=plain --no-daemon"
44 GRADLE_SKIP_TASK_OPTIONS="-x javadoc -x spotlessCheck -x rat"
46 if [[ -n "${PARALLEL_DUNIT}" && "${PARALLEL_DUNIT}" == "true" ]]; then
47 PARALLEL_DUNIT="-PparallelDunit -PdunitDockerUser=geode"
48 if [ -n "${DUNIT_PARALLEL_FORKS}" ]; then
49 DUNIT_PARALLEL_FORKS="-PdunitParallelForks=${DUNIT_PARALLEL_FORKS}"
53 DUNIT_PARALLEL_FORKS=""
56 case $ARTIFACT_SLUG in
58 JAVA_BUILD_PATH=C:/java${JAVA_BUILD_VERSION}
59 JAVA_TEST_PATH=C:/java${JAVA_TEST_VERSION}
63 JAVA_BUILD_PATH=/usr/lib/jvm/java-${JAVA_BUILD_VERSION}-openjdk-amd64
64 JAVA_TEST_PATH=/usr/lib/jvm/java-${JAVA_TEST_VERSION}-openjdk-amd64
70 -PcompileJVM=${JAVA_BUILD_PATH} \
71 -PcompileJVMVer=${JAVA_BUILD_VERSION} \
72 -PtestJVM=${JAVA_TEST_PATH} \
73 -PtestJVMVer=${JAVA_TEST_VERSION} \
75 ${DUNIT_PARALLEL_FORKS} \
76 -PdunitDockerImage=\$(docker images --format '{{.Repository}}:{{.Tag}}' | grep test-container) \
77 ${DEFAULT_GRADLE_TASK_OPTIONS} \
78 ${GRADLE_SKIP_TASK_OPTIONS} \
80 ${GRADLE_TASK_OPTIONS} \
81 ${GRADLE_GLOBAL_ARGS}"
83 EXEC_COMMAND="bash -c 'echo Building with: $SEP \
84 ${JAVA_BUILD_PATH}/bin/java -version $SEP \
85 echo Testing with: $SEP \
86 ${JAVA_TEST_PATH}/bin/java -version $SEP \
88 cp gradlew gradlewStrict $SEP \
89 sed -e 's/JAVA_HOME/GRADLE_JVM/g' -i.bak gradlewStrict $SEP \
90 GRADLE_JVM=${JAVA_BUILD_PATH} ./gradlewStrict ${GRADLE_ARGS}'"
91 echo "${EXEC_COMMAND}"
92 eval "${EXEC_COMMAND}"
95 # Make sure all test containers are stopped and removed when tests are finished
96 docker stop $(docker ps -a -q)
97 docker rm $(docker ps -a -q)