-
Notifications
You must be signed in to change notification settings - Fork 670
/
build.gradle
114 lines (99 loc) · 3.85 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
plugins {
id "com.github.spotbugs" version "5.1.3" apply false
}
defaultTasks 'build'
allprojects {
group 'ai.djl'
boolean isRelease = project.hasProperty("release") || project.hasProperty("staging")
version = "${djl_version}" + (isRelease ? "" : "-SNAPSHOT")
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
apply plugin: 'idea'
idea {
module {
outputDir = file('build/classes/java/main')
testOutputDir = file('build/classes/java/test')
// inheritOutputDirs = true
}
}
}
def javaProjects() {
return subprojects.findAll { new File(it.projectDir, "src/main").exists() }
}
configure(javaProjects()) {
apply plugin: 'java-library'
compileJava {
options.encoding = "UTF-8"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.compilerArgs << "--release" << "8" << "-proc:none" << "-Xlint:all,-options,-static" << "-Werror"
}
compileTestJava {
options.encoding = "UTF-8"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
options.compilerArgs << "-proc:none" << "-Xlint:all,-options,-static,-removal" << "-Werror"
}
javadoc.options.addStringOption("Xdoclint:none", "-quiet")
apply plugin: 'eclipse'
eclipse {
jdt.file.withProperties { props ->
props.setProperty "org.eclipse.jdt.core.circularClasspath", "warning"
}
classpath {
sourceSets.test.java {
srcDirs = ["src/test/java"]
exclude "**/package-info.java"
}
}
}
apply from: file("${rootProject.projectDir}/tools/gradle/java-formatter.gradle")
apply from: file("${rootProject.projectDir}/tools/gradle/check.gradle")
test {
// tensorflow mobilenet and resnet require more cpu memory
maxHeapSize = "4096m"
useTestNG() {
// suiteXmlFiles << new File(rootDir, "testng.xml") //This is how to add custom testng.xml
}
testLogging {
showStandardStreams = true
events "passed", "skipped", "failed", "standardOut", "standardError"
}
doFirst {
jvmArgs = [
'--add-opens', "java.base/jdk.internal.loader=ALL-UNNAMED"
]
systemProperties System.getProperties()
systemProperties.remove("user.dir")
// systemProperty "ai.djl.logging.level", "debug"
systemProperty "org.slf4j.simpleLogger.defaultLogLevel", "debug"
systemProperty "org.slf4j.simpleLogger.log.org.mortbay.log", "warn"
systemProperty "org.slf4j.simpleLogger.log.org.testng", "info"
systemProperty "disableProgressBar", "true"
systemProperty "nightly", System.getProperty("nightly", "false")
if (gradle.startParameter.offline) {
systemProperty "ai.djl.offline", "true"
}
// This is used to avoid overriding on default engine for modules:
// mxnet-engine, mxnet-model-zoo, api (MockEngine), basicdataset, fasttext, etc
if (project.name != "integration" && project.name != "examples") {
systemProperties.remove("ai.djl.default_engine")
}
}
}
jar {
manifest {
attributes(
"Automatic-Module-Name": "ai.djl.${project.name.replace('-', '_')}",
"Specification-Version": "${project.version}"
)
}
}
}
apply from: file("${rootProject.projectDir}/tools/gradle/publish.gradle")
apply from: file("${rootProject.projectDir}/tools/gradle/release.gradle")
apply from: file("${rootProject.projectDir}/tools/gradle/stats.gradle")