-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathbuild.gradle.kts
276 lines (239 loc) · 8.99 KB
/
build.gradle.kts
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
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.plugin.extraProperties
import java.util.Calendar
plugins {
kotlin("jvm")
id("org.jetbrains.dokka")
id("com.github.hierynomus.license")
id("io.codearte.nexus-staging")
}
val xodusVersion: String? by project
val dailyBuild: String? by project
val mavenPublishUrl: String? by project
val mavenPublishUsername: String? by project
val mavenPublishPassword: String? by project
val signingKeyId: String? by project
val signingPassword: String? by project
val signingSecretKeyRingFile: String? by project
val isSnapshot: Boolean = xodusVersion?.endsWith("SNAPSHOT") ?: true
val isDailyBuild: Boolean = dailyBuild?.toBoolean() ?: false
val providedPublishUrl = mavenPublishUrl ?: ""
val providedPublishUsername = mavenPublishUsername ?: ""
val providedPublishPassword = mavenPublishPassword ?: ""
val providedSigningKeyId = signingKeyId ?: ""
val providedSigningPassword = signingPassword ?: ""
val providedSigningSecretKeyRingFile = signingSecretKeyRingFile ?: "../key.gpg"
val publishUrl: String =
if (isDailyBuild) "https://packages.jetbrains.team/maven/p/xodus/xodus-daily" else providedPublishUrl
group = "org.jetbrains.xodus"
version = xodusVersion ?: version
fun shouldDeploy(project: Project): Boolean {
return project.version.toString().isNotEmpty() && project.name !in listOf(
"xodus-benchmarks", "xodus-samples",
"xodus-environment-crash-tests"
)
}
fun shouldApplyDokka(project: Project): Boolean {
return project.version.toString().isNotEmpty() && project.name !in listOf(
"xodus-benchmarks",
"xodus-samples",
"xodus-query",
"xodus-environment-crash-tests"
)
}
tasks.wrapper {
gradleVersion = "8.5"
}
defaultTasks("assemble")
nexusStaging {
username = providedPublishUsername
password = providedPublishPassword
delayBetweenRetriesInMillis = 30000
stagingProfileId = "89ee7caa6631c4"
}
allprojects {
repositories {
mavenCentral()
}
}
subprojects {
apply(plugin = "license")
apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "signing")
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "maven-publish")
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
group = rootProject.group
version = rootProject.version
val archivesBaseName = project.name
setProperty("archivesBaseName", project.name)
license {
header = rootProject.file("license/copyright.ftl")
strictCheck = true
extraProperties["inceptionYear"] = 2010
extraProperties["year"] = Calendar.getInstance().get(Calendar.YEAR)
extraProperties["owner"] = "JetBrains s.r.o."
include("**/*.kt")
include("**/*.java")
exclude("**/jetbrains/exodus/diskann/diskcache/**")
exclude("**/vectoriadb/service/base/**")
mapping(
mapOf(
"kt" to "SLASHSTAR_STYLE",
"java" to "SLASHSTAR_STYLE"
)
)
}
dependencies {
implementation(rootProject.libs.commons.compress)
implementation(rootProject.libs.lz4)
implementation(rootProject.libs.fastutil)
implementation(rootProject.libs.jcTools.core)
implementation(rootProject.libs.kotlin.stdlib)
testImplementation(rootProject.libs.junit)
if (name != "vectoriadb-server") {
testImplementation(rootProject.libs.slf4j.simple)
}
}
if (name !in listOf("benchmarks", "compress", "crypto", "openAPI", "samples", "utils")) {
tasks.test {
systemProperty("exodus.cipherId", "jetbrains.exodus.crypto.streamciphers.JBChaChaStreamCipherProvider")
systemProperty("exodus.cipherKey", "000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f")
systemProperty("exodus.cipherBasicIV", "314159262718281828")
systemProperty("exodus.useVersion1Format", "false")
systemProperty("exodus.entityStore.useIntForLocalId", "true")
}
dependencies {
testImplementation(project(":xodus-crypto"))
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs = listOf("--add-modules", "jdk.incubator.vector", "--enable-preview")
}
tasks.jar {
manifest {
attributes(
"Implementation-Title" to archivesBaseName,
"Implementation-Version" to version
)
}
}
tasks.test {
systemProperty("exodus.tests.buildDirectory", project.layout.buildDirectory.asFile.get())
minHeapSize = "1g"
maxHeapSize = "1g"
jvmArgs = listOf(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
"--add-modules",
"jdk.incubator.vector",
"--enable-preview"
)
}
tasks.javadoc {
isFailOnError = false
options.quiet()
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
(options as CoreJavadocOptions).addBooleanOption("-enable-preview", true)
(options as CoreJavadocOptions).addStringOption("source", 17.toString())
}
dependencies {
implementation(rootProject.libs.kotlin.stdlib)
implementation(rootProject.libs.kotlin.logging)
}
tasks.compileKotlin {
kotlinOptions {
languageVersion = libs.versions.kotlin.lang.get()
apiVersion = libs.versions.kotlin.lang.get()
}
}
tasks.compileTestKotlin {
kotlinOptions {
languageVersion = libs.versions.kotlin.lang.get()
apiVersion = libs.versions.kotlin.lang.get()
}
}
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
if (shouldApplyDokka(this)) {
tasks.named<DokkaTask>("dokkaJavadoc") {
dokkaSourceSets {
configureEach {
reportUndocumented.set(false)
}
}
}
tasks.named<Jar>("javadocJar") {
dependsOn("dokkaJavadoc")
from(tasks.named<DokkaTask>("dokkaJavadoc").get().outputDirectory)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
if (!isSnapshot && providedSigningKeyId.isNotEmpty()) {
extra["signing.keyId"] = providedSigningKeyId
extra["signing.password"] = providedSigningPassword
extra["signing.secretKeyRingFile"] = providedSigningSecretKeyRingFile
}
afterEvaluate {
if (shouldDeploy(this)) {
configure<PublishingExtension> {
repositories {
maven {
url = uri(publishUrl)
credentials {
username = providedPublishUsername
password = providedPublishPassword
}
}
}
publications {
create<MavenPublication>("mavenJava") {
artifactId = project.name
groupId = project.group.toString()
version = project.version.toString()
from(components["java"])
pom {
name.set("Xodus")
description.set("Xodus is pure Java transactional schema-less embedded database")
packaging = "jar"
url.set("https://github.com/JetBrains/xodus")
scm {
url.set("https://github.com/JetBrains/xodus")
connection.set("scm:git:https://github.com/JetBrains/xodus.git")
developerConnection.set("scm:git:https://github.com/JetBrains/xodus.git")
}
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("JetBrains")
name.set("JetBrains Team")
organization.set("JetBrains s.r.o")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
}
}
configure<SigningExtension> {
isRequired = !isSnapshot && providedSigningKeyId.isNotEmpty()
sign(the<PublishingExtension>().publications["mavenJava"])
}
}
}
}