Skip to content

Commit 2ec9490

Browse files
Merge branch '28-web-javadoc-task' into dev
2 parents 79f2eec + fe00aff commit 2ec9490

File tree

8 files changed

+64
-22
lines changed

8 files changed

+64
-22
lines changed

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pipeline {
4242
stage('init') {
4343
steps {
4444
sh 'chmod +x gradlew'
45+
sh './gradlew -version'
4546

4647
// "|| true" for an OK exit code if no file is found
4748
sh 'rm tests/objectbox-java-test/hs_err_pid*.log || true'

ci/Jenkinsfile-Windows

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pipeline {
2525
stages {
2626
stage('init') {
2727
steps {
28+
bat 'gradlew -version'
29+
2830
// "cmd /c" for an OK exit code if no file is found
2931
bat 'cmd /c del tests\\objectbox-java-test\\hs_err_pid*.log'
3032
}

objectbox-java-api/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ version= rootProject.version
55

66
sourceCompatibility = 1.7
77

8-
javadoc {
9-
failOnError = false
10-
title = "ObjectBox API ${version} API"
11-
options.bottom = 'Available under the Apache License, Version 2.0 - <i>Copyright &#169; 2017-2020 <a href="http://objectbox.io/">ObjectBox Ltd</a>. All Rights Reserved.</i>'
12-
}
13-
148
task javadocJar(type: Jar, dependsOn: javadoc) {
159
classifier = 'javadoc'
1610
from 'build/docs/javadoc'

objectbox-java/build.gradle

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ dependencies {
2323
}
2424

2525
javadoc {
26-
failOnError = false
27-
title = "ObjectBox Java ${version} API"
28-
options.bottom = 'Available under the Apache License, Version 2.0 - <i>Copyright &#169; 2017-2020 <a href="http://objectbox.io/">ObjectBox Ltd</a>. All Rights Reserved.</i>'
29-
exclude("**/com/google/**")
26+
// Hide internal API from javadoc artifact.
3027
exclude("**/io/objectbox/Cursor.java")
3128
exclude("**/io/objectbox/KeyValueCursor.java")
3229
exclude("**/io/objectbox/ModelBuilder.java")
@@ -37,12 +34,40 @@ javadoc {
3734
exclude("**/io/objectbox/internal/**")
3835
exclude("**/io/objectbox/reactive/DataPublisherUtils.java")
3936
exclude("**/io/objectbox/reactive/WeakDataObserver.java")
37+
}
38+
39+
// Note: use packageJavadocForWeb to get as ZIP.
40+
// Note: the style changes only work if using JDK 10+.
41+
task javadocForWeb(type: Javadoc) {
42+
group = 'documentation'
43+
description = 'Builds Javadoc incl. objectbox-java-api classes with web tweaks.'
44+
4045
def srcApi = project(':objectbox-java-api').file('src/main/java/')
4146
if (!srcApi.directory) throw new GradleScriptException("Not a directory: ${srcApi}", null)
42-
source += srcApi
47+
// Hide internal API from javadoc artifact.
48+
def filteredSources = sourceSets.main.allJava.matching {
49+
exclude("**/io/objectbox/Cursor.java")
50+
exclude("**/io/objectbox/KeyValueCursor.java")
51+
exclude("**/io/objectbox/ModelBuilder.java")
52+
exclude("**/io/objectbox/Properties.java")
53+
exclude("**/io/objectbox/Transaction.java")
54+
exclude("**/io/objectbox/model/**")
55+
exclude("**/io/objectbox/ideasonly/**")
56+
exclude("**/io/objectbox/internal/**")
57+
exclude("**/io/objectbox/reactive/DataPublisherUtils.java")
58+
exclude("**/io/objectbox/reactive/WeakDataObserver.java")
59+
}
60+
source = filteredSources + srcApi
61+
62+
classpath = sourceSets.main.output + sourceSets.main.compileClasspath
63+
destinationDir = reporting.file("web-api-docs")
64+
65+
title = "ObjectBox Java ${version} API"
66+
options.bottom = 'Available under the Apache License, Version 2.0 - <i>Copyright &#169; 2017-2020 <a href="http://objectbox.io/">ObjectBox Ltd</a>. All Rights Reserved.</i>'
67+
4368
doLast {
4469
// Note: frequently check the vanilla stylesheet.css if values still match.
45-
def stylesheetPath = "$buildDir/docs/javadoc/stylesheet.css"
70+
def stylesheetPath = "$destinationDir/stylesheet.css"
4671

4772
// Primary background
4873
ant.replace(file: stylesheetPath, token: "#4D7A97", value: "#17A6A6")
@@ -68,6 +93,20 @@ javadoc {
6893
}
6994
}
7095

96+
task packageJavadocForWeb(type: Zip, dependsOn: javadocForWeb) {
97+
group = 'documentation'
98+
description = 'Packages Javadoc incl. objectbox-java-api classes with web tweaks as ZIP.'
99+
100+
archiveFileName = "objectbox-java-web-api-docs.zip"
101+
destinationDirectory = file("$buildDir/dist")
102+
103+
from reporting.file("web-api-docs")
104+
105+
doLast {
106+
println "Javadoc for web packaged to ${file("$buildDir/dist/objectbox-java-web-api-docs.zip")}"
107+
}
108+
}
109+
71110
task javadocJar(type: Jar, dependsOn: javadoc) {
72111
classifier = 'javadoc'
73112
from 'build/docs/javadoc'

objectbox-java/src/main/java/io/objectbox/model/PropertyFlags.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ private PropertyFlags() { }
7373
public static final int INDEX_HASH = 2048;
7474
/**
7575
* Index uses a 64 bit hash instead of the value
76-
* (recommended mostly for 64 bit machines with values longer >200 bytes; small values are faster with a 32 bit hash)
76+
* (recommended mostly for 64 bit machines with values longer than 200 bytes; small values are faster with a 32 bit hash)
7777
*/
7878
public static final int INDEX_HASH64 = 4096;
7979
/**
80-
* Unused yet: While our default are signed ints, queries & indexes need do know signing info.
80+
* Unused yet: While our default are signed ints, queries and indexes need do know signing info.
8181
* Note: Don't combine with ID (IDs are always unsigned internally).
8282
*/
8383
public static final int UNSIGNED = 8192;

objectbox-kotlin/build.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version= rootProject.version
44
buildscript {
55
ext.javadocDir = "$buildDir/docs/javadoc"
66
ext.kotlin_version = '1.3.31'
7-
ext.dokka_version = '0.9.18'
7+
ext.dokka_version = '0.10.0'
88

99
repositories {
1010
mavenCentral()
@@ -25,6 +25,17 @@ sourceCompatibility = 1.7
2525
dokka {
2626
outputFormat = 'html'
2727
outputDirectory = javadocDir
28+
29+
// Fix "Can't find node by signature": have to manually point to dependencies.
30+
// https://github.com/Kotlin/dokka/wiki/faq#dokka-complains-about-cant-find-node-by-signature-
31+
configuration{
32+
externalDocumentationLink {
33+
// Point to web javadoc for objectbox-java packages.
34+
url = new URL("https://objectbox.io/docfiles/java/current/")
35+
// Note: Using JDK 9+ package-list is now called element-list.
36+
packageListUrl = new URL(url, "element-list")
37+
}
38+
}
2839
}
2940

3041
task javadocJar(type: Jar, dependsOn: dokka) {

objectbox-kotlin/src/main/kotlin/io/objectbox/kotlin/Extensions.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ import io.objectbox.query.QueryBuilder
2626
import io.objectbox.relation.ToMany
2727
import kotlin.reflect.KClass
2828

29+
/** Shortcut for `BoxStore.boxFor(Entity::class.java)`. */
2930
inline fun <reified T> BoxStore.boxFor(): Box<T> = boxFor(T::class.java)
3031

32+
/** Shortcut for `BoxStore.boxFor(Entity::class.java)`. */
3133
@Suppress("NOTHING_TO_INLINE")
3234
inline fun <T : Any> BoxStore.boxFor(clazz: KClass<T>): Box<T> = boxFor(clazz.java)
3335

objectbox-rxjava/build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ dependencies {
1313
testCompile 'org.mockito:mockito-core:2.25.1'
1414
}
1515

16-
javadoc {
17-
failOnError = false
18-
title = "ObjectBox RxJava2 ${version} API"
19-
excludes = [] // Unfinished APIs if any
20-
options.bottom = 'Available under the Apache License, Version 2.0 - <i>Copyright &#169; 2018-2020 <a href="http://objectbox.io/">ObjectBox Ltd</a>. All Rights Reserved.</i>'
21-
}
22-
2316
task javadocJar(type: Jar, dependsOn: javadoc) {
2417
classifier = 'javadoc'
2518
from 'build/docs/javadoc'

0 commit comments

Comments
 (0)