From 0ad9f5e33c845cd5e26ac34b80d3892cce84f710 Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Wed, 20 Apr 2016 13:58:08 +0000 Subject: Refactor JDK 7 build to use the vendored version of it Along the path, fix the build for JDK 7 and get rid of most ugliness in the JDK 7 build. Now simply setting JAVA_VERSION to 1.7 will build a JDK 7 compatible version. Fixes #1159. -- Change-Id: I9599283844a57d9e053f12d37445907f22a9232e Reviewed-on: https://bazel-review.googlesource.com/#/c/3452 MOS_MIGRATED_REVID=120332747 --- compile.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'compile.sh') diff --git a/compile.sh b/compile.sh index 56299b8f1b..59ec71c72e 100755 --- a/compile.sh +++ b/compile.sh @@ -141,23 +141,24 @@ if [ $DO_TESTS ]; then fi [ -n "$JAVAC_VERSION" ] || get_java_version - if [[ ! "${BAZEL_TEST_FILTERS-}" =~ "-jdk8" ]] \ - && [ "8" -gt ${JAVAC_VERSION#*.} ]; then - display "$WARNING Your version of Java is lower than 1.8!" - display "$WARNING Deactivating Java 8 tests, please use a JDK 8 to fully" - display "$WARNING test Bazel." - if [ -n "${BAZEL_TEST_FILTERS-}" ]; then - BAZEL_TEST_FILTERS="${BAZEL_TEST_FILTERS},-jdk8" - else - BAZEL_TEST_FILTERS="-jdk8" + if [[ ! "${BAZEL_TEST_FILTERS-}" =~ "-jdk8" ]]; then + if [ "8" -gt ${JAVAC_VERSION#*.} ] || [ "${JAVA_VERSION}" = "1.7" ]; then + display "$WARNING Your version of Java is lower than 1.8!" + display "$WARNING Deactivating Java 8 tests, please use a JDK 8 to fully" + display "$WARNING test Bazel." + if [ -n "${BAZEL_TEST_FILTERS-}" ]; then + BAZEL_TEST_FILTERS="${BAZEL_TEST_FILTERS},-jdk8" + else + BAZEL_TEST_FILTERS="-jdk8" + fi fi fi $BAZEL --bazelrc=${BAZELRC} --nomaster_bazelrc test \ --test_tag_filters="${BAZEL_TEST_FILTERS-}" \ --build_tests_only \ --nolegacy_bazel_java_test \ + --define JAVA_VERSION=${JAVA_VERSION} \ ${EXTRA_BAZEL_ARGS} \ - --javacopt="-source ${JAVA_VERSION} -target ${JAVA_VERSION}" \ -k --test_output=errors //src/... //third_party/ijar/... //scripts/... \ || fail "Tests failed" fi -- cgit v1.2.3