Skip to content

Commit

Permalink
Merge pull request #5339 from JabRef/fix-xjc-encoding
Browse files Browse the repository at this point in the history
fix encoding issues in xjc code generation
  • Loading branch information
Siedlerchr authored Sep 24, 2019
2 parents 9cc7ce7 + 1ab09a8 commit caafef1
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit caafef1

Please sign in to comment.