forked from spring-projects/spring-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oxm.gradle
130 lines (108 loc) · 3.46 KB
/
oxm.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
configurations {
castor
xjc
xmlbeans
jibx
}
dependencies {
castor "org.codehaus.castor:castor-anttasks:1.2"
castor "velocity:velocity:1.5"
xjc "com.sun.xml.bind:jaxb-xjc:2.1.7"
xmlbeans "org.apache.xmlbeans:xmlbeans:2.4.0"
jibx "org.jibx:jibx-bind:1.2.3"
jibx "bcel:bcel:5.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.5, target: 1.5, 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.5, target: 1.5, 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
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/**/*")
}
}
}
}
}