Skip to content

Commit 8a28169

Browse files
authored
2.x: Javadoc space cleanup (#6005)
* 2.x: Remove excessive whitespaces from generated javadocs on build * Fix html before javadocJar, fix other space patterns * Fix replay subject/processor html
1 parent fefcfed commit 8a28169

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,4 @@ if (rootProject.hasProperty("releaseMode")) {
369369
}
370370
}
371371

372+
apply from: file("gradle/javadoc_cleanup.gradle")

gradle/javadoc_cleanup.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// remove the excessive whitespaces between method arguments in the javadocs
2+
task javadocCleanup(dependsOn: "javadoc") doLast {
3+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Flowable.html'));
4+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Observable.html'));
5+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Single.html'));
6+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Maybe.html'));
7+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Completable.html'));
8+
9+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/flowables/ConnectableFlowable.html'));
10+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/observables/ConnectableObservable.html'));
11+
12+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/subjects/ReplaySubject.html'));
13+
fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/processors/ReplayProcessor.html'));
14+
}
15+
16+
def fixJavadocFile(file) {
17+
println("Cleaning up: " + file);
18+
String fileContents = file.getText('UTF-8')
19+
20+
// lots of spaces after the previous method argument
21+
fileContents = fileContents.replaceAll(",\\s{4,}", ",\n ");
22+
23+
// lots of spaces after the @NonNull annotations
24+
fileContents = fileContents.replaceAll("@NonNull</a>\\s{4,}", "@NonNull</a> ");
25+
26+
// lots of spaces after the @Nullable annotations
27+
fileContents = fileContents.replaceAll("@Nullable</a>\\s{4,}", "@Nullable</a> ");
28+
29+
file.setText(fileContents, 'UTF-8');
30+
}
31+
32+
javadocJar.dependsOn javadocCleanup
33+
build.dependsOn javadocCleanup

0 commit comments

Comments
 (0)