Force Java version on Travis CI (#6512)

Summary:
In the `.travis.yml` file the `jdk: openjdk7` element is ignored when `language: cpp`. So whatever version of the JDK that was installed in the Travis container was used - typically JDK 11.

To ensure our RocksJava builds are working, we now instead install and use OpenJDK 8. Ideally we would use OpenJDK 7, as RocksJava supports Java 7, but many of the newer Travis containers don't support Java 7, so Java 8 is the next best thing.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6512

Differential Revision: D20388296

Pulled By: pdillinger

fbshipit-source-id: 8bbe6b59b70cfab7fe81ff63867d907fefdd2df1
main
Adam Retter 5 years ago committed by Facebook GitHub Bot
parent c15e85bdcb
commit 0772768d07
  1. 24
      .travis.yml
  2. 1
      Makefile
  3. 3
      build_tools/build_detect_platform
  4. 2
      java/CMakeLists.txt
  5. 8
      java/Makefile

@ -10,8 +10,6 @@ compiler:
- clang - clang
- gcc - gcc
osx_image: xcode9.4 osx_image: xcode9.4
jdk:
- openjdk7
cache: cache:
- ccache - ccache
@ -77,11 +75,6 @@ matrix:
- os: linux - os: linux
compiler: clang 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: install:
- if [ "${TRAVIS_OS_NAME}" == osx ]; then - if [ "${TRAVIS_OS_NAME}" == osx ]; then
PATH=$PATH:/usr/local/opt/ccache/libexec; PATH=$PATH:/usr/local/opt/ccache/libexec;
@ -98,8 +91,21 @@ install:
TAR_OPT="--strip-components=1 -xj"; 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; 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 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 fi
before_script: before_script:

@ -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")) 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 # this file is generated by the previous line to set build flags and sources
include make_config.mk include make_config.mk
export JAVAC_ARGS
CLEAN_FILES += make_config.mk CLEAN_FILES += make_config.mk
missing_make_config_paths := $(shell \ missing_make_config_paths := $(shell \

@ -9,6 +9,7 @@
# PLATFORM_LDFLAGS Linker flags # PLATFORM_LDFLAGS Linker flags
# JAVA_LDFLAGS Linker flags for RocksDBJava # JAVA_LDFLAGS Linker flags for RocksDBJava
# JAVA_STATIC_LDFLAGS Linker flags for RocksDBJava static build # JAVA_STATIC_LDFLAGS Linker flags for RocksDBJava static build
# JAVAC_ARGS Arguments for javac
# PLATFORM_SHARED_EXT Extension for shared libraries # PLATFORM_SHARED_EXT Extension for shared libraries
# PLATFORM_SHARED_LDFLAGS Flags for building shared library # PLATFORM_SHARED_LDFLAGS Flags for building shared library
# PLATFORM_SHARED_CFLAGS Flags for compiling objects for shared library # PLATFORM_SHARED_CFLAGS Flags for compiling objects for shared library
@ -239,6 +240,7 @@ esac
PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS ${CXXFLAGS}" PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS ${CXXFLAGS}"
JAVA_LDFLAGS="$PLATFORM_LDFLAGS" JAVA_LDFLAGS="$PLATFORM_LDFLAGS"
JAVA_STATIC_LDFLAGS="$PLATFORM_LDFLAGS" JAVA_STATIC_LDFLAGS="$PLATFORM_LDFLAGS"
JAVAC_ARGS="-source 7"
if [ "$CROSS_COMPILE" = "true" -o "$FBCODE_BUILD" = "true" ]; then if [ "$CROSS_COMPILE" = "true" -o "$FBCODE_BUILD" = "true" ]; then
# Cross-compiling; do not try any compilation tests. # Cross-compiling; do not try any compilation tests.
@ -710,6 +712,7 @@ echo "PLATFORM=$PLATFORM" >> "$OUTPUT"
echo "PLATFORM_LDFLAGS=$PLATFORM_LDFLAGS" >> "$OUTPUT" echo "PLATFORM_LDFLAGS=$PLATFORM_LDFLAGS" >> "$OUTPUT"
echo "JAVA_LDFLAGS=$JAVA_LDFLAGS" >> "$OUTPUT" echo "JAVA_LDFLAGS=$JAVA_LDFLAGS" >> "$OUTPUT"
echo "JAVA_STATIC_LDFLAGS=$JAVA_STATIC_LDFLAGS" >> "$OUTPUT" echo "JAVA_STATIC_LDFLAGS=$JAVA_STATIC_LDFLAGS" >> "$OUTPUT"
echo "JAVAC_ARGS=$JAVAC_ARGS" >> "$OUTPUT"
echo "VALGRIND_VER=$VALGRIND_VER" >> "$OUTPUT" echo "VALGRIND_VER=$VALGRIND_VER" >> "$OUTPUT"
echo "PLATFORM_CCFLAGS=$PLATFORM_CCFLAGS" >> "$OUTPUT" echo "PLATFORM_CCFLAGS=$PLATFORM_CCFLAGS" >> "$OUTPUT"
echo "PLATFORM_CXXFLAGS=$PLATFORM_CXXFLAGS" >> "$OUTPUT" echo "PLATFORM_CXXFLAGS=$PLATFORM_CXXFLAGS" >> "$OUTPUT"

@ -4,6 +4,8 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.4")
message("Please consider switching to CMake 3.11.4 or newer") message("Please consider switching to CMake 3.11.4 or newer")
endif() endif()
set(CMAKE_JAVA_COMPILE_FLAGS -source 7)
set(JNI_NATIVE_SOURCES set(JNI_NATIVE_SOURCES
rocksjni/backupablejni.cc rocksjni/backupablejni.cc
rocksjni/backupenginejni.cc rocksjni/backupenginejni.cc

@ -207,14 +207,14 @@ JAVA_TESTCLASSPATH = $(JAVA_JUNIT_JAR):$(JAVA_HAMCR_JAR):$(JAVA_MOCKITO_JAR):$(J
MVN_LOCAL = ~/.m2/repository MVN_LOCAL = ~/.m2/repository
# Set the default JAVA_ARGS to "" for DEBUG_LEVEL=0 # 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 # When debugging add -Xcheck:jni to the java args
ifneq ($(DEBUG_LEVEL),0) ifneq ($(DEBUG_LEVEL),0)
JAVA_ARGS = -ea -Xcheck:jni JAVA_ARGS += -ea -Xcheck:jni
JAVAC_ARGS = -Xlint:deprecation -Xlint:unchecked JAVAC_ARGS += -Xlint:deprecation -Xlint:unchecked
endif endif
# This is a URL for artifacts from a "fake" release on pdillinger's fork, # This is a URL for artifacts from a "fake" release on pdillinger's fork,

Loading…
Cancel
Save