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.
114 lines
3.2 KiB
114 lines
3.2 KiB
configurations { |
|
castor |
|
xjc |
|
jibx |
|
} |
|
dependencies { |
|
castor "org.codehaus.castor:castor-anttasks:1.4.1" |
|
jibx "org.jibx:jibx-bind:1.2.6" |
|
jibx "org.apache.bcel:bcel:6.0" |
|
xjc 'com.sun.xml.bind:jaxb-xjc:2.2.11' |
|
xjc 'javax.xml.bind:jaxb-api:2.2.11' |
|
xjc 'com.sun.xml.bind:jaxb-core:2.2.11' |
|
xjc 'com.sun.xml.bind:jaxb-impl:2.2.11' |
|
xjc 'javax.activation:activation:1.1.1' |
|
} |
|
|
|
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.8, target: 1.8, 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.8, target: 1.8, 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") |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
// JiBX compiler is currently not compatible with JDK 9 |
|
if (JavaVersion.current() == JavaVersion.VERSION_1_8) { |
|
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/**/*") |
|
} |
|
} |
|
} |
|
} |
|
} |
|
}
|
|
|