mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
117 lines
2.3 KiB
Groovy
117 lines
2.3 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'com.diffplug.gradle.spotless' version '3.26.0'
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
}
|
|
|
|
wrapper {
|
|
gradleVersion = '6.1.1'
|
|
}
|
|
|
|
spotless {
|
|
//java {
|
|
// removeUnusedImports()
|
|
// googleJavaFormat()
|
|
//}
|
|
format 'gradle', {
|
|
target '**/*.gradle'
|
|
trimTrailingWhitespace()
|
|
indentWithTabs()
|
|
}
|
|
}
|
|
|
|
// cmake runs will inform us of the build directory of the current run
|
|
def cmakeBuildDir = System.properties['cmakeBuildDir']
|
|
def cmakeJavaDir = "${cmakeBuildDir}/java"
|
|
def cmakeNativeLibDir = "${cmakeJavaDir}/native-lib"
|
|
def cmakeNativeJniDir = "${cmakeJavaDir}/native-jni"
|
|
def cmakeBuildOutputDir = "${cmakeJavaDir}/build"
|
|
|
|
compileJava {
|
|
options.compilerArgs += ["-h", "${project.buildDir}/headers/"]
|
|
}
|
|
|
|
sourceSets.test {
|
|
// add test resource files
|
|
resources.srcDirs += [
|
|
"${rootProject.projectDir}/../csharp/testdata",
|
|
"${rootProject.projectDir}/../onnxruntime/test/testdata"
|
|
]
|
|
if (cmakeBuildDir != null) {
|
|
// add compiled native libs
|
|
resources.srcDirs += [
|
|
cmakeNativeLibDir,
|
|
cmakeNativeJniDir
|
|
]
|
|
}
|
|
}
|
|
|
|
if (cmakeBuildDir != null) {
|
|
// generate tasks to be called from cmake
|
|
|
|
task jniJar(type: Jar) {
|
|
classifier = 'jni'
|
|
from cmakeNativeJniDir
|
|
}
|
|
|
|
task libJar(type: Jar) {
|
|
classifier = 'lib'
|
|
from cmakeNativeLibDir
|
|
}
|
|
|
|
task allJar(type: Jar) {
|
|
classifier = 'all'
|
|
from sourceSets.main.output
|
|
from cmakeNativeJniDir
|
|
from cmakeNativeLibDir
|
|
}
|
|
|
|
task cmakeBuild(type: Copy) {
|
|
from project.buildDir
|
|
include 'libs/**'
|
|
include 'docs/**'
|
|
into cmakeBuildOutputDir
|
|
}
|
|
cmakeBuild.dependsOn jar
|
|
cmakeBuild.dependsOn jniJar
|
|
cmakeBuild.dependsOn libJar
|
|
cmakeBuild.dependsOn allJar
|
|
cmakeBuild.dependsOn sourcesJar
|
|
cmakeBuild.dependsOn javadocJar
|
|
cmakeBuild.dependsOn javadoc
|
|
|
|
|
|
task cmakeCheck(type: Copy) {
|
|
from project.buildDir
|
|
include 'reports/**'
|
|
into cmakeBuildOutputDir
|
|
}
|
|
cmakeCheck.dependsOn check
|
|
|
|
}
|
|
|
|
|
|
dependencies {
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.1'
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.1'
|
|
testImplementation 'com.google.protobuf:protobuf-java:3.10.0'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events "passed", "skipped", "failed"
|
|
}
|
|
}
|