Skip to content

Commit 02b59f9

Browse files
Merge branch '259-fix-javadoc-errors' into dev
2 parents 19afe6d + 72eef94 commit 02b59f9

File tree

12 files changed

+45
-25
lines changed

12 files changed

+45
-25
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ gen/
1212
target/
1313
out/
1414
classes/
15-
gradle.properties
1615

1716
# Local build properties
1817
build.properties

.gitlab-ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ variables:
1616
# Disable the Gradle daemon. Gradle may run in a Docker container with a shared
1717
# Docker volume containing GRADLE_USER_HOME. If the container is stopped after a job
1818
# Gradle daemons may get killed, preventing proper clean-up of lock files in GRADLE_USER_HOME.
19-
# Configure file.encoding to always use UTF-8 when running Gradle.
2019
# Use low priority processes to avoid Gradle builds consuming all build machine resources.
21-
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dfile.encoding=UTF-8 -Dorg.gradle.priority=low"
20+
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.priority=low"
2221
GITLAB_REPO_ARGS: "-PgitlabUrl=$CI_SERVER_URL -PgitlabPrivateTokenName=Deploy-Token -PgitlabPrivateToken=$OBX_READ_PACKAGES_TOKEN"
2322
GITLAB_PUBLISH_ARGS: "-PgitlabPublishTokenName=Job-Token -PgitlabPublishToken=$CI_JOB_TOKEN"
2423
CENTRAL_PUBLISH_ARGS: "-PsonatypeUsername=$SONATYPE_USER -PsonatypePassword=$SONATYPE_PWD"

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ allprojects {
8787
cacheChangingModulesFor(0, "seconds")
8888
}
8989
}
90+
91+
tasks.withType<Javadoc>().configureEach {
92+
// To support Unicode characters in API docs force the javadoc tool to use UTF-8 encoding.
93+
// Otherwise, it defaults to the system file encoding. This is required even though setting file.encoding
94+
// for the Gradle daemon (see gradle.properties) as Gradle does not pass it on to the javadoc tool.
95+
options.encoding = "UTF-8"
96+
}
9097
}
9198

9299
tasks.wrapper {

buildSrc/src/main/kotlin/objectbox-publish.gradle.kts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ plugins {
1717
id("signing")
1818
}
1919

20-
// Make javadoc task errors not break the build, some are in third-party code.
21-
if (JavaVersion.current().isJava8Compatible) {
22-
tasks.withType<Javadoc> {
23-
isFailOnError = false
24-
}
25-
}
26-
2720
publishing {
2821
repositories {
2922
maven {

gradle.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Gradle configuration
2+
# https://docs.gradle.org/current/userguide/build_environment.html
3+
4+
# To support Unicode characters in source code, set UTF-8 as the file encoding for the Gradle daemon,
5+
# which will make most Java tools use it instead of the default system file encoding. Note that for API docs,
6+
# the javadoc tool must be configured separately, see the root build script.
7+
# https://docs.gradle.org/current/userguide/common_caching_problems.html#system_file_encoding
8+
org.gradle.jvmargs=-Dfile.encoding=UTF-8

objectbox-java/build.gradle

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,28 @@ tasks.spotbugsMain {
3535
}
3636
}
3737

38+
// Note: used for the Maven javadoc artifact, a separate task is used to build API docs to publish online
3839
javadoc {
39-
// Hide internal API from javadoc artifact.
40+
// Internal Java APIs
4041
exclude("**/io/objectbox/Cursor.java")
4142
exclude("**/io/objectbox/KeyValueCursor.java")
4243
exclude("**/io/objectbox/ModelBuilder.java")
4344
exclude("**/io/objectbox/Properties.java")
4445
exclude("**/io/objectbox/Transaction.java")
45-
exclude("**/io/objectbox/model/**")
4646
exclude("**/io/objectbox/ideasonly/**")
4747
exclude("**/io/objectbox/internal/**")
4848
exclude("**/io/objectbox/reactive/DataPublisherUtils.java")
4949
exclude("**/io/objectbox/reactive/WeakDataObserver.java")
50+
exclude("**/io/objectbox/sync/server/ClusterPeerInfo.java")
51+
// Repackaged FlatBuffers distribution
52+
exclude("**/io/objectbox/flatbuffers/**")
53+
// FlatBuffers generated files only used internally (note: some are part of the public API)
54+
exclude("**/io/objectbox/model/**")
55+
exclude("**/io/objectbox/sync/Credentials.java")
56+
exclude("**/io/objectbox/sync/CredentialsType.java")
57+
exclude("**/io/objectbox/sync/server/ClusterPeerConfig.java")
58+
exclude("**/io/objectbox/sync/server/JwtConfig.java")
59+
exclude("**/io/objectbox/sync/server/SyncServerOptions.java")
5060
}
5161

5262
// Note: use packageJavadocForWeb to get as ZIP.
@@ -55,33 +65,41 @@ tasks.register('javadocForWeb', Javadoc) {
5565
description = 'Builds Javadoc incl. objectbox-java-api classes with web tweaks.'
5666

5767
javadocTool = javaToolchains.javadocToolFor {
58-
// Note: the style changes only work if using JDK 10+, 11 is latest LTS.
59-
languageVersion = JavaLanguageVersion.of(11)
68+
// Note: the style changes only work if using JDK 10+, 17 is the LTS release used to publish this
69+
languageVersion = JavaLanguageVersion.of(17)
6070
}
6171

6272
def srcApi = project(':objectbox-java-api').file('src/main/java/')
6373
if (!srcApi.directory) throw new GradleScriptException("Not a directory: ${srcApi}", null)
6474
// Hide internal API from javadoc artifact.
6575
def filteredSources = sourceSets.main.allJava.matching {
76+
// Internal Java APIs
6677
exclude("**/io/objectbox/Cursor.java")
6778
exclude("**/io/objectbox/KeyValueCursor.java")
6879
exclude("**/io/objectbox/ModelBuilder.java")
6980
exclude("**/io/objectbox/Properties.java")
7081
exclude("**/io/objectbox/Transaction.java")
71-
exclude("**/io/objectbox/flatbuffers/**")
7282
exclude("**/io/objectbox/ideasonly/**")
7383
exclude("**/io/objectbox/internal/**")
74-
exclude("**/io/objectbox/model/**")
7584
exclude("**/io/objectbox/reactive/DataPublisherUtils.java")
7685
exclude("**/io/objectbox/reactive/WeakDataObserver.java")
86+
exclude("**/io/objectbox/sync/server/ClusterPeerInfo.java")
87+
// Repackaged FlatBuffers distribution
88+
exclude("**/io/objectbox/flatbuffers/**")
89+
// FlatBuffers generated files only used internally (note: some are part of the public API)
90+
exclude("**/io/objectbox/model/**")
91+
exclude("**/io/objectbox/sync/Credentials.java")
92+
exclude("**/io/objectbox/sync/CredentialsType.java")
93+
exclude("**/io/objectbox/sync/server/ClusterPeerConfig.java")
94+
exclude("**/io/objectbox/sync/server/JwtConfig.java")
95+
exclude("**/io/objectbox/sync/server/SyncServerOptions.java")
7796
}
7897
source = filteredSources + srcApi
7998

8099
classpath = sourceSets.main.output + sourceSets.main.compileClasspath
81100
destinationDir = file(javadocForWebDir)
82101

83102
title = "ObjectBox Java ${version} API"
84-
options.encoding = 'UTF-8' // Set UTF-8 encoding to support unicode characters used in docs
85103
options.overview = "$projectDir/src/web/overview.html"
86104
options.bottom = 'Available under the Apache License, Version 2.0 - <i>Copyright &#169; 2017-2024 <a href="https://objectbox.io/">ObjectBox Ltd</a>. All Rights Reserved.</i>'
87105

objectbox-java/src/main/java/io/objectbox/relation/ToMany.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* <pre>{@code
5959
* // Java
6060
* @Entity
61-
* public class Student{
61+
* public class Student {
6262
* private ToMany<Teacher> teachers;
6363
* }
6464
*
@@ -85,7 +85,6 @@
8585
* <p>
8686
* To apply (persist) the changes to the database, call {@link #applyChangesToDb()} or put the object with the ToMany.
8787
* For important details, see the notes about relations of {@link Box#put(Object)}.
88-
* <p>
8988
* <pre>{@code
9089
* // Example 1: add target objects to a relation
9190
* student.getTeachers().add(teacher1);

objectbox-java/src/main/java/io/objectbox/relation/ToOne.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
* </ul>
6262
* <p>
6363
* Then, to persist the changes {@link Box#put} the object with the ToOne.
64-
* <p>
6564
* <pre>{@code
6665
* // Example 1: create a relation
6766
* order.getCustomer().setTarget(customer);

objectbox-java/src/main/java/io/objectbox/sync/Sync.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static boolean isServerAvailable() {
4444
}
4545

4646
/**
47-
* Returns true if the included native (JNI) ObjectBox library supports Sync hybrids (server & client).
47+
* Returns true if the included native (JNI) ObjectBox library supports Sync hybrids (server and client).
4848
*/
4949
public static boolean isHybridAvailable() {
5050
return isAvailable() && isServerAvailable();

objectbox-java/src/main/java/io/objectbox/sync/SyncFlags.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public final class SyncFlags {
2626
private SyncFlags() { }
2727
/**
28-
* Enable (rather extensive) logging on how IDs are mapped (local <-> global)
28+
* Enable (rather extensive) logging on how IDs are mapped (local &lt;-&gt; global)
2929
*/
3030
public static final int DebugLogIdMapping = 1;
3131
/**

objectbox-java/src/main/java/io/objectbox/sync/SyncHybrid.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* Combines the functionality of a Sync client and a Sync server.
2626
* <p>
27-
* It is typically used in local cluster setups, in which a "hybrid" functions as a client & cluster peer (server).
27+
* It is typically used in local cluster setups, in which a "hybrid" functions as a client and cluster peer (server).
2828
* <p>
2929
* Call {@link #getStore()} to retrieve the store. To set sync listeners use the {@link SyncClient} that is available
3030
* from {@link #getClient()}.

tests/objectbox-java-test/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ tasks.withType<JavaCompile> {
1010
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
1111
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
1212
options.release.set(8)
13-
// Note: Gradle defaults to the platform default encoding, make sure to always use UTF-8 for UTF-8 tests.
14-
options.encoding = "UTF-8"
1513
}
1614

1715
// Produce Java 8 byte code, would default to Java 6.

0 commit comments

Comments
 (0)