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,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 <target name="util" depends="init" description="build utility classes"> 69 <javac includeantruntime="false" 70 includes="org/unicode/cldr/draft/**/*.java org/unicode/cldr/util/**/*.java com/**/*.java" 71 excludes="**/CVS/**/* org/unicode/cldr/draft/Ids.java" srcdir="${src.dir}" 72 destdir="${build.dir}" classpathref="project.class.path" source="1.8" 73 target="1.8" debug="on" deprecation="off" encoding="UTF-8" /> 74 <!-- copy data files into classes.. --> 75 <mkdir dir="${build.dir}/org/unicode/cldr/util/data" /> 76 <copy todir="${build.dir}/org/unicode/cldr/util/data"> 77 <fileset dir="${src.dir}/org/unicode/cldr/util/data" 78 excludes="**/CVS/**/*" /> 79 </copy> 80 </target> 81 <target name="tool" depends="init,util" description="build tool classes"> 82 <javac includeantruntime="false" includes="org/unicode/cldr/tool/**/*.java" 83 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 84 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 85 deprecation="off" encoding="UTF-8" /> 86 <!-- copy data files into classes.. --> 87 <mkdir dir="${build.dir}/org/unicode/cldr/tool" /> 88 <copy todir="${build.dir}/org/unicode/cldr/tool"> 89 <fileset dir="${src.dir}/org/unicode/cldr/tool" excludes="**/CVS/**/* **/**/*.java" /> 90 </copy> 91 </target> 92 <target name="posix" depends="init,util" description="build posix conversion tool"> 93 <javac includeantruntime="false" includes="org/unicode/cldr/posix/**/*.java" 94 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 95 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 96 deprecation="off" encoding="UTF-8" /> 97 </target> 98 <target name="icu" depends="init, ant-plugin, util" description="build ICU conversion tool"> 99 <javac includeantruntime="false" includes="org/unicode/cldr/icu/**/*.java" 100 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 101 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 102 deprecation="off" encoding="UTF-8" /> 103 <!-- copy data files into classes.. --> 104 <mkdir dir="${build.dir}/org/unicode/cldr/icu" /> 105 <copy todir="${build.dir}/org/unicode/cldr/icu"> 106 <fileset dir="${src.dir}/org/unicode/cldr/icu" excludes="**/CVS/**/* **/**/*.java" /> 107 </copy> 108 </target> 109 <target name="json" depends="init, ant-plugin, util" 110 description="build json conversion tool"> 111 <javac includeantruntime="false" includes="org/unicode/cldr/json/**/*.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/json" /> 117 <copy todir="${build.dir}/org/unicode/cldr/json"> 118 <fileset dir="${src.dir}/org/unicode/cldr/json" excludes="**/CVS/**/* **/**/*.java" /> 119 </copy> 120 </target> 121 <target name="test" depends="init,util,tool,icu" description="build tests"> 122 <javac includeantruntime="false" includes="org/unicode/cldr/test/**/*.java " 123 excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}" 124 classpathref="project.class.path" source="1.8" target="1.8" debug="on" 125 deprecation="off" encoding="UTF-8" /> 126 <!-- copy data files into classes.. --> 127 <mkdir dir="${build.dir}/org/unicode/cldr/test" /> 128 <copy todir="${build.dir}/org/unicode/cldr/test"> 129 <fileset dir="${src.dir}/org/unicode/cldr/test" excludes="**/CVS/**/* **/**/*.java" /> 130 </copy> 131 </target> 132 <target name="clean" depends="init" description="remove all build targets"> 133 <delete dir="${build.dir}" /> 134 <delete file="${jar.file}" /> 135 </target> 136 137 <target name="jars" depends="jar,srcJar,docsJar" description="build all jars"/> 138 139 <target name="jar" depends="all" description="build full 'cldr.jar' jar file"> 140 <jar jarfile="${jar.file}" compress="true" 141 includes="org/unicode/cldr/draft/**/*, 142 org/unicode/cldr/util/**/*, 143 org/unicode/cldr/tool/**/*, 144 org/unicode/cldr/test/**/*, 145 org/unicode/cldr/posix/**/*, 146 org/unicode/cldr/ant/**/*, 147 org/unicode/cldr/json/**/*, 148 org/unicode/cldr/icu/**/*, 149 com/ibm/icu/**/*" 150 basedir="${build.dir}"> 151 <manifest> 152 <attribute name="Built-By" value="${user.name}" /> 153 <attribute name="Main-Class" value="org.unicode.cldr.tool.Main" /> 154 <attribute name="Class-Path" 155 value="./libs/${cldr.libs.icu4j} ./libs/${cldr.libs.utilities} ./libs/${cldr.libs.xerces} ./libs/${cldr.libs.guava} ./libs/${cldr.libs.gson} ${cldr.libs.icu4j} ${cldr.libs.utilities} ${cldr.libs.xerces} ${cldr.libs.gson}" /> 156 </manifest> 157 </jar> 158 </target> 159 <!-- Docs stuff --> 160 <!-- use excludefiles below when we move to ant 1.5 --> 161 <target name="docs" depends="init" description="build user javadoc"> 162 <tstamp> 163 <format property="current.year" pattern="yyyy" /> 164 </tstamp> 165 <echo message="doc params: ${doc.params}" /> 166 <mkdir dir="${doc.dir}" /> 167 <javadoc packagenames="org.unicode.cldr.*" sourcepath="${src.dir}" 168 destdir="${doc.dir}" classpathref="project.class.path" 169 nodeprecatedlist="true" windowtitle="CLDR | Java Tools" doctitle="CLDR | Java Tools" 170 encoding="utf-8" docencoding="utf-8" additionalparam="${doc.params}" 171 link="http://docs.oracle.com/javase/7/docs/api" 172 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>" 173 source="1.8" /> 174 <!-- bottom="<font size=-1>Copyright (c) ${current.year} IBM Corporation 175 and others.</font>" --> 176 </target> 177 178 <target name="docsJar" depends="docs"> 179 <jar jarfile="${jarDocs.file}" compress="true" basedir="${doc.dir}"> 180 <fileset dir="../.." includes="*LICENSE*,*license*"/> 181 </jar> 182 </target> 183 <target name="srcJar" depends="init" description="Build all *.jars (tools/docs/src)"> 184 <jar jarfile="${jarSrc.file}" compress="true"> 185 <fileset dir="org" includes="**/*.java"/> 186 <fileset dir="com" includes="**/*.java"/> 187 <fileset dir="../.." includes="*LICENSE*,*license*"/> 188 </jar> 189 </target> 190 191 <!-- for testing and development --> 192 <target name="icu4c" depends="init, ant-plugin, icu"> 193 <ant dir="${env.ICU4C_DIR}/source/data" antfile="build.xml" 194 target="all" /> 195 </target> 196 197 198 <target name="check"> 199 <fail 200 message="*** Note! unittests have moved to ../cldr-unittest - please try there. See: http://unicode.org/cldr/trac/ticket/5215" /> 201 </target> 202 203 204 <target name="GenerateMaximalLocales" depends="init" 205 description="Build likelySubtags.xml and supplementalMetadata.xml - see https://sites.google.com/site/cldr/development/updating-codes/likelysubtags"> 206 <antcall target="_runTool"> 207 <param name="runTool.class" value="org.unicode.cldr.tool.GenerateMaximalLocales" /> 208 <param name="runTool.arg" value="" /> 209 <param name="runTool.jvmarg" value="${jvm_options}" /> 210 </antcall> 211 <antcall target="_toolcopy" /> 212 </target> 213 214 <target name="AddPopulationData" depends="init" 215 description="test population data - see https://sites.google.com/site/cldr/development/updating-codes/update-language-script-info "> 216 <antcall target="_runTool"> 217 <param name="runTool.class" value="org.unicode.cldr.tool.AddPopulationData" /> 218 <param name="runTool.arg" value="" /> 219 <param name="runTool.jvmarg" value="${jvm_options} -DADD_POP=true" /> 220 </antcall> 221 </target> 222 223 <target name="ConvertLanguageData" depends="init" 224 description="convert population data - updates supplementalData.xml - see https://sites.google.com/site/cldr/development/updating-codes/update-language-script-info"> 225 <antcall target="_runTool"> 226 <param name="runTool.class" value="org.unicode.cldr.tool.ConvertLanguageData" /> 227 <param name="runTool.arg" value="" /> 228 <param name="runTool.jvmarg" value="${jvm_options} -DADD_POP=true" /> 229 </antcall> 230 <antcall target="_toolcopy" /> 231 </target> 232 233 <target name="AddPseudolocales" depends="init" 234 description="build pseudo-locale data en_XA.xml and ar_XB.xml"> 235 <antcall target="_runTool"> 236 <param name="runTool.class" value="org.unicode.cldr.tool.CLDRFilePseudolocalizer" /> 237 <param name="runTool.arg" value="" /> 238 <param name="runTool.jvmarg" value="${jvm_options}" /> 239 </antcall> 240 <antcall target="_toolcopy" /> 241 </target> 242 243 <target name="GenerateAllCharts" depends="init" 244 description="generate all html charts - see http://cldr.unicode.org/development/cldr-big-red-switch/generating-charts"> 245 <antcall target="_runTool"> 246 <param name="runTool.class" value="org.unicode.cldr.tool.GenerateAllCharts" /> 247 <param name="runTool.arg" value="" /> 248 <param name="runTool.jvmarg" value="${jvm_options}" /> 249 </antcall> 250 <!-- <antcall target="_toolcopy"/> --> 251 </target> 252 253 <target name="RunAllTools" 254 depends="GenerateMaximalLocales,AddPopulationData,ConvertLanguageData" 255 description="Run several of the automated tools that are currently available to this build script."> 256 </target> 257 258 <target name="_runTool" depends="all"> 259 <delete dir="${tooltmp.dir}" /> 260 <echo message="JVM argument: ${runTool.jvmarg} -Djava.awt.headless=true" /> 261 <echo message="Tool class: ${runTool.class}" /> 262 <echo message="Tool argument: ${runTool.arg}" /> 263 <java classname="${runTool.class}" fork="yes" failonerror="true" 264 classpathref="project.class.path"> 265 <arg line="${runTool.arg}" /> 266 <jvmarg 267 line="${runTool.jvmarg} -DCLDR_GEN_DIR=${tooltmp.dir} -DCLDR_DIR=${CLDR_DIR} -Djava.awt.headless=true" /> 268 </java> 269 </target> 270 271 <target name="_toolcopy"> 272 <copy verbose="true" todir="${CLDR_DIR}/common/"> 273 <fileset dir="${tooltmp.dir}" /> 274 </copy> 275 <delete dir="${tooltmp.dir}" /> 276 </target> 277</project> 278