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

JavaDoc uses UTF-8 encoding #1879

Merged
merged 2 commits into from
Aug 15, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
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