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

fix encoding issues in xjc code generation #5339

Merged
merged 1 commit into from
Sep 24, 2019
Merged
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
16 changes: 15 additions & 1 deletion buildSrc/src/main/groovy/org/jabref/build/xjc/XjcTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ class XjcTask extends DefaultTask {
private def bindingFile
private def outputDirectory
private String javaPackage
private String encoding
@Optional
private String arguments

@TaskAction
def generateClasses() {
project.mkdir(outputDirectory)
project.ant.xjc(destdir: outputDirectory, package: javaPackage) {
project.ant.xjc(destdir: outputDirectory, package: javaPackage, encoding: getEncoding()) {
schema(dir: schemaFile.getParent(), includes: schemaFile.getName())
if (bindingFile != null) {
binding(dir: bindingFile.getParent(), includes: bindingFile.getName())
Expand Down Expand Up @@ -62,6 +63,19 @@ class XjcTask extends DefaultTask {
updateOutput()
}

String getEncoding() {
if(encoding == null ) {
// use UTF-8 as default encoding
return "UTF-8"
} else {
return encoding
}
}

void setEncoding(String encoding) {
this.encoding = encoding
}

String getArguments() {
return arguments
}
Expand Down