forked from deepjavalibrary/djl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
123 lines (106 loc) · 3.94 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
plugins {
id "com.github.spotbugs" version "4.7.1" apply false
}
defaultTasks 'build'
allprojects {
group 'ai.djl'
boolean isRelease = project.hasProperty("release") || project.hasProperty("staging")
version = "${djl_version}" + (isRelease ? "" : "-SNAPSHOT")
repositories {
// maven {
// url "https://mlrepo.djl.ai/maven/"
// }
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'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
compileJava.options.compilerArgs.addAll(["--release", "8"])
}
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 {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
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 {
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 "disableProgressBar", "true"
systemProperty "nightly", System.getProperty("nightly", "false")
if (gradle.startParameter.offline) {
systemProperty "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")
}
}
}
compileJava {
options.compilerArgs << "-proc:none" << "-Xlint:all,-options,-static" << "-Werror"
}
compileTestJava {
options.compilerArgs << "-proc:none" << "-Xlint:all,-options,-static" << "-Werror"
}
jar {
manifest {
attributes(
"Automatic-Module-Name": "ai.djl.${project.name.replace('-', '_')}",
"Specification-Version": "${djl_version}"
)
}
}
}
apply from: file("${rootProject.projectDir}/tools/gradle/publish.gradle")
apply from: file("${rootProject.projectDir}/tools/gradle/jacoco.gradle")
apply from: file("${rootProject.projectDir}/tools/gradle/release.gradle")
apply from: file("${rootProject.projectDir}/tools/gradle/stats.gradle")