Skip to content

Commit

Permalink
JavaDoc uses UTF-8 encoding (#1879)
Browse files Browse the repository at this point in the history
JavaDoc uses UTF-8 encoding by default
  • Loading branch information
schlosna authored Aug 15, 2021
1 parent 26ba020 commit 42e1597
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-1879.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: JavaDoc uses UTF-8 encoding by default
links:
- https://github.com/palantir/gradle-baseline/pull/1879
Original file line number Diff line number Diff line change
Expand Up @@ -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<Project> {

@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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "•";
}
Expand Down

0 comments on commit 42e1597

Please sign in to comment.