-
-
Notifications
You must be signed in to change notification settings - Fork 253
/
build.gradle
347 lines (306 loc) · 11.8 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
import org.jetbrains.kotlin.gradle.dsl.jvm.JvmTargetValidationMode
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
buildscript {
ext.kotlin_version = '2.0.21'
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.2"
classpath 'net.researchgate:gradle-release:3.0.2'
classpath "com.github.ben-manes:gradle-versions-plugin:0.51.0"
classpath "gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "org.sonarqube" version "4.4.1.3373"
}
sonarqube {
properties {
property "sonar.projectKey", "sirixdb_sirix"
property "sonar.organization", "sirixdb"
property "sonar.host.url", "https://sonarcloud.io"
}
}
apply from: "${rootDir}/libraries.gradle"
apply plugin: 'net.researchgate.release'
release {
failOnSnapshotDependencies = false
tagTemplate = 'sirix-$version'
buildTasks = ['releaseBuild']
}
tasks.withType(KotlinJvmCompile).configureEach {
jvmTargetValidationMode.set(JvmTargetValidationMode.WARNING)
}
task releaseBuild {
project.afterEvaluate {
dependsOn project.getTasksByName('build', true)
}
}
task uploadPublications {
project.afterEvaluate {
dependsOn project.getTasksByName('publishAllPublicationsToMavenRepository', true)
}
}
task travisReleaseSnapshot {
if ("${version}".endsWith('SNAPSHOT')) {
dependsOn uploadPublications
}
}
afterReleaseBuild.dependsOn(uploadPublications)
allprojects {
group = 'io.sirix'
// apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'idea'
repositories {
mavenCentral()
maven {
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://kotlin.bintray.com/kotlinx"
}
mavenLocal()
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "com.diffplug.spotless"
java {
withSourcesJar()
withJavadocJar()
toolchain {
languageVersion = JavaLanguageVersion.of(22)
}
}
javadoc {
failOnError = false
options {
addStringOption('-release', '22')
addBooleanOption('-enable-preview', true)
}
}
compileJava {
options.compilerArgs += ["--enable-preview",
"--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=java.base/java.lang.reflect=ALL-UNNAMED"]
}
compileTestJava {
options.compilerArgs += ["--enable-preview",
"--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=java.base/java.lang.reflect=ALL-UNNAMED"]
}
def applyLicenseHeader = project.hasProperty('applyLicenseHeader') ? project.applyLicenseHeader.toBoolean() : true
def spotlessFiles = project.hasProperty('spotlessFiles') ? project.spotlessFiles.split(",") : []
spotless {
enforceCheck false
java {
def javaFiles = spotlessFiles.findAll { it.endsWith('.java') }
if (javaFiles) {
def relativeJavaFiles = javaFiles.collect { file ->
file.toString().replace(project.projectDir.toString() + File.separator, '').replace('\\', '/')
}
println "Targeting Java files for formatting: ${relativeJavaFiles}"
target(relativeJavaFiles)
} else {
println "No specific Java files provided. No files will be targeted for Java formatting."
target([])
}
eclipse().configFile "${rootDir}/eclipse/sirix-formatter.xml"
// removeUnusedImports()
if (applyLicenseHeader) {
licenseHeaderFile "${rootDir}/LICENSE"
}
}
kotlin {
def kotlinFiles = spotlessFiles.findAll { it.endsWith('.kt') }
if (kotlinFiles) {
def relativeKotlinFiles = kotlinFiles.collect { file ->
file.toString().replace(project.projectDir.toString() + File.separator, '').replace('\\', '/')
}
println "Targeting Kotlin files for formatting: ${relativeKotlinFiles}"
target(relativeKotlinFiles)
} else {
println "No specific Kotlin files provided. No files will be targeted for Kotlin formatting."
target([])
}
ktfmt().kotlinlangStyle()
}
}
// jacoco {
// toolVersion = "0.8.7"
// }
//
// jacocoTestReport {
// reports {
// xml.enabled = true
// html.enabled = true
// }
// }
publishing {
publications {
maven(MavenPublication) {
afterEvaluate {
pom {
name = "${project.name}"
description = "${project.description}"
url = "https://sirix.io"
licenses {
license {
name = "New BSD"
url = "http://www.opensource.org/licenses/bsd-license.php"
comments = "3-clause BSD License"
}
}
scm {
connection = "scm:git:[email protected]:sirixdb/sirix.git"
developerConnection = "scm:git:[email protected]:sirixdb/sirix.git"
url = "https://github.com/sirixdb/sirix"
}
issueManagement {
url = "https://github.com/sirixdb/sirix/issues"
system = "GitHub Issues"
}
ciManagement {
system = "Travis CI"
url = "http://travis-ci.org/#!/sirixdb/sirix"
}
developers {
developer {
id = "johanneslichtenberger"
name = "Johannes Lichtenberger"
email = "[email protected]"
}
}
}
from components.java
}
}
}
repositories {
maven {
credentials {
username System.getenv("SONATYPE_NEXUS_USERNAME")
password System.getenv("SONATYPE_NEXUS_PASSWORD")
}
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = rootProject.getProperties().version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
ext.isReleaseVersion = !rootProject.getProperties().version.endsWith('SNAPSHOT')
tasks.withType(Sign).tap {
configureEach {
onlyIf { isReleaseVersion }
}
}
signing {
//def signingKey = System.getenv("OSSRH_GPG_SECRET_KEY")
//def signingPassword = System.getenv("OSSRH_GPG_SECRET_KEY_PASSWORD")
//useInMemoryPgpKeys(signingKey, signingPassword)
required { isReleaseVersion }
sign publishing.publications.maven
}
configurations {
testArtifacts.extendsFrom testImplementation
}
task testsJar(type: Jar) {
archiveClassifier = 'tests'
from(sourceSets.test.output)
}
artifacts {
testArtifacts testsJar
}
jar {
into("META-INF/maven/io.sirix/$project.name") {
from { generatePomFileForMavenPublication }
rename ".*", "pom.xml"
}
}
publishing.publications.maven.artifact(testsJar)
tasks.withType(JavaCompile).tap {
configureEach {
options.encoding = 'UTF-8'
}
}
test {
testLogging {
events "failed"
exceptionFormat "short"
}
useTestNG()
useJUnit()
jvmArgs(["--enable-preview",
"--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+DebugNonSafepoints",
//"-XX:+UseShenandoahGC",
// "-Xlog:gc*=debug:file=g1.log",
// "-XX:+UseZGC",
// "-XX:+ZGenerational",
// "-verbose:gc",
"-XX:+HeapDumpOnOutOfMemoryError",
//"-XX:HeapDumpPath=heapdump.hprof",
"-XX:+UseStringDeduplication",
//"-XX:MaxMetaspaceSize=3g",
//"-XX:InitiatingHeapOccupancyPercent=20",
//"-XX:MaxGCPauseMillis=60",
"-XX:MaxDirectMemorySize=1g",
"-XX:+UnlockExperimentalVMOptions",
"-XX:+AlwaysPreTouch",
"-XX:+UseLargePages",
"-XX:ReservedCodeCacheSize=1000m",
"-XX:+UnlockDiagnosticVMOptions",
// "-XX:+PrintInlining",
"-XX:EliminateAllocationArraySizeLimit=1024",
"-Ddisable.single.threaded.check=true"
/* "-XX:MaxInlineSize=500" */])
minHeapSize = '5g'
maxHeapSize = '8g'
}
}
apply from: "$rootDir/gradle/preCommit.gradle"
//task jacocoRootReport(type: JacocoReport) {
// description = 'Generates an aggregate report from all subprojects'
// dependsOn = subprojects.test
// sourceDirectories.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
// classDirectories.setFrom files(subprojects.sourceSets.main.output)
// executionData.setFrom files(subprojects.jacocoTestReport.executionData).filter {
// file -> file.exists()
// }.asList()
// reports {
// html.enabled = true
// xml.enabled = true
// }
//}
//
//coveralls {
// sourceDirs = subprojects.sourceSets.main.allSource.srcDirs.flatten()
// jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
//}