This repository has been archived by the owner on Sep 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
154 lines (146 loc) · 6.75 KB
/
build.xml
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" encoding="UTF-8"?>
<project name="mismo-bindings" default="default">
<target name="default" description="builds the target that is default for this module" depends="init">
<antcall target="${module.target}" />
</target>
<target name="all-modules">
<antcall target="default" inheritall="false">
<param name="module.dir" location="${basedir}/modules/common" />
</antcall>
<antcall target="default" inheritall="false">
<param name="module.dir" location="${basedir}/modules/title" />
</antcall>
<antcall target="default" inheritall="false">
<param name="module.dir" location="${basedir}/modules/enveloping" />
</antcall>
</target>
<target name="jar" depends="compile">
<mkdir dir="${dist.dir}" />
<jar destfile="${jar.file}">
<fileset dir="${build.classes}" />
<manifest>
<attribute name="Project-Name" value="${ant.project.name}"/>
<attribute name="Project-WebSite" value="${project.website}"/>
<attribute name="Implementation-Version" value="${project.release.version}"/>
</manifest>
</jar>
</target>
<target name="compile" depends="compile-gen-src,compile-src,jibx-bind,compile-test" description="compiles Java sources to bytecode and copies resources" />
<target name="compile-gen-src" depends="init" description="compiles generated Java sources to bytecode and copies resources" if="exists.gen-src">
<copy todir="${build.classes}">
<!-- copy resources from source dir to bytecode dir -->
<fileset dir="${gen-src.dir}" excludes="**/*.java" />
</copy>
<javac destdir="${build.classes}" classpathref="build.classpath">
<src path="${gen-src.dir}" />
</javac>
<available property="exists.binding.xml" file="${build.classes}/${binding.xml}"/>
</target>
<target name="compile-src" depends="init" description="compiles Java sources to bytecode and copies resources" if="exists.src">
<copy todir="${build.classes}">
<!-- copy resources from source dir to bytecode dir -->
<fileset dir="${src.dir}" excludes="**/*.java" />
</copy>
<javac destdir="${build.classes}" classpathref="build.classpath">
<src path="${src.dir}" />
</javac>
</target>
<target name="compile-test" depends="init" description="compiles test Java sources to bytecode and copies resources" if="exists.gen-src">
<copy todir="${build.test-classes}">
<!-- copy resources from source dir to bytecode dir -->
<fileset dir="${test-src.dir}" excludes="**/*.java" />
</copy>
<javac destdir="${build.test-classes}">
<classpath>
<path refid="build.classpath" />
<pathelement path="${basedir}/tools/junit/junit.jar" />
</classpath>
<src path="${test-src.dir}" />
</javac>
</target>
<target name="init">
<!-- if module.dir property is not already set, it defaults to the current working dir -->
<property name="module.dir" location="${user.dir}" />
<!-- determine the relative path from ${basedir} to ${module.dir} -->
<pathconvert property="module.path" dirsep="/">
<path>
<pathelement location="${module.dir}" />
</path>
<map from="${basedir}" to="." />
</pathconvert>
<property name="dist.dir" location="${basedir}/dist" />
<property name="build.dir" location="${basedir}/build" />
<property name="build.classes" location="${build.dir}/${module.path}/classes" />
<property name="build.test-classes" location="${build.dir}/${module.path}/test-classes" />
<property name="src.dir" location="${module.dir}/src" />
<property name="gen-src.dir" location="${build.dir}/${module.path}/gen-src" />
<property name="test-src.dir" location="${module.dir}/test" />
<property file="${module.dir}/module.properties" />
<property file="${basedir}/project.properties" />
<echo>Building module: ${module.name} in path: ${module.path}</echo>
<path id="build.classpath">
<pathelement location="${build.classes}" />
<fileset dir="lib/java" includes="*.jar" />
</path>
<property name="jar.filename" location="${module.name}.jar" />
<property name="jar.file" location="${dist.dir}/${jar.filename}" />
<available property="exists.src" file="${src.dir}" />
<available property="exists.gen-src" file="${gen-src.dir}" />
<available property="exists.binding.xml" file="${build.classes}/${binding.xml}"/>
</target>
<!-- misc. targets (not always used) -->
<target name="dist" depends="init" description="removes all outputs of the build">
<zip destfile="${project.full.name}.zip">
<fileset dir="." includes="_readme.txt,build.xml,module.properties,project.properties">
<include name="dist/**"/>
<include name="doc/**"/>
<include name="lib/**"/>
<include name="modules/**"/>
</fileset>
</zip>
</target>
<target name="dist-clean" depends="clean" description="removes all outputs of the build">
<delete dir="${dist.dir}" />
</target>
<target name="clean" depends="init" description="removes intermediate outputs of the build">
<delete dir="${build.dir}" />
</target>
<target name="jibx-bind" depends="init" if="exists.binding.xml" description="runs JiBX binding compiler on the compiled bytecode">
<!-- JiBX binding compiler task definition -->
<taskdef name="jibx-bind" classname="org.jibx.binding.ant.CompileTask" classpath="tools/jibx/jibx-bind.jar;lib/java/jibx-run.jar" />
<jibx-bind binding="${build.classes}/${binding.xml}">
<classpath>
<pathelement path="${build.classes}" />
<path refid="build.classpath" />
</classpath>
</jibx-bind>
</target>
<target name="xsd2jibx" depends="init" if="xsd2jibx.grammars" description="generates JiBX code and bindings from XSD">
<java jar="tools/xsd2jibx/xsd2jibx.jar" fork="true" failonerror="true">
<classpath path="tools/xsd2jibx/*.jar" />
<arg line="-d ${gen-src.dir}" />
<arg line="-n ${binding.pkg}" />
<arg line="-p http://www.w3.org/2000/09/xmldsig#=com.sysdelphia.bindings.w3.xmldsig" />
<arg line="${xsd2jibx.grammars}" />
</java>
<available property="exists.gen-src" file="${gen-src.dir}" />
<available property="exists.binding.xml" file="${src.dir}/${binding.xml}" />
<delete>
<fileset dir="${gen-src.dir}">
<present targetdir="${src.dir}" />
</fileset>
</delete>
<touch file="${gen-src.dir}/xsd2jibx.touch" />
</target>
<target name="test-roundtrip" depends="init" description="Runs jibx's roundtrip test">
<java classname="org.jibx.extras.TestRoundtrip" fork="true" failonerror="true">
<classpath>
<pathelement path="${basedir}/build/modules/enveloping/classes"/>
<fileset dir="${basedir}/tools/jibx" includes="*.jar"/>
<path refid="build.classpath" />
</classpath>
<arg value="${module.test.roundtrip.class}" />
<arg value="${module.test.roundtrip.input.file}" />
</java>
</target>
</project>