You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
3.6 KiB
132 lines
3.6 KiB
configurations { |
|
castor |
|
xjc |
|
xmlbeans |
|
jibx |
|
} |
|
dependencies { |
|
castor "org.codehaus.castor:castor-anttasks:1.4.1" |
|
jibx "org.jibx:jibx-bind:1.2.6" |
|
xjc "com.sun.xml.bind:jaxb-xjc:2.1.17" |
|
xmlbeans "org.apache.xmlbeans:xmlbeans:2.6.0" |
|
} |
|
|
|
ext.genSourcesDir = "${buildDir}/generated-sources" |
|
ext.flightSchema = "${projectDir}/src/test/resources/org/springframework/oxm/flight.xsd" |
|
|
|
task genCastor { |
|
def orderSchema = "${projectDir}/src/test/resources/org/springframework/oxm/order.xsd" |
|
def castorBuilderProperties = "${projectDir}/src/test/castor/castorbuilder.properties" |
|
|
|
ext.sourcesDir = "${genSourcesDir}/castor" |
|
ext.classesDir = "${buildDir}/classes/castor" |
|
|
|
inputs.files flightSchema, orderSchema, castorBuilderProperties |
|
outputs.dir classesDir |
|
|
|
doLast() { |
|
project.ant { |
|
taskdef name: "castor", classname: "org.castor.anttask.CastorCodeGenTask", |
|
classpath: configurations.castor.asPath |
|
mkdir(dir: sourcesDir) |
|
mkdir(dir: classesDir) |
|
|
|
castor(types: "j2", warnings: false, file: flightSchema, todir: sourcesDir, |
|
package: "org.springframework.oxm.castor", properties: castorBuilderProperties) |
|
|
|
castor(types: "j2", warnings: false, file: orderSchema, todir: sourcesDir, |
|
package: "org.springframework.oxm.castor", properties: castorBuilderProperties) |
|
|
|
javac(destdir: classesDir, source: 1.6, target: 1.6, debug: true, |
|
debugLevel: "lines,vars,source", classpath: configurations.castor.asPath) { |
|
src(path: sourcesDir) |
|
include(name: "**/*.java") |
|
include(name: "*.java") |
|
} |
|
|
|
copy(todir: classesDir) { |
|
fileset(dir: sourcesDir, erroronmissingdir: false) { |
|
exclude(name: "**/*.java") |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
task genJaxb { |
|
ext.sourcesDir = "${genSourcesDir}/jaxb" |
|
ext.classesDir = "${buildDir}/classes/jaxb" |
|
|
|
inputs.files flightSchema |
|
outputs.dir classesDir |
|
|
|
doLast() { |
|
project.ant { |
|
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask", |
|
classpath: configurations.xjc.asPath |
|
mkdir(dir: sourcesDir) |
|
mkdir(dir: classesDir) |
|
|
|
xjc(destdir: sourcesDir, schema: flightSchema, |
|
package: "org.springframework.oxm.jaxb.test") { |
|
produces(dir: sourcesDir, includes: "**/*.java") |
|
} |
|
|
|
javac(destdir: classesDir, source: 1.6, target: 1.6, debug: true, |
|
debugLevel: "lines,vars,source", |
|
classpath: configurations.castor.asPath) { |
|
src(path: sourcesDir) |
|
include(name: "**/*.java") |
|
include(name: "*.java") |
|
} |
|
|
|
copy(todir: classesDir) { |
|
fileset(dir: sourcesDir, erroronmissingdir: false) { |
|
exclude(name: "**/*.java") |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
task genXmlbeans { |
|
ext.classesDir = "${buildDir}/classes/xmlbeans" |
|
|
|
inputs.files flightSchema |
|
outputs.dir classesDir |
|
|
|
doLast() { |
|
project.ant { |
|
taskdef name: "xmlbeans", |
|
classname: "org.apache.xmlbeans.impl.tool.XMLBean", |
|
classpath: configurations.xmlbeans.asPath |
|
|
|
xmlbeans(classgendir: classesDir, schema: flightSchema, |
|
compiler: "modern", verbose: "false", |
|
classpath: configurations.xmlbeans.asPath) |
|
} |
|
} |
|
} |
|
|
|
// add jibx binding to the normal test compilation process |
|
// INCOMPATIBLE WITH OPENJDK 8 b89+ |
|
def jibxEnabled = project.properties.get("testGroups")?.toLowerCase()?.split(",")?.contains("custom_compilation") |
|
if (jibxEnabled) { |
|
compileTestJava { |
|
def bindingXml = "${projectDir}/src/test/resources/org/springframework/oxm/jibx/binding.xml" |
|
|
|
doLast() { |
|
project.ant { |
|
taskdef(name: "jibx", |
|
classname: "org.jibx.binding.ant.CompileTask", |
|
classpath: configurations.jibx.asPath) |
|
|
|
jibx(verbose: true, load: true, binding: bindingXml) { |
|
classpathset(dir: sourceSets.test.output.classesDir) { |
|
include(name: "**/jibx/**/*") |
|
} |
|
} |
|
} |
|
} |
|
} |
|
}
|
|
|