-
Notifications
You must be signed in to change notification settings - Fork 30
/
build.gradle
303 lines (270 loc) · 10.6 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.jaredsburrows:gradle-checker-framework-plugin:0.2.2'
classpath 'io.timeandspace:jpsg-gradle-plugin:1.4'
}
}
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'checkstyle'
id 'de.thetaphi.forbiddenapis' version '2.6'
id 'net.ltgt.errorprone' version '0.8.1'
id 'io.freefair.javadoc-links' version '4.1.2'
id 'org.ajoberstar.git-publish' version '2.1.1'
}
// The plugin inhibits annotation processing, disabling for now: see
// https://github.com/jaredsburrows/gradle-checker-framework-plugin/issues/4
//apply plugin: 'com.jaredsburrows.checkerframework'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
api 'org.checkerframework:checker-qual:2.11.1'
compileOnly 'org.jetbrains:annotations:17.0.0'
compileOnly 'com.google.errorprone:error_prone_annotations:2.3.3'
def autoValueVersion = '1.6.5'
compileOnly "com.google.auto.value:auto-value-annotations:$autoValueVersion"
annotationProcessor "com.google.auto.value:auto-value:$autoValueVersion"
annotationProcessor 'net.ltgt.gradle.incap:incap:0.2'
def junitVersion = '5.5.2'
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testImplementation 'com.google.guava:guava:28.1-jre'
testImplementation 'com.google.guava:guava-testlib:28.1-jre'
testImplementation 'org.apache.commons:commons-math3:3.2'
testImplementation 'net.openhft:zero-allocation-hashing:0.8'
testImplementation 'org.hamcrest:hamcrest-library:2.1'
testImplementation 'one.util:streamex:0.7.0'
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
errorproneJavac 'org.codehaus.plexus:plexus-compiler-javac-errorprone:2.8.5'
}
group = 'io.timeandspace'
version = '2.1-SNAPSHOT'
description = 'SmoothieMap'
sourceCompatibility = '1.8'
//sourceSets {
// for (extraChecks in ['Enabled', 'Disabled']) {
// for (hashCodeDistribution in ['Tracking', 'NotTracking']) {
// for (doShrink in ['Flag', 'Never', 'Always']) {
// for (segmentOrderStats in ['Tracking', 'NotTracking']) {
// def sourceSetNameSuffix = "${extraChecks}ExtraChecks"
// sourceSetNameSuffix += "${hashCodeDistribution}HashCodeDistribution"
// sourceSetNameSuffix += "${doShrink}DoShrink"
// sourceSetNameSuffix += "${segmentOrderStats}SegmentOrderStats"
// for (set in ['main', 'test']) {
// create("$set$sourceSetNameSuffix", {
// compileClasspath += sourceSets.getByName(set).compileClasspath
// runtimeClasspath += sourceSets.getByName(set).runtimeClasspath
// extensions.add('basicSourceSet', sourceSets.getByName(set))
// extensions.add('extraChecks', extraChecks)
// extensions.add('hashCodeDistribution', hashCodeDistribution)
// extensions.add('doShrink', doShrink)
// extensions.add('segmentOrderStats', segmentOrderStats)
// })
// }
// }
// }
// }
// }
//}
apply plugin: 'jpsg'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
// options.compilerArgs.add('--add-modules jdk.unsupported')
}
//for (extraChecks in ['Enabled', 'Disabled']) {
// for (hashCodeDistribution in ['Tracking', 'NotTracking']) {
// for (doShrink in ['Flag', 'Never', 'Always']) {
// for (segmentOrderStats in ['Tracking', 'NotTracking']) {
// def sourceSetNameSuffix = "${extraChecks}ExtraChecks"
// sourceSetNameSuffix += "${hashCodeDistribution}HashCodeDistribution"
// sourceSetNameSuffix += "${doShrink}DoShrink"
// sourceSetNameSuffix += "${segmentOrderStats}SegmentOrderStats"
// for (set in ['main', 'test']) {
// def sourceSetName = "$set$sourceSetNameSuffix"
// tasks.register("generate${sourceSetName}JavaSpecializations",
// io.timeandspace.jpsg.JpsgTask.class) {
// def file = sourceSets.getByName(sourceSetName).allSource.getSrcDirs()[0]
// println(file)
// }
// }
//// tasks.getByName("generate${sourceSetName}JavaSpecializations") {
//// with "${extraChecks} extraChecks"
//// with "${hashCodeDistribution} hashCodeDistribution"
//// with "${doShrink} doShrink"
//// with "${segmentOrderStats} segmentOrderStats"
//// }
// }
// }
// }
//}
tasks.withType(io.timeandspace.jpsg.JpsgTask) {
// Extra sanity/state checks throughout the code, sometimes relatively heavyweight. Should be
// enabled primarily for debugging purposes.
with 'Disabled extraChecks'
// Extra checks that keys and values are non-null specifically upon reading from the
// SmoothieMap's memory. They might be nearly (or completely) free if a certain combination of
// JVM and GC algorithm doesn't access object's memory on a null check (see
// [If-enabled null comparison]). On the other hand, the benefit from enabling these checks is
// also small - perhaps just replacing NPEs with CMEs and throwing them earlier, which may make
// investigation of some bugs easier.
with 'Disabled extraConcurrencyChecks'
// If this is set to Tracking then should also comment out the exclusion in
// sourceSets.main.resources below.
with 'NotTracking hashCodeDistribution'
with 'Flag doShrink'
with 'NotTracking segmentOrderStats'
with 'Disabled moveToMapWithShrunkArray'
with 'Interleaved segments'
with 'Supported intermediateSegments'
with 'NotTracking hashTableHalfPopulationStats'
exclude 'Continuous segments'
}
sourceSets {
main {
resources {
// These two lines must be commented out if Tracking hashCodeDistribution is set
// in JPSG configuration above.
exclude '**/*.offsets'
exclude '**/*.cdfValues'
}
}
}
configure(project.sourceSets) { sourceSet ->
project.tasks.getByName(sourceSet.getTaskName('checkstyle', null)) {
ignoreFailures = true
// JPSG-generated files are excluded in config/checkstyle/suppressions.xml
source(fileTree("${project.projectDir}/src/${sourceSet.name}/javaTemplates/"))
}
}
import net.ltgt.gradle.errorprone.CheckSeverity
tasks.withType(JavaCompile).configureEach {
options.errorprone {
check("MissingOverride", CheckSeverity.ERROR)
}
}
forbiddenApis {
ignoreFailures = false
}
forbiddenApisMain {
bundledSignatures = [ 'jdk-system-out', 'jdk-deprecated' ]
signaturesFiles = files('config/forbidden-apis.txt')
suppressAnnotations = ['**.SuppressForbidden']
}
forbiddenApisTest {
bundledSignatures = [ 'jdk-deprecated' ]
}
//checkerFramework {
// checkers = [
// 'org.checkerframework.checker.index.IndexChecker',
// 'org.checkerframework.checker.nullness.NullnessChecker'
// ]
//}
test {
// Some of the tests create giant SmoothieMaps, e. g. GrowTest
maxHeapSize = "4g"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allSource
}
javadoc {
options {
use = true
links 'https://docs.oracle.com/en/java/javase/11/docs/api/'
tags = [
'apiNote:a:API Note:',
'implSpec:a:Implementation Requirements:',
'implNote:a:Implementation Note:',
'param',
'return',
'throws',
'since',
'version',
'serialData',
'see'
]
}
}
task javadocJar(type: Jar) {
classifier 'javadoc'
from javadoc
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifactId = 'smoothie-map'
artifact sourcesJar
artifact javadocJar
pom {
name = 'SmoothieMap'
inceptionYear = '2018'
description = 'Map implementation with low footprint and no latency spikes'
url = 'https://github.com/TimeAndSpaceIO/SmoothieMap'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
url = 'https://github.com/TimeAndSpaceIO/SmoothieMap'
connection = 'scm:git:git://github.com/TimeAndSpaceIO/SmoothieMap.git'
developerConnection = 'scm:git:ssh://github.com/TimeAndSpaceIO/SmoothieMap.git'
}
developers {
developer {
id = 'leventov'
name = 'Roman Leventov'
email = 'leventov.ru@gmail.com'
url = 'https://timeandspace.io'
}
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/TimeAndSpaceIO/SmoothieMap/issues'
}
}
}
}
ext {
if (!project.hasProperty('sonatypeUrl'))
sonatypeUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
if (!project.hasProperty('sonatypeUsername')) sonatypeUsername = ''
if (!project.hasProperty('sonatypePassword')) sonatypePassword = ''
}
repositories {
maven {
url = sonatypeUrl
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
ext.isReleaseVersion = !version.endsWith('SNAPSHOT')
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask('publish') }
sign publishing.publications.mavenJava
}
}
gitPublish {
repoUri = 'git@github.com:TimeAndSpaceIO/SmoothieMap.git'
branch = 'gh-pages'
contents {
from 'src/pages'
from(javadoc) {
into 'api'
}
}
}