forked from line/centraldogma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
161 lines (137 loc) · 5.39 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
plugins {
id 'com.google.osdetector' version '1.6.2' apply false
id 'me.champeau.jmh' version '0.6.5' apply false
}
allprojects {
repositories {
mavenCentral()
jcenter()
//maven {
// url 'https://oss.sonatype.org/content/repositories/snapshots/'
//}
}
}
ext {
// Remove 'java' from the client artifact IDs.
artifactIdOverrides = [
':client:java': "${rootProject.name}-client",
':client:java-armeria': "${rootProject.name}-client-armeria",
':client:java-armeria-legacy': "${rootProject.name}-client-armeria-legacy",
':client:java-spring-boot-autoconfigure': "${rootProject.name}-client-spring-boot-autoconfigure",
':client:java-spring-boot-starter': "${rootProject.name}-client-spring-boot-starter",
':client:java-spring-boot1-autoconfigure': "${rootProject.name}-client-spring-boot1-autoconfigure",
':client:java-spring-boot1-starter': "${rootProject.name}-client-spring-boot1-starter",
// Set the correct artifactId of 'testing-common'.
':testing:testing-common': "${rootProject.name}-testing-common"
]
}
apply from: "${rootDir}/gradle/scripts/build-flags.gradle"
configure(projectsWithFlags('java')) {
// Apply common plugins.
apply plugin: 'me.champeau.jmh'
// Common properties and functions.
ext {
thriftVersion = '0.9'
}
dependencies {
// All projects currently require ':common' (except itself)
if (project.name != 'common') {
api project(':common')
}
// Testing utilities
testImplementation project(':testing-internal')
// completable-futures
implementation 'com.spotify:completable-futures'
// cron-utils
implementation 'com.cronutils:cron-utils'
// Guava
implementation 'com.google.guava:guava'
// Jackson
['annotations', 'core', 'databind'].each {
implementation "com.fasterxml.jackson.core:jackson-$it"
}
// javax.inject
api 'javax.inject:javax.inject'
// JSR305
implementation 'com.google.code.findbugs:jsr305'
// Jetty ALPN support
compileOnly 'org.eclipse.jetty.alpn:alpn-api'
// Logging
implementation 'org.slf4j:slf4j-api'
testImplementation 'org.slf4j:jul-to-slf4j'
testRuntimeOnly 'ch.qos.logback:logback-classic'
['jcl-over-slf4j', 'log4j-over-slf4j'].each {
testRuntimeOnly "org.slf4j:$it"
}
// Test-time dependencies
testImplementation 'net.javacrumbs.json-unit:json-unit-fluent'
testImplementation 'org.awaitility:awaitility'
testImplementation 'org.hamcrest:hamcrest-library'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}
// Target Java 8.
tasks.withType(JavaCompile) {
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
options.compilerArgs += ['--release', '8']
}
}
// Configure JMH.
jmh {
forceGC = true
includeTests = false
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
jmhVersion = managedVersions['org.openjdk.jmh:jmh-core']
if (rootProject.hasProperty('jmh.fork')) {
fork = Integer.parseInt(String.valueOf(rootProject.findProperty('jmh.fork')))
} else {
fork = 1
}
if (rootProject.hasProperty('jmh.iterations')) {
iterations = Integer.parseInt(String.valueOf(rootProject.findProperty('jmh.iterations')))
}
if (rootProject.hasProperty('jmh.warmupIterations')) {
warmupIterations = Integer.parseInt(String.valueOf(rootProject.findProperty('jmh.warmupIterations')))
} else {
warmupIterations = iterations
}
if (rootProject.hasProperty('jmh.profilers')) {
profilers = String.valueOf(rootProject.findProperty('jmh.profilers')).split(',')
}
if (rootProject.hasProperty('jmh.verbose')) {
verbosity = 'EXTRA'
}
}
configurations.jmh.extendsFrom configurations.testImplementation
// Add common JVM options such as max memory and leak detection.
tasks.withType(JavaForkOptions) {
// Use larger heap when test coverage is enabled.
maxHeapSize = hasFlags('coverage') ? '384m' : '128m'
// Enable leak detection when '-Pleak' option is specified.
if (project.hasProperty('leak')) {
systemProperties 'io.netty.leakDetectionLevel': 'paranoid'
}
}
}
// Configure the Javadoc tasks of all projects.
allprojects {
tasks.withType(Javadoc) {
options {
// Exclude the machine-generated or internal-only classes
exclude '**/internal/**'
exclude '**/thrift/**'
}
}
}
// Require to use JDK 10 when releasing.
tasks.release.doFirst {
if (JavaVersion.current() != JavaVersion.VERSION_13) {
throw new IllegalStateException("You must release using JDK 13.")
}
}