summaryrefslogtreecommitdiff
path: root/build.xml
blob: 81bfea30511bf032fe1c36c588877a9b1d1a6859 (plain)
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
155
156
157
158
159
160
161
162
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="release-build" name="cristal">
	<!--===================================================================-->
	<!-- Global properties                                                 -->
	<!-- NOTE: Ant will automatically will add all jar files to the        -->
	<!-- classpath from the $(ANT_HOME)/lib directory. In cristal2         -->
	<!-- setup this directories are equal to the cristal2/lib              -->
	<!-- directory which eliminates thecalculation of classpath for        -->
	<!-- the most of the 'javac' tasks                                     -->
	<!--===================================================================-->
	<property name="name" value="cristal2"/>
	<property name="version" value="1.0"/>
	<!--===================================================================-->
	<!--   Directories                                                     -->
	<!--===================================================================-->
	<property name="src.dir" value="source"/>
	<property name="idls.dir" value="${src.dir}/idls"/>
	<property name="c2k.dir" value="com/c2kernel"/>
	<property name="bin.dir" value="bin"/>
	<property name="lib.dir" value="lib"/>
	<property name="docs.dir" value="doc"/>
	<property name="dist.dir" value="dist"/>	
	<property name="build.dir" value="build"/>
	<property name="resource.dir" value="resources"/>
	<!--===================================================================-->
	<!--       Build Directories                                           -->
	<!--===================================================================-->
	<property name="build.generated" value="${build.dir}/generated"/>
	<property name="build.classes" value="${build.dir}/classes"/>
	<property name="build.javadoc" value="${build.dir}/docs"/>
	<property name="build.lib" value="${build.dir}/lib"/>
	<!--===================================================================-->
	<!--                Global javacc attributes                           -->
	<!--===================================================================-->
	<property name="debug" value="true"/>
	<property name="deprecation" value="false"/>
	<property name="optimize" value="true"/>
	<property name="junit.fork" value="false"/>
    <path id="c2classpath">
    	<fileset dir="${lib.dir}" includes="*.jar" />
        <fileset dir="${build.classes}" />
    </path>
	<!-- ==================================================================-->
	<!--            The pattern for the support files that need            -->
	<!--                to be copied when compiling classes                -->
	<!-- ==================================================================-->
	<patternset id="resource.files">
		<include name="boot/**/*.txt"/>
		<include name="boot/**/*.xml"/>
		<include name="schemas/*.xsd"/>
		<include name="mapFiles/*"/>
		<include name="textFiles/*.*"/>
		<include name="images/**/*.gif"/>
		<include name="images/**/*.jpg"/>		
		<include name="images/**/*.png"/>
	</patternset>
		
	<!--===================================================================-->
	<!--       Prepare the build (takes the timestamp see: Ant1.3 docs)    -->
	<!--===================================================================-->
	<target name="prepare">
		<tstamp/>
	</target>
	<!--===================================================================-->
	<!--       Create directories required to build                        -->
	<!--===================================================================-->
	<target name="build-dirs">
		<mkdir dir="${build.generated}"/>
		<mkdir dir="${build.classes}"/>
		<mkdir dir="${build.lib}"/>
	</target>
	
	<target name="clean" description="cleans up the build directories">
		<delete dir="${build.dir}"/>
	</target>	
	<!--===================================================================-->
	<!-- Builds cristal2 completly calling all necessary 'build-*' targets -->
	<!--===================================================================-->
	<target name="release-build" depends="build-all" description="compiles cristal"/>
	<!--===================================================================-->
	<!--    Builds cristal2 cleanly                                        -->
	<!--===================================================================-->
	<target name="rebuild" depends="clean, release-build" description="deletes and recompiles the whole of cristal2"/>
	<!--===================================================================-->
	<!--    Jars 														   -->
	<!--===================================================================-->
	<target name="jars" depends="c2k-jar" description="creates the kernel and domain jars"/>
	<target name="c2k-jar" depends="build-c2k" description="Compile Kernel jar">
		<jar basedir="${build.classes}" includes="${c2k.dir}/**" jarfile="${build.lib}/c2kernel.jar"/>
	</target>
	<target name="clean-jars" depends="clean, jars" description="Builds fresh jars"/>
	<!--===================================================================-->
	<!--    Compile everything                                             -->
	<!--===================================================================-->
	<target name="build-all" depends="build-c2k"/>
	<!--===================================================================-->
	<!--    Builds com.c2kernel packages                                    -->
	<!--===================================================================-->
	<target name="build-c2k" depends="build-idls, resources" description="build com.c2kernel packages">
		<javac classpath="${build.classes}" debug="${debug}" deprecation="${deprecation}" destdir="${build.classes}" includes="${c2k.dir}/**" optimize="${optimize}" srcdir="${src.dir}" includeantruntime="false">
			<classpath>
				<path refid="c2classpath"/>
			</classpath>
		</javac>
	</target>
	<!--===================================================================-->
	<!--    Assembles cristal2 resources                                  -->
	<!--===================================================================-->
	<target name="resources" depends="prepare, build-dirs" description="Moves all resources to the build directory for the Resource class to read">
		<mkdir dir="${build.classes}/com/c2kernel/utils/resources"/>
		<copy todir="${build.classes}/com/c2kernel/utils/resources">
			<fileset dir="${resource.dir}">
				<patternset refid="resource.files"/>
			</fileset>
		</copy>
	</target>
	
	<!--===================================================================-->
	<!--    Creates javadoc for the complete CRISTAL2                      -->
	<!--===================================================================-->
	<target name="c2k-doc" description="Creates javadoc for the kernel" depends="prepare, build-dirs">
		<mkdir dir="${build.javadoc}"/>
		<javadoc author="true" 
			bottom="Copyright (C) 2000-2011 CRISTAL Consortium. All Rights Reserved." destdir="${build.javadoc}" doctitle="Cristal 2 Kernel" packagenames="com.c2kernel.*" sourcepath="${src.dir};${build.generated}" version="true" windowtitle="Cristal 2 Kernel">
			<group packages="com.c2kernel" title="Cristal2 Kernel"/>
		</javadoc>
	</target>

	<!--===================================================================-->
	<!--    Compile IDLs                                                   -->
	<!--===================================================================-->
	<target name="idls-check">
		<uptodate property="idls.notrequired" targetfile="${build.generated}/com/c2kernel/entity/ItemPOA.java">
			<srcfiles dir="${idls.dir}" includes="**/*.idl"/>
		</uptodate>
	</target>
	<target name="gen-idls" depends="prepare, build-dirs, idls-check" description="generate java from idls" unless="idls.notrequired">
		<echo message="Starting compiling idls."/>
		<apply dir="${idls.dir}/c2kernel" executable="idlj" failonerror="true">
			<arg value="-v"/>			
			<arg value="-fall"/>
			<arg value="-pkgPrefix"/>
			<arg value="entity"/>
			<arg value="com.c2kernel"/>
			<arg value="-pkgPrefix"/>
			<arg value="common"/>
			<arg value="com.c2kernel"/>			
			<arg value="-td"/>
			<arg value="${basedir}/${build.generated}"/>
			<fileset dir="${idls.dir}/c2kernel">
				<include name="*.idl"/>
			</fileset>
		</apply>
		<echo message="Finished compiling idls."/>
	</target>
	<!--===================================================================-->
	<!--       Compile Java code generated by java2idl                     -->
	<!--===================================================================-->
	<target name="build-idls" depends="gen-idls" description="compile idl generated java code">
		<javac debug="${debug}" deprecation="${deprecation}" destdir="${build.classes}" optimize="${optimize}" srcdir="${build.generated}" includeantruntime="false"/>
	</target>
</project>