Skip to content

Commit

Permalink
Fixing the --release flag usage for javac (opensearch-project#2343)
Browse files Browse the repository at this point in the history
* Fixing the --release flag usage for javac

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>

* Fixing the --html5 flag usage for javadoc

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta committed Mar 4, 2022
1 parent 729bc43 commit 1c7a2b8
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ public static void configureCompile(Project project) {
// workaround for https://github.com/gradle/gradle/issues/14141
compileTask.getConventionMapping().map("sourceCompatibility", () -> java.getSourceCompatibility().toString());
compileTask.getConventionMapping().map("targetCompatibility", () -> java.getTargetCompatibility().toString());
compileOptions.getRelease().set(releaseVersionProviderFromCompileTask(project, compileTask));
// The '--release is available from JDK-9 and above
if (BuildParams.getRuntimeJavaVersion().compareTo(JavaVersion.VERSION_1_8) > 0) {
compileOptions.getRelease().set(releaseVersionProviderFromCompileTask(project, compileTask));
}
});
// also apply release flag to groovy, which is used in build-tools
project.getTasks().withType(GroovyCompile.class).configureEach(compileTask -> {
Expand Down Expand Up @@ -267,7 +270,9 @@ private static void configureJavadoc(Project project) {
* that the default will change to html5 in the future.
*/
CoreJavadocOptions javadocOptions = (CoreJavadocOptions) javadoc.getOptions();
javadocOptions.addBooleanOption("html5", true);
if (BuildParams.getRuntimeJavaVersion().compareTo(JavaVersion.VERSION_1_8) > 0) {
javadocOptions.addBooleanOption("html5", true);
}
});

TaskProvider<Javadoc> javadoc = project.getTasks().withType(Javadoc.class).named("javadoc");
Expand Down

0 comments on commit 1c7a2b8

Please sign in to comment.