diff --git a/build.gradle b/build.gradle index f3f16d4eb4..d39826e76d 100644 --- a/build.gradle +++ b/build.gradle @@ -369,3 +369,4 @@ if (rootProject.hasProperty("releaseMode")) { } } +apply from: file("gradle/javadoc_cleanup.gradle") diff --git a/gradle/javadoc_cleanup.gradle b/gradle/javadoc_cleanup.gradle new file mode 100644 index 0000000000..32db33b963 --- /dev/null +++ b/gradle/javadoc_cleanup.gradle @@ -0,0 +1,33 @@ +// remove the excessive whitespaces between method arguments in the javadocs +task javadocCleanup(dependsOn: "javadoc") doLast { + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Flowable.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Observable.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Single.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Maybe.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/Completable.html')); + + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/flowables/ConnectableFlowable.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/observables/ConnectableObservable.html')); + + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/subjects/ReplaySubject.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/processors/ReplayProcessor.html')); +} + +def fixJavadocFile(file) { + println("Cleaning up: " + file); + String fileContents = file.getText('UTF-8') + + // lots of spaces after the previous method argument + fileContents = fileContents.replaceAll(",\\s{4,}", ",\n "); + + // lots of spaces after the @NonNull annotations + fileContents = fileContents.replaceAll("@NonNull\\s{4,}", "@NonNull "); + + // lots of spaces after the @Nullable annotations + fileContents = fileContents.replaceAll("@Nullable\\s{4,}", "@Nullable "); + + file.setText(fileContents, 'UTF-8'); +} + +javadocJar.dependsOn javadocCleanup +build.dependsOn javadocCleanup \ No newline at end of file