Skip to content

Commit 0a8934d

Browse files
Merge branch '215-update-tools-dependencies' into 'dev'
Update to Gradle 8.7, Kotlin 2.0, test with JDK 21 objectbox-java#215 See merge request objectbox/objectbox-java!150
2 parents be68161 + 84cbf14 commit 0a8934d

15 files changed

Lines changed: 177 additions & 117 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ target/
1313
out/
1414
classes/
1515

16+
# Kotlin
17+
.kotlin
18+
1619
# Local build properties
1720
build.properties
1821
local.properties

.gitlab-ci.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# https://docs.gitlab.com/ci/yaml/
22

33
# Default image for linux builds
4-
# Using core instead of base to get access to ASAN from clang.
5-
image: objectboxio/buildenv-core:2023-07-28
4+
# This should match the image used to build the JVM database libraries (so Address Sanitizer library matches)
5+
image: objectboxio/buildenv-core:2024-07-11 # With JDK 17
66

77
# Assumes these environment variables are configured in GitLab CI/CD Settings:
88
# - OBX_READ_PACKAGES_TOKEN
@@ -64,7 +64,9 @@ test:
6464
script:
6565
# build to assemble, run tests and spotbugs
6666
# javadocForWeb to catch API docs errors before releasing
67-
- ./scripts/test-with-asan.sh $GITLAB_REPO_ARGS $VERSION_ARGS clean build javadocForWeb
67+
# Temporarily disable testing with Address Sanitizer until buildenv images are modernized, see #273
68+
# - ./scripts/test-with-asan.sh $GITLAB_REPO_ARGS $VERSION_ARGS clean build javadocForWeb
69+
- ./gradlew $GITLAB_REPO_ARGS $VERSION_ARGS clean build javadocForWeb
6870
artifacts:
6971
when: always
7072
paths:
@@ -117,7 +119,9 @@ test-macos:
117119
LC_ALL: "C.UTF-8"
118120
script:
119121
# Note: do not run check task as it includes SpotBugs.
120-
- ./scripts/test-with-asan.sh $GITLAB_REPO_ARGS $VERSION_ARGS clean :tests:objectbox-java-test:test
122+
# Temporarily disable testing with Address Sanitizer until buildenv images are modernized, see #273
123+
# - ./scripts/test-with-asan.sh $GITLAB_REPO_ARGS $VERSION_ARGS clean :tests:objectbox-java-test:test
124+
- ./gradlew $GITLAB_REPO_ARGS $VERSION_ARGS clean :tests:objectbox-java-test:test
121125

122126
# Test oldest supported and a recent JDK.
123127
# Note: can not run these in parallel using a matrix configuration as Gradle would step over itself.
@@ -127,12 +131,12 @@ test-jdk-8:
127131
variables:
128132
TEST_JDK: 8
129133

130-
# JDK 11 is the next oldest LTS release.
131-
test-jdk-11:
134+
# JDK 17 is the default of the current build image, so test the latest LTS JDK 21
135+
test-jdk-21:
132136
extends: .test-asan-template
133137
needs: ["test-jdk-8"]
134138
variables:
135-
TEST_JDK: 11
139+
TEST_JDK: 21
136140

137141
test-jdk-x86:
138142
extends: .test-template

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Notable changes to the ObjectBox Java library.
44

55
For more insights into what changed in the ObjectBox C++ core, [check the ObjectBox C changelog](https://github.com/objectbox/objectbox-c/blob/main/CHANGELOG.md).
66

7+
## 4.3.1 - in development
8+
9+
- Requires at least Kotlin compiler and standard library 1.7.
10+
711
## 4.3.0 - 2025-05-13
812

913
- Basic support for boolean array properties (`boolean[]` in Java or `BooleanArray` in Kotlin).

build.gradle.kts

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
// - sonatypePassword: Maven Central credential used by Nexus publishing.
77

88
plugins {
9+
// https://github.com/ben-manes/gradle-versions-plugin/releases
10+
id("com.github.ben-manes.versions") version "0.51.0"
911
// https://github.com/spotbugs/spotbugs-gradle-plugin/releases
10-
id("com.github.spotbugs") version "5.0.14" apply false
12+
id("com.github.spotbugs") version "6.0.26" apply false
1113
// https://github.com/gradle-nexus/publish-plugin/releases
1214
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
1315
}
@@ -50,14 +52,17 @@ buildscript {
5052
val essentialsVersion by extra("3.1.0")
5153
val junitVersion by extra("4.13.2")
5254
val mockitoVersion by extra("3.8.0")
53-
// The versions of Kotlin, Kotlin Coroutines and Dokka must work together.
54-
// Check https://github.com/Kotlin/kotlinx.coroutines#readme
55-
// and https://github.com/Kotlin/dokka/releases
56-
// Note: when updating might also have to increase the minimum compiler version supported
57-
// by consuming projects, see objectbox-kotlin/ build script.
58-
val kotlinVersion by extra("1.8.20")
59-
val coroutinesVersion by extra("1.7.3")
60-
val dokkaVersion by extra("1.8.20")
55+
// The versions of Gradle, Kotlin and Kotlin Coroutines must work together.
56+
// Check
57+
// - https://kotlinlang.org/docs/gradle-configure-project.html#apply-the-plugin
58+
// - https://github.com/Kotlin/kotlinx.coroutines#readme
59+
// Note: when updating to a new minor version also have to increase the minimum compiler and standard library
60+
// version supported by consuming projects, see objectbox-kotlin/ build script.
61+
val kotlinVersion by extra("2.0.21")
62+
val coroutinesVersion by extra("1.9.0")
63+
// Dokka includes its own version of the Kotlin compiler, so it must not match the used Kotlin version.
64+
// But it might not understand new language features.
65+
val dokkaVersion by extra("1.9.20")
6166

6267
repositories {
6368
mavenCentral()
@@ -96,6 +101,19 @@ allprojects {
96101
}
97102
}
98103

104+
// Exclude pre-release versions from dependencyUpdates task
105+
fun isNonStable(version: String): Boolean {
106+
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
107+
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
108+
val isStable = stableKeyword || regex.matches(version)
109+
return isStable.not()
110+
}
111+
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
112+
rejectVersionIf {
113+
isNonStable(candidate.version)
114+
}
115+
}
116+
99117
tasks.wrapper {
100118
distributionType = Wrapper.DistributionType.ALL
101119
}

gradle/wrapper/gradle-wrapper.jar

-19.5 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

objectbox-java/build.gradle.kts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tasks.withType<JavaCompile> {
1414
options.release.set(8)
1515
}
1616

17-
val javadocForWebDir = "$buildDir/docs/web-api-docs"
17+
val javadocForWebDir = layout.buildDirectory.dir("docs/web-api-docs")
1818
val essentialsVersion: String by rootProject.extra
1919

2020
dependencies {
@@ -23,7 +23,7 @@ dependencies {
2323
api("com.google.code.findbugs:jsr305:3.0.2")
2424

2525
// https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md
26-
compileOnly("com.github.spotbugs:spotbugs-annotations:4.7.3")
26+
compileOnly("com.github.spotbugs:spotbugs-annotations:4.8.6")
2727
}
2828

2929
spotbugs {
@@ -42,12 +42,14 @@ tasks.spotbugsMain {
4242
tasks.javadoc {
4343
// Internal Java APIs
4444
exclude("**/io/objectbox/Cursor.java")
45+
exclude("**/io/objectbox/InternalAccess.java")
4546
exclude("**/io/objectbox/KeyValueCursor.java")
4647
exclude("**/io/objectbox/ModelBuilder.java")
4748
exclude("**/io/objectbox/Properties.java")
4849
exclude("**/io/objectbox/Transaction.java")
4950
exclude("**/io/objectbox/ideasonly/**")
5051
exclude("**/io/objectbox/internal/**")
52+
exclude("**/io/objectbox/query/InternalAccess.java")
5153
exclude("**/io/objectbox/reactive/DataPublisherUtils.java")
5254
exclude("**/io/objectbox/reactive/WeakDataObserver.java")
5355
exclude("**/io/objectbox/sync/server/ClusterPeerInfo.java")
@@ -63,7 +65,7 @@ tasks.javadoc {
6365
}
6466

6567
// Note: use packageJavadocForWeb to get as ZIP.
66-
tasks.register<Javadoc>("javadocForWeb") {
68+
val javadocForWeb by tasks.registering(Javadoc::class) {
6769
group = "documentation"
6870
description = "Builds Javadoc incl. objectbox-java-api classes with web tweaks."
6971

@@ -78,12 +80,14 @@ tasks.register<Javadoc>("javadocForWeb") {
7880
val filteredSources = sourceSets.main.get().allJava.matching {
7981
// Internal Java APIs
8082
exclude("**/io/objectbox/Cursor.java")
83+
exclude("**/io/objectbox/InternalAccess.java")
8184
exclude("**/io/objectbox/KeyValueCursor.java")
8285
exclude("**/io/objectbox/ModelBuilder.java")
8386
exclude("**/io/objectbox/Properties.java")
8487
exclude("**/io/objectbox/Transaction.java")
8588
exclude("**/io/objectbox/ideasonly/**")
8689
exclude("**/io/objectbox/internal/**")
90+
exclude("**/io/objectbox/query/InternalAccess.java")
8791
exclude("**/io/objectbox/reactive/DataPublisherUtils.java")
8892
exclude("**/io/objectbox/reactive/WeakDataObserver.java")
8993
exclude("**/io/objectbox/sync/server/ClusterPeerInfo.java")
@@ -100,7 +104,7 @@ tasks.register<Javadoc>("javadocForWeb") {
100104
source = filteredSources + fileTree(srcApi)
101105

102106
classpath = sourceSets.main.get().output + sourceSets.main.get().compileClasspath
103-
setDestinationDir(file(javadocForWebDir))
107+
setDestinationDir(javadocForWebDir.get().asFile)
104108

105109
title = "ObjectBox Java ${project.version} API"
106110
(options as StandardJavadocDocletOptions).apply {
@@ -124,39 +128,31 @@ tasks.register<Javadoc>("javadocForWeb") {
124128
.replace("#bb7a2a", "#E61955") // Hover
125129
stylesheetFile.writeText(replacedContent)
126130
// Note: in CSS stylesheets the last added rule wins, so append to default stylesheet.
127-
// Code blocks
128-
stylesheetFile.appendText("pre {\nwhite-space: normal;\noverflow-x: auto;\n}\n")
129-
// Member summary tables
130-
stylesheetFile.appendText(".memberSummary {\noverflow: auto;\n}\n")
131-
// Descriptions and signatures
132-
stylesheetFile.appendText(".block {\n" +
133-
" display:block;\n" +
134-
" margin:3px 10px 2px 0px;\n" +
135-
" color:#474747;\n" +
136-
" overflow:auto;\n" +
137-
"}")
131+
// Make code blocks scroll instead of stick out on small width
132+
stylesheetFile.appendText("pre {\n overflow-x: auto;\n}\n")
138133

139134
println("Javadoc for web created at $destinationDir")
140135
}
141136
}
142137

143138
tasks.register<Zip>("packageJavadocForWeb") {
144-
dependsOn("javadocForWeb")
139+
dependsOn(javadocForWeb)
145140
group = "documentation"
146141
description = "Packages Javadoc incl. objectbox-java-api classes with web tweaks as ZIP."
147142

148143
archiveFileName.set("objectbox-java-web-api-docs.zip")
149-
destinationDirectory.set(file("$buildDir/dist"))
144+
val distDir = layout.buildDirectory.dir("dist")
145+
destinationDirectory.set(distDir)
150146

151147
from(file(javadocForWebDir))
152148

153149
doLast {
154-
println("Javadoc for web packaged to ${file("$buildDir/dist/objectbox-java-web-api-docs.zip")}")
150+
println("Javadoc for web packaged to ${distDir.get().file("objectbox-java-web-api-docs.zip")}")
155151
}
156152
}
157153

158154
val javadocJar by tasks.registering(Jar::class) {
159-
dependsOn("javadoc")
155+
dependsOn(tasks.javadoc)
160156
archiveClassifier.set("javadoc")
161157
from("build/docs/javadoc")
162158
}

0 commit comments

Comments
 (0)