From 39ed578162caf959bf5ec3b5107b84ca9a14f507 Mon Sep 17 00:00:00 2001 From: David Schlosnagle Date: Sun, 15 Aug 2021 15:13:45 -0400 Subject: [PATCH 1/2] JavaDoc uses UTF-8 encoding --- .../palantir/baseline/plugins/BaselineEncoding.java | 10 +++++++--- .../baseline/BaselineEncodingIntegrationTest.groovy | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineEncoding.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineEncoding.java index d7806cba5..b049d2591 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineEncoding.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineEncoding.java @@ -19,13 +19,17 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.tasks.compile.JavaCompile; +import org.gradle.api.tasks.javadoc.Javadoc; public final class BaselineEncoding implements Plugin { @Override public void apply(Project project) { - project.getTasks().withType(JavaCompile.class).configureEach(javaCompileTask -> { - javaCompileTask.getOptions().setEncoding("UTF-8"); - }); + project.getTasks() + .withType(JavaCompile.class) + .configureEach(javaCompileTask -> javaCompileTask.getOptions().setEncoding("UTF-8")); + project.getTasks() + .withType(Javadoc.class) + .configureEach(javadocTask -> javadocTask.getOptions().setEncoding("UTF-8")); } } diff --git a/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineEncodingIntegrationTest.groovy b/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineEncodingIntegrationTest.groovy index 94bde79fc..0c67645ff 100644 --- a/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineEncodingIntegrationTest.groovy +++ b/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineEncodingIntegrationTest.groovy @@ -55,6 +55,10 @@ class BaselineEncodingIntegrationTest extends AbstractPluginTest { def javaFile = ''' package test; + + /** + * Test source file encoding with UTF-8 ☃ Javadoc. + */ public class Test { private static final String VALUE = "•"; } From 83c3da9e0c79ebfa2e7b8411346f0bb622dff49d Mon Sep 17 00:00:00 2001 From: svc-changelog Date: Sun, 15 Aug 2021 19:16:38 +0000 Subject: [PATCH 2/2] Add generated changelog entries --- changelog/@unreleased/pr-1879.v2.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/@unreleased/pr-1879.v2.yml diff --git a/changelog/@unreleased/pr-1879.v2.yml b/changelog/@unreleased/pr-1879.v2.yml new file mode 100644 index 000000000..fd47afa20 --- /dev/null +++ b/changelog/@unreleased/pr-1879.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: JavaDoc uses UTF-8 encoding by default + links: + - https://github.com/palantir/gradle-baseline/pull/1879