-
Notifications
You must be signed in to change notification settings - Fork 68
/
build.gradle
127 lines (109 loc) · 4.05 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
115
116
117
118
119
120
121
122
123
124
125
126
127
plugins {
id "com.github.spotbugs" version "5.1.3" apply false
}
defaultTasks 'build'
def serving_version = System.getenv("DJL_VERSION")
def stagingRepo = System.getenv("DJL_STAGING")
serving_version = (serving_version == null) ? djl_version : serving_version
if (!project.hasProperty("staging")) {
serving_version += "-SNAPSHOT"
}
allprojects {
group 'ai.djl.serving'
version "${serving_version}"
repositories {
mavenCentral()
mavenLocal()
maven {
url "https://oss.sonatype.org/service/local/repositories/${stagingRepo}/content/"
}
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_11
targetCompatibility = JavaVersion.VERSION_11
options.compilerArgs << "--release" << "11" << "-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" << "-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"
doFirst {
jvmArgs = [
'--add-opens', "java.base/jdk.internal.loader=ALL-UNNAMED"
]
}
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 {
environment("MODEL_SERVER_HOME", "${project.projectDir}")
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.io.netty", "warn"
systemProperty "disableProgressBar", "true"
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": "${serving_version}"
)
}
}
}
apply from: file("${rootProject.projectDir}/tools/gradle/publish.gradle")
apply from: file("${rootProject.projectDir}/tools/gradle/python-formatter.gradle")