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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
|
<!--
**********************************************************************
Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
This copy of Ice is licensed to you under the terms described in the
ICE_LICENSE file included in this distribution.
**********************************************************************
-->
<project name="common" basedir=".">
<property environment="env"/>
<target name="init" depends="config-init, task-init">
<!-- Create the time stamp -->
<tstamp/>
</target>
<!-- Load build configuration properties -->
<property file="${top.dir}/config/build.properties"/>
<!-- Check which Ice language mapping we're supposed to build, "java2" or "java5" -->
<condition property="ice.mapping" value="java5">
<not><isset property="ice.mapping"/></not>
</condition>
<fail message="Invalid ${ice.mapping} value specified in build.properties.">
<condition>
<and>
<not><equals arg1="${ice.mapping}" arg2="java2" trim="true"/></not>
<not><equals arg1="${ice.mapping}" arg2="java5" trim="true"/></not>
</and>
</condition>
</fail>
<condition property="java2">
<equals arg1="${ice.mapping}" arg2="java2"/>
</condition>
<!-- Use the global metadata "java:java2" when using java2 mapping -->
<condition property="java2metadata" value="java:java2" else="">
<isset property="java2"/>
</condition>
<!-- Use -Xlint when requested -->
<condition property="javac.lint" value="-Xlint:${lint}" else="-Xlint:none">
<isset property="lint"/>
</condition>
<!-- Default build suffix is empty. This can be defined by build
scripts to build the jars and classes file in other
directories than the default one. This is useful to build
both the Java2 and Java5 mapping with the same source tree.
-->
<property name="build.suffix" value=""/>
<!-- Commonly needed properties -->
<property name="class.dir" value="classes${build.suffix}"/>
<property name="generated.dir" value="generated${build.suffix}"/>
<!-- We use pathconvert to ensure that ice.top.dir is relative to the path of the build.xml
file insead of the current working directory. -->
<pathconvert property="ice.top.dir">
<path location="${top.dir}"/>
</pathconvert>
<condition property="slice.translator" value="slice2java.exe" else="slice2java">
<os family="windows"/>
</condition>
<fail message="Unable to find ${slice.translator} in ${ice.home}, please verify ice.home is properly configured and Ice is correctly installed.">
<condition>
<and>
<isset property="ice.home"/>
<not><available file="${ice.home}/bin/${slice.translator}"/></not>
</and>
</condition>
</fail>
<fail message="Unable to find ${slice.translator} in ${env.ICE_HOME}, please verify ICE_HOME is properly configured and Ice is correctly installed.">
<condition>
<and>
<not><isset property="ice.home"/></not>
<isset property="env.ICE_HOME"/>
<not><available file="${env.ICE_HOME}/bin/${slice.translator}"/></not>
</and>
</condition>
</fail>
<condition property="ice.bin.dist">
<or>
<equals arg1="${use.bin.dist}" arg2="yes"/>
<equals arg1="${env.USE_BIN_DIST}" arg2="yes"/>
</or>
</condition>
<!-- First, check if we're building a source distribution. -->
<condition property="ice.dir" value="${ice.top.dir}/..">
<and>
<!-- Don't just look for ${ice.top.dir}/../java - we want to make sure we are really
in a source distribution. -->
<available file="${ice.top.dir}/../java/src/Ice/Util.java"/>
<not><isset property="ice.bin.dist"/></not>
</and>
</condition>
<!-- When building a source distribution, we allow using either the
translators from a binary distribution or the local translators, -->
<condition property="ice.cpp.dir" value="${ice.home}">
<and>
<isset property="ice.dir"/>
<not><isset property="ice.cpp.dir"/></not>
<available file="${ice.home}/bin/${slice.translator}"/>
</and>
</condition>
<condition property="ice.cpp.dir" value="${env.ICE_HOME}" else="${ice.dir}/cpp">
<and>
<isset property="ice.dir"/>
<not><isset property="ice.cpp.dir"/></not>
<available file="${env.ICE_HOME}/bin/${slice.translator}"/>
</and>
</condition>
<condition property="ice.warn.duplicate.translator">
<and>
<isset property="ice.cpp.dir"/>
<not><equals arg1="${ice.cpp.dir}" arg2="${ice.dir}/cpp"/></not>
<available file="${ice.dir}/cpp/bin/${slice.translator}"/>
</and>
</condition>
<condition property="ice.src.dist">
<and>
<isset property="ice.dir"/>
</and>
</condition>
<!-- Then, check if we're building against a binary distribution. -->
<condition property="ice.dir" value="${ice.home}">
<and>
<not><isset property="ice.dir"/></not>
<isset property="ice.home"/>
</and>
</condition>
<condition property="ice.dir" value="${env.ICE_HOME}">
<and>
<not><isset property="ice.dir"/></not>
<isset property="env.ICE_HOME"/>
</and>
</condition>
<condition property="ice.dir" value="${ice.top.dir}">
<and>
<not><isset property="ice.dir"/></not>
<available file="${ice.top.dir}/bin/${slice.translator}"/>
</and>
</condition>
<condition property="ice.dir" value="/usr">
<and>
<not><isset property="ice.dir"/></not>
<available file="/usr/bin/${slice.translator}"/>
</and>
</condition>
<condition property="ice.dir" value="C:\Ice-${ice.version}">
<and>
<os family="windows"/>
<not><isset property="ice.dir"/></not>
<available file="C:\Ice-${ice.version}\bin\${slice.translator}"/>
</and>
</condition>
<condition property="ice.dir" value="/opt/Ice-${ice.version}">
<and>
<not><os family="windows"/></not>
<not><isset property="ice.dir"/></not>
<available file="/opt/Ice-${ice.version}/bin/${slice.translator}"/>
</and>
</condition>
<condition property="ice.bin.dist">
<and>
<not><isset property="ice.src.dist"/></not>
<isset property="ice.dir"/>
</and>
</condition>
<fail message="Unable to find a valid Ice distribution, please verify ICE_HOME is properly configured and Ice is correctly installed.">
<condition>
<not><or>
<isset property="ice.src.dist"/>
<isset property="ice.bin.dist"/>
</or></not>
</condition>
</fail>
<!-- Set ice.home for the ant Slice tasks or ensure it's properly set by the user. -->
<condition property="ice.home" value="${ice.dir}">
<isset property="ice.bin.dist"/>
</condition>
<condition property="ice.home" value="${ice.cpp.dir}">
<isset property="ice.src.dist"/>
</condition>
<!-- Set db.jar.file to the path name of the Berkeley DB JAR file, but only if it's
not already present in the class path. -->
<condition property="db.jar.file" value="/usr/share/java/db-${db.version}.jar">
<and>
<not><available classname="com.sleepycat.db.Database"/></not>
<available file="/usr/share/java/db-${db.version}.jar"/>
</and>
</condition>
<condition property="db.jar.file" value="/opt/Ice-${ice.version}/lib/db.jar">
<and>
<not><os family="windows"/></not>
<not><isset property="db.jar.file"/></not>
<not><available classname="com.sleepycat.db.Database"/></not>
<available file="/opt/Ice-${ice.version}/lib/db.jar"/>
</and>
</condition>
<path id="db.classpath">
<pathelement path="${db.jar.file}"/>
</path>
<target name="config-init-warn" if="ice.warn.duplicate.translator">
<echo message="Found ${slice.translator} in both ${ice.cpp.dir}/bin and ${ice.dir}/cpp/bin, ${ice.cpp.dir}/bin/${slice.translator} will be used!" level="warning"/>
</target>
<target name="config-init" depends="config-init-warn">
<!-- Set slice.dir to the directory containing the Slice files. -->
<condition property="slice.dir" value="/usr/share/Ice-${ice.version}/slice" else="${ice.dir}/slice">
<equals arg1="${ice.dir}" arg2="/usr"/>
</condition>
<!-- Set ice.classpath with the distribution Ice.jar file -->
<condition property="dist.lib.dir" value="${ice.dir}/java/lib${build.suffix}">
<isset property="ice.src.dist"/>
</condition>
<condition property="dist.lib.dir" value="${ice.dir}/lib">
<and>
<isset property="ice.bin.dist"/>
<not><equals arg1="${ice.dir}" arg2="/usr"/></not>
</and>
</condition>
<condition property="dist.lib.dir" value="/usr/share/java">
<and>
<isset property="ice.bin.dist"/>
<equals arg1="${ice.dir}" arg2="/usr"/>
</and>
</condition>
<condition property="dist.jar.file" value="${dist.lib.dir}/Ice-java2-${ice.version}.jar">
<and>
<available file="${dist.lib.dir}/Ice-java2-${ice.version}.jar"/>
<isset property="java2"/>
</and>
</condition>
<condition property="dist.jar.file" value="${dist.lib.dir}/java2/Ice.jar">
<and>
<not><isset property="dist.jar.file"/></not>
<available file="${dist.lib.dir}/java2/Ice.jar"/>
<isset property="java2"/>
</and>
</condition>
<condition property="dist.jar.file" value="${dist.lib.dir}/Ice-${ice.version}.jar">
<and>
<not><isset property="dist.jar.file"/></not>
<available file="${dist.lib.dir}/Ice-${ice.version}.jar"/>
</and>
</condition>
<condition property="dist.jar.file" value="${dist.lib.dir}/Ice.jar">
<and>
<not><isset property="dist.jar.file"/></not>
<available file="${dist.lib.dir}/Ice.jar"/>
</and>
</condition>
<path id="ice.classpath">
<fileset file="${dist.jar.file}"/>
</path>
<condition property="certs.dir" value="${ice.top.dir}/certs" else="${ice.top.dir}/../certs">
<available file="${ice.top.dir}/certs/client.jks"/>
</condition>
</target>
<!-- Install the Slice ant tasks. -->
<target name="task-init">
<condition property="task.jar.file" value="${dist.lib.dir}/ant-ice-${ice.version}.jar">
<available file="${dist.lib.dir}/ant-ice-${ice.version}.jar"/>
</condition>
<condition property="task.jar.file" value="${dist.lib.dir}/ant-ice.jar">
<and>
<not><isset property="task.jar.file"/></not>
<available file="${dist.lib.dir}/ant-ice.jar"/>
</and>
</condition>
<taskdef name="slice2java" classpath="${task.jar.file}" classname="Slice2JavaTask"/>
<taskdef name="slice2freezej" classpath="${task.jar.file}" classname="Slice2FreezeJTask" />
</target>
</project>
|