Skip to content

Commit 411b3aa

Browse files
authored
Java build system enhancements (#2866)
1 parent ecdcd68 commit 411b3aa

File tree

14 files changed

+412
-298
lines changed

14 files changed

+412
-298
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ onnxprofile_profile_test_*.json
4141
/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.props
4242
cmake/external/FeaturizersLibrary/
4343
# Java specific ignores
44-
java/src/main/native/ai_onnxruntime_*.h
44+
java/gradlew
45+
java/gradlew.bat
46+
java/gradle
4547
java/.gradle
4648

cmake/onnxruntime_java.cmake

+44-82
Original file line numberDiff line numberDiff line change
@@ -12,99 +12,61 @@ include_directories(${JNI_INCLUDE_DIRS})
1212
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
1313

1414
set(JAVA_ROOT ${REPO_ROOT}/java)
15-
set(CMAKE_JAVA_COMPILE_FLAGS "-source" "1.8" "-target" "1.8" "-encoding" "UTF-8")
15+
set(JAVA_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/java)
1616
if (onnxruntime_RUN_ONNX_TESTS)
1717
set(JAVA_DEPENDS onnxruntime ${test_data_target})
1818
else()
1919
set(JAVA_DEPENDS onnxruntime)
2020
endif()
2121

22-
# Specify the Java source files
23-
set(onnxruntime4j_src
24-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/MapInfo.java
25-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/NodeInfo.java
26-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OnnxRuntime.java
27-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OnnxJavaType.java
28-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OnnxMap.java
29-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OnnxSequence.java
30-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OnnxTensor.java
31-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OnnxValue.java
32-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OrtAllocator.java
33-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OrtEnvironment.java
34-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OrtException.java
35-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OrtSession.java
36-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/OrtUtil.java
37-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/package-info.java
38-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/SequenceInfo.java
39-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/TensorInfo.java
40-
${REPO_ROOT}/java/src/main/java/ai/onnxruntime/ValueInfo.java
41-
)
22+
# use the gradle wrapper if it exists
23+
if(EXISTS "${JAVA_ROOT}/gradlew")
24+
set(GRADLE_EXECUTABLE "${JAVA_ROOT}/gradlew")
25+
else()
26+
# fall back to gradle on our PATH
27+
find_program(GRADLE_EXECUTABLE gradle)
28+
if(NOT GRADLE_EXECUTABLE)
29+
message(SEND_ERROR "Gradle installation not found")
30+
endif()
31+
endif()
32+
message(STATUS "Using gradle: ${GRADLE_EXECUTABLE}")
4233

43-
# Build the jar and generate the native headers
44-
add_jar(onnxruntime4j SOURCES ${onnxruntime4j_src} VERSION ${ORT_VERSION} GENERATE_NATIVE_HEADERS onnxruntime4j_generated DESTINATION ${REPO_ROOT}/java/src/main/native/)
34+
# Specify the Java source files
35+
file(GLOB_RECURSE onnxruntime4j_gradle_files "${JAVA_ROOT}/*.gradle")
36+
file(GLOB_RECURSE onnxruntime4j_src "${JAVA_ROOT}/src/main/java/ai/onnxruntime/*.java")
37+
set(JAVA_OUTPUT_JAR ${JAVA_ROOT}/build/libs/onnxruntime.jar)
38+
# this jar is solely used to signalling mechanism for dependency management in CMake
39+
# if any of the Java sources change, the jar (and generated headers) will be regenerated and the onnxruntime4j_jni target will be rebuilt
40+
add_custom_command(OUTPUT ${JAVA_OUTPUT_JAR} COMMAND ${GRADLE_EXECUTABLE} clean jar WORKING_DIRECTORY ${JAVA_ROOT} DEPENDS ${onnxruntime4j_gradle_files} ${onnxruntime4j_src})
41+
add_custom_target(onnxruntime4j DEPENDS ${JAVA_OUTPUT_JAR})
42+
set_source_files_properties(${JAVA_OUTPUT_JAR} PROPERTIES GENERATED TRUE)
43+
set_property(TARGET onnxruntime4j APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${JAVA_OUTPUT_DIR}")
4544

46-
# Specify the native sources (without the generated headers)
45+
# Specify the native sources
4746
file(GLOB onnxruntime4j_native_src
48-
"${REPO_ROOT}/java/src/main/native/*.c"
49-
"${REPO_ROOT}/java/src/main/native/OrtJniUtil.h"
47+
"${JAVA_ROOT}/src/main/native/*.c"
48+
"${JAVA_ROOT}/src/main/native/*.h"
5049
"${REPO_ROOT}/include/onnxruntime/core/session/*.h"
5150
)
52-
5351
# Build the JNI library
54-
add_library(onnxruntime4j_jni SHARED ${onnxruntime4j_native_src} ${onnxruntime4j_generated})
52+
add_library(onnxruntime4j_jni SHARED ${onnxruntime4j_native_src})
53+
# depend on java sources. if they change, the JNI should recompile
54+
add_dependencies(onnxruntime4j_jni onnxruntime4j)
5555
onnxruntime_add_include_to_target(onnxruntime4j_jni onnxruntime_session)
56-
target_include_directories(onnxruntime4j_jni PRIVATE ${REPO_ROOT}/include ${REPO_ROOT}/java/src/main/native)
57-
target_link_libraries(onnxruntime4j_jni PUBLIC onnxruntime onnxruntime4j_generated)
58-
59-
# Now the jar, jni binary and shared lib binary have been built, now to build the jar with the binaries added.
60-
61-
# This blob creates the new jar name
62-
get_property(onnxruntime_jar_name TARGET onnxruntime4j PROPERTY JAR_FILE)
63-
get_filename_component(onnxruntime_jar_abs ${onnxruntime_jar_name} ABSOLUTE)
64-
get_filename_component(jar_path ${onnxruntime_jar_abs} DIRECTORY)
65-
set(onnxruntime_jar_binaries_name "${jar_path}/onnxruntime4j-${ORT_VERSION}-with-binaries.jar")
66-
set(onnxruntime_jar_binaries_platform "$<SHELL_PATH:${onnxruntime_jar_binaries_name}>")
67-
68-
# Copy the current jar
69-
add_custom_command(TARGET onnxruntime4j_jni PRE_BUILD
70-
COMMAND ${CMAKE_COMMAND} -E copy
71-
${onnxruntime_jar_name}
72-
${onnxruntime_jar_binaries_platform})
73-
74-
# Make a temp directory to store the binaries
75-
add_custom_command(TARGET onnxruntime4j_jni POST_BUILD
76-
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/java-libs/lib")
77-
78-
# Copy the binaries
79-
add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:onnxruntime4j_jni>" ${CMAKE_CURRENT_BINARY_DIR}/java-libs/lib/)
80-
81-
if (WIN32)
82-
add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:onnxruntime>" ${CMAKE_CURRENT_BINARY_DIR}/java-libs/lib/)
83-
# Update the with-binaries jar so it includes the binaries
84-
add_custom_command(
85-
TARGET onnxruntime4j_jni POST_BUILD
86-
COMMAND ${Java_JAR_EXECUTABLE} -uf ${onnxruntime_jar_binaries_platform} -C ${CMAKE_CURRENT_BINARY_DIR}/java-libs lib/$<TARGET_FILE_NAME:onnxruntime4j_jni> -C ${CMAKE_CURRENT_BINARY_DIR}/java-libs lib/$<TARGET_FILE_NAME:onnxruntime>
87-
DEPENDS onnxruntime4j
88-
COMMENT "Rebuilding Java archive ${_JAVA_TARGET_OUTPUT_NAME}"
89-
VERBATIM
90-
)
91-
else ()
92-
add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_LINKER_FILE:onnxruntime>" ${CMAKE_CURRENT_BINARY_DIR}/java-libs/lib/)
93-
# Update the with-binaries jar so it includes the binaries
94-
add_custom_command(
95-
TARGET onnxruntime4j_jni POST_BUILD
96-
COMMAND ${Java_JAR_EXECUTABLE} -uf ${onnxruntime_jar_binaries_platform} -C ${CMAKE_CURRENT_BINARY_DIR}/java-libs lib/$<TARGET_FILE_NAME:onnxruntime4j_jni> -C ${CMAKE_CURRENT_BINARY_DIR}/java-libs lib/$<TARGET_LINKER_FILE_NAME:onnxruntime>
97-
DEPENDS onnxruntime4j
98-
COMMENT "Rebuilding Java archive ${_JAVA_TARGET_OUTPUT_NAME}"
99-
VERBATIM
100-
)
101-
endif()
56+
# the JNI headers are generated in the onnxruntime4j target
57+
target_include_directories(onnxruntime4j_jni PRIVATE ${REPO_ROOT}/include ${JAVA_ROOT}/build/headers)
58+
target_link_libraries(onnxruntime4j_jni PUBLIC onnxruntime)
10259

103-
create_javadoc(onnxruntime4j_javadoc
104-
FILES ${onnxruntime4j_src}
105-
DOCTITLE "Onnx Runtime Java API"
106-
WINDOWTITLE "OnnxRuntime-Java-API"
107-
AUTHOR FALSE
108-
USE TRUE
109-
VERSION FALSE
110-
)
60+
# expose native libraries to the gradle build process
61+
file(MAKE_DIRECTORY ${JAVA_OUTPUT_DIR}/build)
62+
set(JAVA_PACKAGE_DIR ai/onnxruntime/native/)
63+
set(JAVA_NATIVE_LIB_DIR ${JAVA_OUTPUT_DIR}/native-lib)
64+
set(JAVA_NATIVE_JNI_DIR ${JAVA_OUTPUT_DIR}/native-jni)
65+
set(JAVA_PACKAGE_LIB_DIR ${JAVA_NATIVE_LIB_DIR}/${JAVA_PACKAGE_DIR})
66+
set(JAVA_PACKAGE_JNI_DIR ${JAVA_NATIVE_JNI_DIR}/${JAVA_PACKAGE_DIR})
67+
file(MAKE_DIRECTORY ${JAVA_PACKAGE_LIB_DIR})
68+
file(MAKE_DIRECTORY ${JAVA_PACKAGE_JNI_DIR})
69+
add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:onnxruntime> ${JAVA_PACKAGE_LIB_DIR}/$<TARGET_LINKER_FILE_NAME:onnxruntime>)
70+
add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:onnxruntime4j_jni> ${JAVA_PACKAGE_JNI_DIR}/$<TARGET_LINKER_FILE_NAME:onnxruntime4j_jni>)
71+
# run the build process (this copies the results back into CMAKE_CURRENT_BINARY_DIR)
72+
add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} cmakeBuild -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${JAVA_ROOT})

cmake/onnxruntime_unittests.cmake

+3-31
Original file line numberDiff line numberDiff line change
@@ -691,35 +691,7 @@ set_property(TARGET custom_op_library APPEND_STRING PROPERTY LINK_FLAGS ${ONNXRU
691691

692692
if (onnxruntime_BUILD_JAVA)
693693
message(STATUS "Running Java tests")
694-
# Build and run tests
695-
set(onnxruntime4j_test_src
696-
${REPO_ROOT}/java/src/test/java/ai/onnxruntime/InferenceTest.java
697-
${REPO_ROOT}/java/src/test/java/ai/onnxruntime/TestHelpers.java
698-
${REPO_ROOT}/java/src/test/java/ai/onnxruntime/OnnxMl.java
699-
${REPO_ROOT}/java/src/test/java/ai/onnxruntime/UtilTest.java
700-
)
701-
702-
# Create test directories
703-
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/java-tests/")
704-
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/java-tests/results")
705-
706-
# Download test dependencies
707-
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/java-tests/junit-platform-console-standalone-1.5.2.jar)
708-
message("Downloading JUnit 5")
709-
file(DOWNLOAD https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.5.2/junit-platform-console-standalone-1.5.2.jar ${CMAKE_CURRENT_BINARY_DIR}/java-tests/junit-platform-console-standalone-1.5.2.jar EXPECTED_HASH SHA1=8d937d2b461018a876836362b256629f4da5feb1)
710-
endif()
711-
712-
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/java-tests/protobuf-java-3.10.0.jar)
713-
message("Downloading protobuf-java 3.10.0")
714-
file(DOWNLOAD https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.jar ${CMAKE_CURRENT_BINARY_DIR}/java-tests/protobuf-java-3.10.0.jar EXPECTED_HASH SHA1=410b61dd0088aab4caa05739558d43df248958c9)
715-
endif()
716-
717-
# Build the test jar
718-
add_jar(onnxruntime4j_test SOURCES ${onnxruntime4j_test_src} VERSION ${ORT_VERSION} INCLUDE_JARS ${onnxruntime_jar_name} ${CMAKE_CURRENT_BINARY_DIR}/java-tests/junit-platform-console-standalone-1.5.2.jar ${CMAKE_CURRENT_BINARY_DIR}/java-tests/protobuf-java-3.10.0.jar)
719-
720-
add_dependencies(onnxruntime4j_test onnxruntime4j_jni onnxruntime4j)
721-
get_property(onnxruntime_test_jar_name TARGET onnxruntime4j_test PROPERTY JAR_FILE)
722-
723-
# Run the tests with JUnit's console launcher
724-
add_test(NAME java-api COMMAND ${Java_JAVA_EXECUTABLE} -jar ${CMAKE_CURRENT_BINARY_DIR}/java-tests/junit-platform-console-standalone-1.5.2.jar -cp ${CMAKE_CURRENT_BINARY_DIR}/java-tests/protobuf-java-3.10.0.jar -cp ${onnxruntime_test_jar_name} -cp ${onnxruntime_jar_binaries_platform} --scan-class-path --fail-if-no-tests --reports-dir=${CMAKE_CURRENT_BINARY_DIR}/java-tests/results --disable-banner WORKING_DIRECTORY ${REPO_ROOT})
694+
# delegate to gradle's test runner
695+
add_test(NAME onnxruntime4j_test COMMAND ${GRADLE_EXECUTABLE} cmakeCheck -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${REPO_ROOT}/java)
696+
set_property(TEST onnxruntime4j_test APPEND PROPERTY DEPENDS onnxruntime4j_jni)
725697
endif()

java/README.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# ONNX Runtime Java API
2+
3+
This directory contains the Java language binding for the ONNX runtime.
4+
Java Native Interface (JNI) is used to allow for seamless calls to ONNX runtime from Java.
5+
6+
## Usage
7+
8+
TBD: maven distribution
9+
10+
The minimum supported Java Runtime is version 8.
11+
12+
An example implementation is located in [src/test/java/sample/ScoreMNIST.java](src/test/java/sample/ScoreMNIST.java)
13+
14+
This project can be built manually using the instructions below.
15+
16+
### Building
17+
18+
Use the main project's [build instructions](../BUILD.md) with the `--build_java` option.
19+
20+
#### Requirements
21+
22+
JDK version 8 or later is required.
23+
The [Gradle](https://gradle.org/) build system is required and used here to manage the Java project's dependency management, compilation, testing, and assembly.
24+
You may use your system Gradle installation installed on your PATH.
25+
Version 6 or newer is recommended.
26+
Optionally, you may use your own Gradle [wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) which will be locked to a version specified in the `build.gradle` configuration.
27+
This can be done once by using system Gradle installation to invoke the wrapper task in the java project's directory: `cd REPO_ROOT/java && gradle wrapper`
28+
Any installed wrapper is gitignored.
29+
30+
#### Build Output
31+
32+
The build will generate output in `$REPO_ROOT/build/$OS/$CONFIGURATION/java/build`:
33+
34+
* `docs/javadoc/` - HTML javadoc
35+
* `reports/` - detailed test results and other reports
36+
* `libs/onnxruntime.jar` - JAR with classes, depends on `onnxruntime-jni.jar` and `onnxruntime-lib.jar `
37+
* `libs/onnxruntime-jni.jar`- JAR with JNI shared library
38+
* `libs/onnxruntime-lib.jar` - JAR with onnxruntime shared library
39+
* `libs/onnxruntime-all.jar` - the 3 preceding jars all combined: JAR with classes, JNI shared library, and onnxruntime shared library
40+
41+
The reason the shared libraries are split out like that is that users can mix and match to suit their use case:
42+
43+
* To support a single OS/Architecture without any dependencies, use `libs/onnxruntime-all.jar`.
44+
* To support cross-platform: bundle a single `libs/onnxruntime.jar` and with all of the respective `libs/onnxruntime-jni.jar` and `libs/onnxruntime-lib.jar` for all of the desired OS/Architectures.
45+
* To support use case where an onnxruntime shared library will reside in the system's library search path: bundle a single `libs/onnxruntime.jar` and with all of the `libs/onnxruntime-jni.jar`. The onnxruntime shared library should be loaded using one of the other methods described in the "Advanced Loading" section below.
46+
47+
#### Build System Overview
48+
49+
The main CMake build system delegates building and testing to Gradle.
50+
This allows the CMake system to ensure all of the C/C++ compilation is achieved prior to the Java build.
51+
The Java build depends on C/C++ onnxruntime shared library and a C JNI shared library (source located in the `src/main/native` directory).
52+
The JNI shared library is the glue that allows for Java to call functions in onnxruntime shared library.
53+
Given the fact that CMake injects native dependencies during CMake builds, some gradle tasks (primarily, `build`, `test`, and `check`) may fail.
54+
55+
When running the build script, CMake will compile the `onnxruntime` target and the JNI glue `onnxruntime4j_jni` target and expose the resulting libraries in a place where Gradle can ingest them.
56+
Upon successful compilation of those targets, a special Gradle task to build will be executed. The results will be placed in the output directory stated above.
57+
58+
### Advanced Loading
59+
60+
The default behavior is to load the shared libraries using classpath resources.
61+
If your use case requires custom loading of the shared libraries, please consult the javadoc in the [package-info.java](src/main/java/ai/onnxruntime/package-info.java) or [OnnxRuntime.java](src/main/java/ai/onnxruntime/OnnxRuntime.java) files.
62+
63+
## Development
64+
65+
### Code Formatting
66+
67+
[Spotless](https://github.com/diffplug/spotless/tree/master/plugin-gradle) is used to keep the code properly formatted.
68+
Gradle's `spotlessCheck` task will show any misformatted code.
69+
Gradle's `spotlessApply` task will try to fix the formatting.
70+
Misformatted code will raise failures when checks are ran during test run.
71+
72+
### JNI Headers
73+
74+
When adding or updating native methods in the Java files, it may be necessary to examine the relevant JNI headers in `build/headers/ai_onnxruntime*.h`.
75+
These files can be manually generated using Gradle's `compileJava` task which will compile the Java and update the header files accordingly.
76+
Then the corresponding C files in `./src/main/native/ai_onnxruntime*.c` may be updated and the build can be ran.
77+
78+
### Dependencies
79+
80+
The Java API does not have any runtime or compile dependencies currently.

java/build.gradle

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
plugins {
2+
id 'java'
3+
id 'com.diffplug.gradle.spotless' version '3.26.0'
4+
}
5+
6+
allprojects {
7+
repositories {
8+
mavenCentral()
9+
}
10+
}
11+
12+
java {
13+
sourceCompatibility = JavaVersion.VERSION_1_8
14+
targetCompatibility = JavaVersion.VERSION_1_8
15+
withJavadocJar()
16+
withSourcesJar()
17+
}
18+
19+
wrapper {
20+
gradleVersion = '6.1.1'
21+
}
22+
23+
spotless {
24+
//java {
25+
// removeUnusedImports()
26+
// googleJavaFormat()
27+
//}
28+
format 'gradle', {
29+
target '**/*.gradle'
30+
trimTrailingWhitespace()
31+
indentWithTabs()
32+
}
33+
}
34+
35+
// cmake runs will inform us of the build directory of the current run
36+
def cmakeBuildDir = System.properties['cmakeBuildDir']
37+
def cmakeJavaDir = "${cmakeBuildDir}/java"
38+
def cmakeNativeLibDir = "${cmakeJavaDir}/native-lib"
39+
def cmakeNativeJniDir = "${cmakeJavaDir}/native-jni"
40+
def cmakeBuildOutputDir = "${cmakeJavaDir}/build"
41+
42+
compileJava {
43+
options.compilerArgs += ["-h", "${project.buildDir}/headers/"]
44+
}
45+
46+
sourceSets.test {
47+
// add test resource files
48+
resources.srcDirs += [
49+
"${rootProject.projectDir}/../csharp/testdata",
50+
"${rootProject.projectDir}/../onnxruntime/test/testdata"
51+
]
52+
if (cmakeBuildDir != null) {
53+
// add compiled native libs
54+
resources.srcDirs += [
55+
cmakeNativeLibDir,
56+
cmakeNativeJniDir
57+
]
58+
}
59+
}
60+
61+
if (cmakeBuildDir != null) {
62+
// generate tasks to be called from cmake
63+
64+
task jniJar(type: Jar) {
65+
classifier = 'jni'
66+
from cmakeNativeJniDir
67+
}
68+
69+
task libJar(type: Jar) {
70+
classifier = 'lib'
71+
from cmakeNativeLibDir
72+
}
73+
74+
task allJar(type: Jar) {
75+
classifier = 'all'
76+
from sourceSets.main.output
77+
from cmakeNativeJniDir
78+
from cmakeNativeLibDir
79+
}
80+
81+
task cmakeBuild(type: Copy) {
82+
from project.buildDir
83+
include 'libs/**'
84+
include 'docs/**'
85+
into cmakeBuildOutputDir
86+
}
87+
cmakeBuild.dependsOn jar
88+
cmakeBuild.dependsOn jniJar
89+
cmakeBuild.dependsOn libJar
90+
cmakeBuild.dependsOn allJar
91+
cmakeBuild.dependsOn sourcesJar
92+
cmakeBuild.dependsOn javadocJar
93+
cmakeBuild.dependsOn javadoc
94+
95+
96+
task cmakeCheck(type: Copy) {
97+
from project.buildDir
98+
include 'reports/**'
99+
into cmakeBuildOutputDir
100+
}
101+
cmakeCheck.dependsOn check
102+
103+
}
104+
105+
106+
dependencies {
107+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.1'
108+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.1'
109+
testImplementation 'com.google.protobuf:protobuf-java:3.10.0'
110+
}
111+
112+
test {
113+
useJUnitPlatform()
114+
testLogging {
115+
events "passed", "skipped", "failed"
116+
}
117+
}

java/settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'onnxruntime'

0 commit comments

Comments
 (0)