Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x: Javadoc space cleanup #6005

Merged
merged 3 commits into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,4 @@ if (rootProject.hasProperty("releaseMode")) {
}
}

apply from: file("gradle/javadoc_cleanup.gradle")
30 changes: 30 additions & 0 deletions gradle/javadoc_cleanup.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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'));
}

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</a>\\s{4,}", "@NonNull</a> ");

// lots of spaces after the @Nullable annotations
fileContents = fileContents.replaceAll("@Nullable</a>\\s{4,}", "@Nullable</a> ");

file.setText(fileContents, 'UTF-8');
}

javadocJar.dependsOn javadocCleanup
build.dependsOn javadocCleanup