1<!-- see readme.txt --> 2 3 4<project name="CLDR" default="util" basedir="."> 5 <target name="init"> 6 <tstamp /> 7 <property name="src.dir" value="." /> 8 <property name="build.dir" value="classes" /> 9 <property name="libs.dir" value="libs" /> 10 <property name="jar.file" value="cldr.jar" /> 11 <property name="jarSrc.file" value="cldr-src.jar" /> 12 <property name="jarDocs.file" value="cldr-docs.jar" /> 13 <property name="doc.dir" value="doc" /> 14 <property name="doc.params" value="" /> 15 <!-- Load local definitions from an optional build.properties file, if 16 available. build.properties is NOT checked into CVS. --> 17 <property file="build.properties" /> 18 <!-- Load environment variables --> 19 <property environment="env" /> 20 21 <path id="build.classpath"> 22 <pathelement path="${build.dir}" /> 23 <pathelement path="${libs.dir}" /> 24 </path> 25 26 <property name="CLDR_TOOLS" value="." /> <!-- this is cldr-tools --> 27 <property name="CLDR_DIR" value="${env.CLDR_DIR}" /> 28 <property file="${CLDR_TOOLS}/cldr-tools.properties" /> 29 <property name="JVM_OPTIONS" 30 value="-DCLDR_DIR=${CLDR_DIR} -DDEBUG=false -Dverbose=false" /> 31 <!-- JVM_EXTRA_OPTIONS might be resolved in the next priority order: 32 1) System property JVM_EXTRA_OPTIONS specified by ant command arg: ant -DJVM_EXTRA_OPTIONS=xxx <target> 33 2) JVM_EXTRA_OPTIONS=xxx in build.properties 34 3) Environment variable - JVM_EXTRA_OPTIONS=xxx 35 4) Final fallback - "-Xmx6g" below --> 36 <property name="env.JVM_EXTRA_OPTIONS" value="-Xmx6g" /> 37 <property name="JVM_EXTRA_OPTIONS" value="${env.JVM_EXTRA_OPTIONS}" /> 38 <property name="jvm_options" value="${JVM_OPTIONS} ${JVM_EXTRA_OPTIONS}" /> 39 40 <property name="tooltmp.dir" value="tmp" /> 41 42 <mkdir dir="${build.dir}" /> 43 44 <path id="project.class.path"> 45 <pathelement path="${java.class.path}/" /> 46 <pathelement path="${build.dir}" /> 47 <fileset dir="${libs.dir}" includes="*.jar" /> <!-- unittest local --> 48 </path> 49 <echo message="java home: ${java.home}" /> 50 <echo message="java version: ${java.version}" /> 51 <echo message="jvm_options: ${jvm_options}" /> 52 <echo message="ant java version: ${ant.java.version}" /> 53 <echo message="${ant.version}" /> 54 <echo message="java.class.path: ${java.class.path}/" /> 55 <echo message="java.class.path: ${java.class.path}/" /> 56 <echo message="build.dir: ${build.dir}" /> 57 </target> 58 59 <!-- build everything but dist-related stuff --> 60 <target name="all" depends="util,api,ant-plugin,tool,posix,icu,json,test" 61 description="build all primary targets" /> 62 <target name="ant-plugin" depends="init" description="build utility classes"> 63 <javac includeantruntime="false" includes="org/unicode/cldr/ant/*.java" 64 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 65 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 66 deprecation="off" encoding="UTF-8" /> 67 </target> 68 <!-- WARNING: The "util" target actually depends upon the "tool" target at runtime via 69 CLDRPaths and ToolConstants. This only appears to work when building this target 70 because Ant does not do any kind of source isolation during builds, so it just 71 builds all the transitive dependencies anyway. 72 --> 73 <target name="util" depends="init" description="build utility classes"> 74 <javac includeantruntime="false" 75 includes="org/unicode/cldr/draft/**/*.java org/unicode/cldr/util/**/*.java com/**/*.java" 76 excludes="**/CVS/**/* org/unicode/cldr/draft/Ids.java" srcdir="${src.dir}" 77 destdir="${build.dir}" classpathref="project.class.path" source="1.8" 78 target="1.8" debug="on" deprecation="off" encoding="UTF-8" /> 79 <!-- copy data files into classes.. --> 80 <mkdir dir="${build.dir}/org/unicode/cldr/util/data" /> 81 <copy todir="${build.dir}/org/unicode/cldr/util/data"> 82 <fileset dir="${src.dir}/org/unicode/cldr/util/data" 83 excludes="**/CVS/**/*" /> 84 </copy> 85 </target> 86 <target name="api" depends="init,util" description="build api classes"> 87 <javac includeantruntime="false" includes="org/unicode/cldr/api/**/*.java" 88 srcdir="${src.dir}" destdir="${build.dir}" 89 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 90 deprecation="off" encoding="UTF-8" /> 91 <!-- API package doesn't have dta files --> 92 </target> 93 <target name="tool" depends="init,util" description="build tool classes"> 94 <javac includeantruntime="false" includes="org/unicode/cldr/tool/**/*.java" 95 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 96 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 97 deprecation="off" encoding="UTF-8" /> 98 <!-- copy data files into classes.. --> 99 <mkdir dir="${build.dir}/org/unicode/cldr/tool" /> 100 <copy todir="${build.dir}/org/unicode/cldr/tool"> 101 <fileset dir="${src.dir}/org/unicode/cldr/tool" excludes="**/CVS/**/* **/**/*.java" /> 102 </copy> 103 </target> 104 <target name="posix" depends="init,util" description="build posix conversion tool"> 105 <javac includeantruntime="false" includes="org/unicode/cldr/posix/**/*.java" 106 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 107 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 108 deprecation="off" encoding="UTF-8" /> 109 </target> 110 <target name="icu" depends="init, ant-plugin, util" description="build ICU conversion tool"> 111 <javac includeantruntime="false" includes="org/unicode/cldr/icu/**/*.java" 112 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 113 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 114 deprecation="off" encoding="UTF-8" /> 115 <!-- copy data files into classes.. --> 116 <mkdir dir="${build.dir}/org/unicode/cldr/icu" /> 117 <copy todir="${build.dir}/org/unicode/cldr/icu"> 118 <fileset dir="${src.dir}/org/unicode/cldr/icu" excludes="**/CVS/**/* **/**/*.java" /> 119 </copy> 120 </target> 121 <target name="json" depends="init, ant-plugin, util" 122 description="build json conversion tool"> 123 <javac includeantruntime="false" includes="org/unicode/cldr/json/**/*.java" 124 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 125 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 126 deprecation="off" encoding="UTF-8" /> 127 <!-- copy data files into classes.. --> 128 <mkdir dir="${build.dir}/org/unicode/cldr/json" /> 129 <copy todir="${build.dir}/org/unicode/cldr/json"> 130 <fileset dir="${src.dir}/org/unicode/cldr/json" excludes="**/CVS/**/* **/**/*.java" /> 131 </copy> 132 </target> 133 <target name="test" depends="init,util,tool,icu" description="build tests"> 134 <javac includeantruntime="false" includes="org/unicode/cldr/test/**/*.java " 135 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 136 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 137 deprecation="off" encoding="UTF-8" /> 138 <!-- copy data files into classes.. --> 139 <mkdir dir="${build.dir}/org/unicode/cldr/test" /> 140 <copy todir="${build.dir}/org/unicode/cldr/test"> 141 <fileset dir="${src.dir}/org/unicode/cldr/test" excludes="**/CVS/**/* **/**/*.java" /> 142 </copy> 143 </target> 144 <target name="clean" depends="init" description="remove all build targets"> 145 <delete dir="${build.dir}" /> 146 <delete file="${jar.file}" /> 147 </target> 148 149 <target name="jars" depends="jar,srcJar,docsJar" description="build all jars"/> 150 151 <target name="init-githash" depends="init" description="calculate build.githash"> 152 <exec executable="git" outputproperty="build.githash" failifexecutionfails="false"> 153 <arg value="rev-parse" /> 154 <arg value="HEAD" /> 155 </exec> 156 <condition property="build.githash" value="(unknown)"> 157 <not> 158 <isset property="build.githash" /> 159 </not> 160 </condition> 161 </target> 162 163 <target name="jar" depends="all,init-githash" description="build full 'cldr.jar' jar file"> 164 <jar jarfile="${jar.file}" compress="true" 165 includes="org/unicode/cldr/draft/**/*, 166 org/unicode/cldr/api/**/*, 167 org/unicode/cldr/util/**/*, 168 org/unicode/cldr/tool/**/*, 169 org/unicode/cldr/test/**/*, 170 org/unicode/cldr/posix/**/*, 171 org/unicode/cldr/ant/**/*, 172 org/unicode/cldr/json/**/*, 173 org/unicode/cldr/icu/**/*, 174 com/ibm/icu/**/*" 175 basedir="${build.dir}"> 176 <manifest> 177 <attribute name="Built-By" value="${user.name}" /> 178 <attribute name="Main-Class" value="org.unicode.cldr.tool.Main" /> 179 <attribute name="CLDR-Tools-Git-Commit" value="${build.githash}" /> 180 <attribute name="Class-Path" 181 value="./libs/${cldr.libs.icu4j} ./libs/${cldr.libs.utilities} ./libs/${cldr.libs.xerces} ./libs/${cldr.libs.guava} ./libs/${cldr.libs.failureaccess} ./libs/${cldr.libs.gson} ${cldr.libs.icu4j} ${cldr.libs.utilities} ${cldr.libs.xerces} ${cldr.libs.gson} ./libs/myanmar-tools-1.1.1.jar" /> 182 </manifest> 183 </jar> 184 </target> 185 186 <!-- Docs stuff --> 187 <!-- use excludefiles below when we move to ant 1.5 --> 188 <target name="docs" depends="init" description="build user javadoc"> 189 <tstamp> 190 <format property="current.year" pattern="yyyy" /> 191 </tstamp> 192 <echo message="doc params: ${doc.params}" /> 193 <mkdir dir="${doc.dir}" /> 194 <javadoc packagenames="org.unicode.cldr.*" sourcepath="${src.dir}" 195 destdir="${doc.dir}" classpathref="project.class.path" 196 nodeprecatedlist="true" windowtitle="CLDR | Java Tools" doctitle="CLDR | Java Tools" 197 encoding="utf-8" docencoding="utf-8" additionalparam="${doc.params}" 198 link="http://docs.oracle.com/javase/7/docs/api" 199 bottom="<font size=-1><a target='_top' href='http://www.unicode.org/copyright.html'>Copyright &copy; 2004-${current.year} Unicode, Inc. All Rights Reserved.</a></font>" 200 source="1.8" /> 201 <!-- bottom="<font size=-1>Copyright (c) ${current.year} IBM Corporation 202 and others.</font>" --> 203 </target> 204 205 <target name="docsJar" depends="docs"> 206 <jar jarfile="${jarDocs.file}" compress="true" basedir="${doc.dir}"> 207 <fileset dir="../.." includes="*LICENSE*,*license*"/> 208 </jar> 209 </target> 210 <target name="srcJar" depends="init" description="Build all *.jars (tools/docs/src)"> 211 <jar jarfile="${jarSrc.file}" compress="true"> 212 <fileset dir="org" includes="**/*.java"/> 213 <fileset dir="com" includes="**/*.java"/> 214 <fileset dir="../.." includes="*LICENSE*,*license*"/> 215 </jar> 216 </target> 217 218 <!-- for testing and development --> 219 <target name="icu4c" depends="init, ant-plugin, icu"> 220 <ant dir="${env.ICU4C_DIR}/source/data" antfile="build.xml" 221 target="all" /> 222 </target> 223 224 225 <target name="check"> 226 <fail 227 message="*** Note! unittests have moved to ../cldr-unittest - please try there. See: http://unicode.org/cldr/trac/ticket/5215" /> 228 </target> 229 230 231 <target name="GenerateMaximalLocales" depends="init" 232 description="Build likelySubtags.xml and supplementalMetadata.xml - see https://sites.google.com/site/cldr/development/updating-codes/likelysubtags"> 233 <antcall target="_runTool"> 234 <param name="runTool.class" value="org.unicode.cldr.tool.GenerateMaximalLocales" /> 235 <param name="runTool.arg" value="" /> 236 <param name="runTool.jvmarg" value="${jvm_options}" /> 237 </antcall> 238 <antcall target="_toolcopy" /> 239 </target> 240 241 <target name="AddPopulationData" depends="init" 242 description="test population data - see https://sites.google.com/site/cldr/development/updating-codes/update-language-script-info "> 243 <antcall target="_runTool"> 244 <param name="runTool.class" value="org.unicode.cldr.tool.AddPopulationData" /> 245 <param name="runTool.arg" value="" /> 246 <param name="runTool.jvmarg" value="${jvm_options} -DADD_POP=true" /> 247 </antcall> 248 </target> 249 250 <target name="ConvertLanguageData" depends="init" 251 description="convert population data - updates supplementalData.xml - see https://sites.google.com/site/cldr/development/updating-codes/update-language-script-info"> 252 <antcall target="_runTool"> 253 <param name="runTool.class" value="org.unicode.cldr.tool.ConvertLanguageData" /> 254 <param name="runTool.arg" value="" /> 255 <param name="runTool.jvmarg" value="${jvm_options} -DADD_POP=true" /> 256 </antcall> 257 <antcall target="_toolcopy" /> 258 </target> 259 260 <target name="AddPseudolocales" depends="init" 261 description="build pseudo-locale data en_XA.xml and ar_XB.xml"> 262 <antcall target="_runTool"> 263 <param name="runTool.class" value="org.unicode.cldr.tool.CLDRFilePseudolocalizer" /> 264 <param name="runTool.arg" value="" /> 265 <param name="runTool.jvmarg" value="${jvm_options}" /> 266 </antcall> 267 <antcall target="_toolcopy" /> 268 </target> 269 270 <target name="GenerateAllCharts" depends="init" 271 description="generate all html charts - see http://cldr.unicode.org/development/cldr-big-red-switch/generating-charts"> 272 <antcall target="_runTool"> 273 <param name="runTool.class" value="org.unicode.cldr.tool.GenerateAllCharts" /> 274 <param name="runTool.arg" value="" /> 275 <param name="runTool.jvmarg" value="${jvm_options}" /> 276 </antcall> 277 <!-- <antcall target="_toolcopy"/> --> 278 </target> 279 280 <target name="RunAllTools" 281 depends="GenerateMaximalLocales,AddPopulationData,ConvertLanguageData" 282 description="Run several of the automated tools that are currently available to this build script."> 283 </target> 284 285 <target name="_runTool" depends="all"> 286 <delete dir="${tooltmp.dir}" /> 287 <echo message="JVM argument: ${runTool.jvmarg} -Djava.awt.headless=true" /> 288 <echo message="Tool class: ${runTool.class}" /> 289 <echo message="Tool argument: ${runTool.arg}" /> 290 <java classname="${runTool.class}" fork="yes" failonerror="true" 291 classpathref="project.class.path"> 292 <arg line="${runTool.arg}" /> 293 <jvmarg 294 line="${runTool.jvmarg} -DCLDR_GEN_DIR=${tooltmp.dir} -DCLDR_DIR=${CLDR_DIR} -Djava.awt.headless=true" /> 295 </java> 296 </target> 297 298 <target name="_toolcopy"> 299 <copy verbose="true" todir="${CLDR_DIR}/common/"> 300 <fileset dir="${tooltmp.dir}" /> 301 </copy> 302 <delete dir="${tooltmp.dir}" /> 303 </target> 304</project> 305