diff --git a/.travis.yml b/.travis.yml index 717ccb121..7b3c7c138 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,6 @@ compiler: - clang - gcc osx_image: xcode9.4 -jdk: - - openjdk7 cache: - ccache @@ -77,11 +75,6 @@ matrix: - os: linux compiler: clang -before_install: - - if [[ "${JOB_NAME}" == java_test || "${JOB_NAME}" == cmake* ]] && [ "$(uname -m)" == ppc64le ]; then - sudo apt-get -y install openjdk-8-jdk && export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-ppc64el; - fi - install: - if [ "${TRAVIS_OS_NAME}" == osx ]; then PATH=$PATH:/usr/local/opt/ccache/libexec; @@ -98,8 +91,21 @@ install: TAR_OPT="--strip-components=1 -xj"; mkdir cmake-dist && curl --silent --fail --show-error --location "${CMAKE_DIST_URL}" | tar -C cmake-dist ${TAR_OPT} && export PATH=$PWD/cmake-dist/bin:$PATH; fi - - if [[ "${JOB_NAME}" == java_test || "${JOB_NAME}" == cmake* ]]; then - java -version && echo "JAVA_HOME=${JAVA_HOME}"; + - | + if [[ "${JOB_NAME}" == java_test || "${JOB_NAME}" == cmake* ]]; then + # Ensure JDK 8 + if [ "${TRAVIS_OS_NAME}" == osx ]; then + brew tap AdoptOpenJDK/openjdk + brew cask install adoptopenjdk8 + export JAVA_HOME=$(/usr/libexec/java_home) + else + sudo apt-get install -y openjdk-8-jdk + export PATH=/usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/bin:$PATH + export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture) + fi + echo "JAVA_HOME=${JAVA_HOME}" + which java && java -version + which javac && javac -version fi before_script: diff --git a/Makefile b/Makefile index 92541174b..f46e260d7 100644 --- a/Makefile +++ b/Makefile @@ -207,6 +207,7 @@ AM_LINK = $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS dummy := $(shell (export ROCKSDB_ROOT="$(CURDIR)"; export PORTABLE="$(PORTABLE)"; "$(CURDIR)/build_tools/build_detect_platform" "$(CURDIR)/make_config.mk")) # this file is generated by the previous line to set build flags and sources include make_config.mk +export JAVAC_ARGS CLEAN_FILES += make_config.mk missing_make_config_paths := $(shell \ diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index 5ecc4eec4..1b9b61337 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -9,6 +9,7 @@ # PLATFORM_LDFLAGS Linker flags # JAVA_LDFLAGS Linker flags for RocksDBJava # JAVA_STATIC_LDFLAGS Linker flags for RocksDBJava static build +# JAVAC_ARGS Arguments for javac # PLATFORM_SHARED_EXT Extension for shared libraries # PLATFORM_SHARED_LDFLAGS Flags for building shared library # PLATFORM_SHARED_CFLAGS Flags for compiling objects for shared library @@ -239,6 +240,7 @@ esac PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS ${CXXFLAGS}" JAVA_LDFLAGS="$PLATFORM_LDFLAGS" JAVA_STATIC_LDFLAGS="$PLATFORM_LDFLAGS" +JAVAC_ARGS="-source 7" if [ "$CROSS_COMPILE" = "true" -o "$FBCODE_BUILD" = "true" ]; then # Cross-compiling; do not try any compilation tests. @@ -710,6 +712,7 @@ echo "PLATFORM=$PLATFORM" >> "$OUTPUT" echo "PLATFORM_LDFLAGS=$PLATFORM_LDFLAGS" >> "$OUTPUT" echo "JAVA_LDFLAGS=$JAVA_LDFLAGS" >> "$OUTPUT" echo "JAVA_STATIC_LDFLAGS=$JAVA_STATIC_LDFLAGS" >> "$OUTPUT" +echo "JAVAC_ARGS=$JAVAC_ARGS" >> "$OUTPUT" echo "VALGRIND_VER=$VALGRIND_VER" >> "$OUTPUT" echo "PLATFORM_CCFLAGS=$PLATFORM_CCFLAGS" >> "$OUTPUT" echo "PLATFORM_CXXFLAGS=$PLATFORM_CXXFLAGS" >> "$OUTPUT" diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 8c20b34f3..dc4191171 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -4,6 +4,8 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.4") message("Please consider switching to CMake 3.11.4 or newer") endif() +set(CMAKE_JAVA_COMPILE_FLAGS -source 7) + set(JNI_NATIVE_SOURCES rocksjni/backupablejni.cc rocksjni/backupenginejni.cc diff --git a/java/Makefile b/java/Makefile index c6acd4169..89e96c458 100644 --- a/java/Makefile +++ b/java/Makefile @@ -207,14 +207,14 @@ JAVA_TESTCLASSPATH = $(JAVA_JUNIT_JAR):$(JAVA_HAMCR_JAR):$(JAVA_MOCKITO_JAR):$(J MVN_LOCAL = ~/.m2/repository # Set the default JAVA_ARGS to "" for DEBUG_LEVEL=0 -JAVA_ARGS? = +JAVA_ARGS ?= -JAVAC_ARGS? = +JAVAC_ARGS ?= # When debugging add -Xcheck:jni to the java args ifneq ($(DEBUG_LEVEL),0) - JAVA_ARGS = -ea -Xcheck:jni - JAVAC_ARGS = -Xlint:deprecation -Xlint:unchecked + JAVA_ARGS += -ea -Xcheck:jni + JAVAC_ARGS += -Xlint:deprecation -Xlint:unchecked endif # This is a URL for artifacts from a "fake" release on pdillinger's fork,