Skip to content

Commit

Permalink
ARROW-17767: [Java][ORC] Move JNI build configuration from cpp/ to ja…
Browse files Browse the repository at this point in the history
…va/ (#14163)

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
kou authored Sep 19, 2022
1 parent a866f2f commit 59b5728
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 233 deletions.
2 changes: 1 addition & 1 deletion ci/docker/java-jni-manylinux-201x.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ ENV JAVA_HOME=/usr/lib/jvm/java-$java-openjdk/
# For ci/scripts/{cpp,java}_*.sh
ENV ARROW_HOME=/tmp/local \
ARROW_JAVA_CDATA=ON \
ARROW_JNI=ON \
ARROW_JAVA_JNI=ON \
ARROW_PLASMA=ON \
ARROW_USE_CCACHE=ON
2 changes: 1 addition & 1 deletion ci/docker/linux-apt-jni.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ENV ARROW_BUILD_TESTS=ON \
ARROW_GANDIVA=ON \
ARROW_HOME=/usr/local \
ARROW_JAVA_CDATA=ON \
ARROW_JNI=ON \
ARROW_JAVA_JNI=ON \
ARROW_ORC=ON \
ARROW_PARQUET=ON \
ARROW_PLASMA_JAVA_CLIENT=ON \
Expand Down
2 changes: 0 additions & 2 deletions ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,12 @@ cmake \
-DARROW_HDFS=${ARROW_HDFS:-ON} \
-DARROW_INSTALL_NAME_RPATH=${ARROW_INSTALL_NAME_RPATH:-ON} \
-DARROW_JEMALLOC=${ARROW_JEMALLOC:-ON} \
-DARROW_JNI=${ARROW_JNI:-OFF} \
-DARROW_JSON=${ARROW_JSON:-ON} \
-DARROW_LARGE_MEMORY_TESTS=${ARROW_LARGE_MEMORY_TESTS:-OFF} \
-DARROW_MIMALLOC=${ARROW_MIMALLOC:-OFF} \
-DARROW_NO_DEPRECATED_API=${ARROW_NO_DEPRECATED_API:-OFF} \
-DARROW_ORC=${ARROW_ORC:-OFF} \
-DARROW_PARQUET=${ARROW_PARQUET:-OFF} \
-DARROW_PLASMA_JAVA_CLIENT=${ARROW_PLASMA_JAVA_CLIENT:-OFF} \
-DARROW_PLASMA=${ARROW_PLASMA:-OFF} \
-DARROW_PYTHON=${ARROW_PYTHON:-OFF} \
-DARROW_RUNTIME_SIMD_LEVEL=${ARROW_RUNTIME_SIMD_LEVEL:-MAX} \
Expand Down
3 changes: 2 additions & 1 deletion ci/scripts/java_jni_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ cmake \
-DARROW_JAVA_JNI_ENABLE_DATASET=${ARROW_DATASET:-ON} \
-DARROW_JAVA_JNI_ENABLE_GANDIVA=${ARROW_GANDIVA:-ON} \
-DARROW_JAVA_JNI_ENABLE_ORC=${ARROW_ORC:-ON} \
-DARROW_JAVA_JNI_ENABLE_PLASMA=${ARROW_PLASMA:-ON} \
-DBUILD_TESTING=${ARROW_JAVA_BUILD_TESTS} \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DCMAKE_PREFIX_PATH=${arrow_install_dir} \
-DCMAKE_INSTALL_PREFIX=${prefix_dir} \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_PREFIX=${prefix_dir} \
-DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD:-OFF} \
-GNinja \
${JAVA_JNI_CMAKE_ARGS:-} \
Expand Down
7 changes: 0 additions & 7 deletions ci/scripts/java_jni_macos_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,15 @@ pushd "${build_dir}/cpp"
cmake \
-DARROW_BUILD_SHARED=OFF \
-DARROW_BUILD_TESTS=${ARROW_BUILD_TESTS} \
-DARROW_BUILD_UTILITIES=OFF \
-DARROW_CSV=${ARROW_DATASET} \
-DARROW_DATASET=${ARROW_DATASET} \
-DARROW_DEPENDENCY_USE_SHARED=OFF \
-DARROW_FILESYSTEM=${ARROW_FILESYSTEM} \
-DARROW_GANDIVA=${ARROW_GANDIVA} \
-DARROW_GANDIVA_STATIC_LIBSTDCPP=ON \
-DARROW_JNI=ON \
-DARROW_ORC=${ARROW_ORC} \
-DARROW_PARQUET=${ARROW_PARQUET} \
-DARROW_PLASMA=${ARROW_PLASMA} \
-DARROW_PLASMA_JAVA_CLIENT=${ARROW_PLASMA_JAVA_CLIENT} \
-DARROW_S3=${ARROW_S3} \
-DARROW_USE_CCACHE=${ARROW_USE_CCACHE} \
-DAWSSDK_SOURCE=BUNDLED \
Expand Down Expand Up @@ -112,12 +109,8 @@ if [ "${ARROW_USE_CCACHE}" == "ON" ]; then
ccache -s
fi

echo "=== Copying libraries to the distribution folder ==="
mkdir -p "${dist_dir}"
cp -L ${build_dir}/cpp/*/libplasma_java.dylib ${dist_dir}

echo "=== Checking shared dependencies for libraries ==="

pushd ${dist_dir}
archery linking check-dependencies \
--allow CoreFoundation \
Expand Down
7 changes: 0 additions & 7 deletions ci/scripts/java_jni_manylinux_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ pushd "${build_dir}/cpp"
cmake \
-DARROW_BUILD_SHARED=OFF \
-DARROW_BUILD_TESTS=ON \
-DARROW_BUILD_UTILITIES=OFF \
-DARROW_CSV=${ARROW_DATASET} \
-DARROW_DATASET=${ARROW_DATASET} \
-DARROW_DEPENDENCY_SOURCE="VCPKG" \
Expand All @@ -75,10 +74,8 @@ cmake \
-DARROW_GANDIVA_PC_CXX_FLAGS=${GANDIVA_CXX_FLAGS} \
-DARROW_GANDIVA=${ARROW_GANDIVA} \
-DARROW_JEMALLOC=${ARROW_JEMALLOC} \
-DARROW_JNI=ON \
-DARROW_ORC=${ARROW_ORC} \
-DARROW_PARQUET=${ARROW_PARQUET} \
-DARROW_PLASMA_JAVA_CLIENT=${ARROW_PLASMA_JAVA_CLIENT} \
-DARROW_PLASMA=${ARROW_PLASMA} \
-DARROW_RPATH_ORIGIN=${ARROW_RPATH_ORIGIN} \
-DARROW_S3=${ARROW_S3} \
Expand Down Expand Up @@ -133,11 +130,7 @@ if [ "${ARROW_USE_CCACHE}" == "ON" ]; then
fi


echo "=== Copying libraries to the distribution folder ==="
cp -L ${build_dir}/cpp/*/libplasma_java.so ${dist_dir}

echo "=== Checking shared dependencies for libraries ==="

pushd ${dist_dir}
archery linking check-dependencies \
--allow ld-linux-x86-64 \
Expand Down
36 changes: 26 additions & 10 deletions ci/scripts/java_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,36 @@ pushd ${source_dir}

${mvn} test

if [ "${ARROW_JNI}" = "ON" ]; then
${mvn} test -Parrow-jni -pl adapter/orc,gandiva,dataset -Darrow.cpp.build.dir=${java_jni_dist_dir}
projects=()
if [ "${ARROW_DATASET}" = "ON" ]; then
projects+=(gandiva)
fi
if [ "${ARROW_GANDIVA}" = "ON" ]; then
projects+=(gandiva)
fi
if [ "${ARROW_ORC}" = "ON" ]; then
projects+=(adapter/orc)
fi
if [ "${ARROW_PLASMA}" = "ON" ]; then
projects+=(plasma)
fi
if [ "${#projects[@]}" -gt 0 ]; then
${mvn} test \
-Parrow-jni \
-pl $(IFS=,; echo "${projects[*]}") \
-Darrow.cpp.build.dir=${java_jni_dist_dir}

if [ "${ARROW_JAVA_CDATA}" = "ON" ]; then
${mvn} test -Parrow-c-data -pl c -Darrow.c.jni.dist.dir=${java_jni_dist_dir}
if [ "${ARROW_PLASMA}" = "ON" ]; then
pushd ${source_dir}/plasma
java -cp target/test-classes:target/classes \
-Djava.library.path=${java_jni_dist_dir} \
org.apache.arrow.plasma.PlasmaClientTest
popd
fi
fi

if [ "${ARROW_PLASMA}" = "ON" ]; then
pushd ${source_dir}/plasma
java -cp target/test-classes:target/classes \
-Djava.library.path=${java_jni_dist_dir} \
org.apache.arrow.plasma.PlasmaClientTest
popd
if [ "${ARROW_JAVA_CDATA}" = "ON" ]; then
${mvn} test -Parrow-c-data -pl c -Darrow.c.jni.dist.dir=${java_jni_dist_dir}
fi

popd
4 changes: 0 additions & 4 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,6 @@ if(MSVC_TOOLCHAIN)
set(ARROW_USE_GLOG OFF)
endif()

if(ARROW_JNI)
set(ARROW_BUILD_STATIC ON)
endif()

if(ARROW_ORC)
set(ARROW_WITH_LZ4 ON)
set(ARROW_WITH_SNAPPY ON)
Expand Down
4 changes: 0 additions & 4 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ takes precedence over ccache if a storage backend is configured" ON)
define_option(ARROW_JEMALLOC ${ARROW_JEMALLOC_DESCRIPTION} ON)
endif()

define_option(ARROW_JNI "Build the Arrow JNI lib" OFF)

define_option(ARROW_JSON "Build Arrow with JSON support (requires RapidJSON)" OFF)

define_option(ARROW_MIMALLOC "Build the Arrow mimalloc-based allocator" OFF)
Expand All @@ -281,8 +279,6 @@ takes precedence over ccache if a storage backend is configured" ON)

define_option(ARROW_PLASMA "Build the plasma object store along with Arrow" OFF)

define_option(ARROW_PLASMA_JAVA_CLIENT "Build the plasma object store java client" OFF)

define_option(ARROW_PYTHON "Build the Arrow CPython extensions" OFF)

define_option(ARROW_S3 "Build Arrow with S3 support (requires the AWS SDK for C++)" OFF)
Expand Down
4 changes: 0 additions & 4 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1626,10 +1626,6 @@ if(ARROW_WITH_PROTOBUF)
if(ARROW_WITH_GRPC)
# FlightSQL uses proto3 optionals, which require 3.15 or later.
set(ARROW_PROTOBUF_REQUIRED_VERSION "3.15.0")
elseif(ARROW_GANDIVA_JAVA)
# google::protobuf::MessageLite::ByteSize() is deprecated since
# Protobuf 3.4.0.
set(ARROW_PROTOBUF_REQUIRED_VERSION "3.4.0")
elseif(ARROW_SUBSTRAIT)
# Substrait protobuf files use proto3 syntax
set(ARROW_PROTOBUF_REQUIRED_VERSION "3.0.0")
Expand Down
5 changes: 5 additions & 0 deletions cpp/src/arrow/gpu/ArrowCUDAConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@

include(CMakeFindDependencyMacro)
find_dependency(Arrow)
if(CMAKE_VERSION VERSION_LESS 3.17)
find_package(CUDA REQUIRED)
else()
find_package(CUDAToolkit REQUIRED)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/ArrowCUDATargets.cmake")

Expand Down
38 changes: 0 additions & 38 deletions cpp/src/plasma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,44 +171,6 @@ install(TARGETS plasma-store-server ${INSTALL_IS_OPTIONAL}
EXPORT plasma_targets
DESTINATION ${CMAKE_INSTALL_BINDIR})

if(ARROW_PLASMA_JAVA_CLIENT)
# Plasma java client support
find_package(JNI REQUIRED)
# add jni support
include_directories(${JAVA_INCLUDE_PATH})
include_directories(${JAVA_INCLUDE_PATH2})
if(JNI_FOUND)
message(STATUS "JNI_INCLUDE_DIRS = ${JNI_INCLUDE_DIRS}")
message(STATUS "JNI_LIBRARIES = ${JNI_LIBRARIES}")
else()
message(WARNING "Could not find JNI")
endif()

add_compile_options("-I$ENV{JAVA_HOME}/include/")
if(WIN32)
add_compile_options("-I$ENV{JAVA_HOME}/include/win32")
elseif(APPLE)
add_compile_options("-I$ENV{JAVA_HOME}/include/darwin")
else() # linux
add_compile_options("-I$ENV{JAVA_HOME}/include/linux")
endif()

include_directories("${CMAKE_CURRENT_LIST_DIR}/lib/java")

file(GLOB PLASMA_LIBRARY_EXT_java_SRC lib/java/*.cc lib/*.cc)
add_library(plasma_java SHARED ${PLASMA_LIBRARY_EXT_java_SRC})

if(APPLE)
target_link_libraries(plasma_java
plasma_static
${PLASMA_STATIC_LINK_LIBS}
"-undefined dynamic_lookup"
${PTHREAD_LIBRARY})
else()
target_link_libraries(plasma_java plasma_static ${PLASMA_STATIC_LINK_LIBS}
${PTHREAD_LIBRARY})
endif()
endif()
#
# Unit tests
#
Expand Down
141 changes: 0 additions & 141 deletions cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.h

This file was deleted.

Loading

0 comments on commit 59b5728

Please sign in to comment.