blob: bfe314a114539f50eb468c3f1da3f84a21d425e7 [file] [log] [blame]
<!-- see readme.txt -->
<project name="CLDR" default="util" basedir=".">
<target name="init">
<tstamp />
<property name="src.dir" value="." />
<property name="build.dir" value="classes" />
<property name="libs.dir" value="libs" />
<property name="jar.file" value="cldr.jar" />
<property name="jarSrc.file" value="cldr-src.jar" />
<property name="jarDocs.file" value="cldr-docs.jar" />
<property name="doc.dir" value="doc" />
<property name="doc.params" value="" />
<!-- Load local definitions from an optional build.properties file, if
available. build.properties is NOT checked into CVS. -->
<property file="build.properties" />
<!-- Load environment variables -->
<property environment="env" />
<path id="build.classpath">
<pathelement path="${build.dir}" />
<pathelement path="${libs.dir}" />
</path>
<property name="CLDR_TOOLS" value="." /> <!-- this is cldr-tools -->
<property name="CLDR_DIR" value="${env.CLDR_DIR}" />
<property file="${CLDR_TOOLS}/cldr-tools.properties" />
<property name="JVM_OPTIONS"
value="-DCLDR_DIR=${CLDR_DIR} -DDEBUG=false -Dverbose=false" />
<!-- JVM_EXTRA_OPTIONS might be resolved in the next priority order:
1) System property JVM_EXTRA_OPTIONS specified by ant command arg: ant -DJVM_EXTRA_OPTIONS=xxx <target>
2) JVM_EXTRA_OPTIONS=xxx in build.properties
3) Environment variable - JVM_EXTRA_OPTIONS=xxx
4) Final fallback - "-Xmx6g" below -->
<property name="env.JVM_EXTRA_OPTIONS" value="-Xmx6g" />
<property name="JVM_EXTRA_OPTIONS" value="${env.JVM_EXTRA_OPTIONS}" />
<property name="jvm_options" value="${JVM_OPTIONS} ${JVM_EXTRA_OPTIONS}" />
<property name="tooltmp.dir" value="tmp" />
<mkdir dir="${build.dir}" />
<path id="project.class.path">
<pathelement path="${java.class.path}/" />
<pathelement path="${build.dir}" />
<fileset dir="${libs.dir}" includes="*.jar" /> <!-- unittest local -->
</path>
<echo message="java home: ${java.home}" />
<echo message="java version: ${java.version}" />
<echo message="jvm_options: ${jvm_options}" />
<echo message="ant java version: ${ant.java.version}" />
<echo message="${ant.version}" />
<echo message="java.class.path: ${java.class.path}/" />
<echo message="java.class.path: ${java.class.path}/" />
<echo message="build.dir: ${build.dir}" />
</target>
<!-- build everything but dist-related stuff -->
<target name="all" depends="util,api,ant-plugin,tool,posix,icu,json,test"
description="build all primary targets" />
<target name="ant-plugin" depends="init" description="build utility classes">
<javac includeantruntime="false" includes="org/unicode/cldr/ant/*.java"
excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}"
classpathref="project.class.path" source="1.8" target="1.8" debug="on"
deprecation="off" encoding="UTF-8" />
</target>
<!-- WARNING: The "util" target actually depends upon the "tool" target at runtime via
CLDRPaths and ToolConstants. This only appears to work when building this target
because Ant does not do any kind of source isolation during builds, so it just
builds all the transitive dependencies anyway.
-->
<target name="util" depends="init" description="build utility classes">
<javac includeantruntime="false"
includes="org/unicode/cldr/draft/**/*.java org/unicode/cldr/util/**/*.java com/**/*.java"
excludes="**/CVS/**/* org/unicode/cldr/draft/Ids.java" srcdir="${src.dir}"
destdir="${build.dir}" classpathref="project.class.path" source="1.8"
target="1.8" debug="on" deprecation="off" encoding="UTF-8" />
<!-- copy data files into classes.. -->
<mkdir dir="${build.dir}/org/unicode/cldr/util/data" />
<copy todir="${build.dir}/org/unicode/cldr/util/data">
<fileset dir="${src.dir}/org/unicode/cldr/util/data"
excludes="**/CVS/**/*" />
</copy>
</target>
<target name="api" depends="init,util" description="build api classes">
<javac includeantruntime="false" includes="org/unicode/cldr/api/**/*.java"
srcdir="${src.dir}" destdir="${build.dir}"
classpathref="project.class.path" source="1.8" target="1.8" debug="on"
deprecation="off" encoding="UTF-8" />
<!-- API package doesn't have dta files -->
</target>
<target name="tool" depends="init,util" description="build tool classes">
<javac includeantruntime="false" includes="org/unicode/cldr/tool/**/*.java"
excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}"
classpathref="project.class.path" source="1.8" target="1.8" debug="on"
deprecation="off" encoding="UTF-8" />
<!-- copy data files into classes.. -->
<mkdir dir="${build.dir}/org/unicode/cldr/tool" />
<copy todir="${build.dir}/org/unicode/cldr/tool">
<fileset dir="${src.dir}/org/unicode/cldr/tool" excludes="**/CVS/**/* **/**/*.java" />
</copy>
</target>
<target name="posix" depends="init,util" description="build posix conversion tool">
<javac includeantruntime="false" includes="org/unicode/cldr/posix/**/*.java"
excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}"
classpathref="project.class.path" source="1.8" target="1.8" debug="on"
deprecation="off" encoding="UTF-8" />
</target>
<target name="icu" depends="init, ant-plugin, util" description="build ICU conversion tool">
<javac includeantruntime="false" includes="org/unicode/cldr/icu/**/*.java"
excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}"
classpathref="project.class.path" source="1.8" target="1.8" debug="on"
deprecation="off" encoding="UTF-8" />
<!-- copy data files into classes.. -->
<mkdir dir="${build.dir}/org/unicode/cldr/icu" />
<copy todir="${build.dir}/org/unicode/cldr/icu">
<fileset dir="${src.dir}/org/unicode/cldr/icu" excludes="**/CVS/**/* **/**/*.java" />
</copy>
</target>
<target name="json" depends="init, ant-plugin, util"
description="build json conversion tool">
<javac includeantruntime="false" includes="org/unicode/cldr/json/**/*.java"
excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}"
classpathref="project.class.path" source="1.8" target="1.8" debug="on"
deprecation="off" encoding="UTF-8" />
<!-- copy data files into classes.. -->
<mkdir dir="${build.dir}/org/unicode/cldr/json" />
<copy todir="${build.dir}/org/unicode/cldr/json">
<fileset dir="${src.dir}/org/unicode/cldr/json" excludes="**/CVS/**/* **/**/*.java" />
</copy>
</target>
<target name="test" depends="init,util,tool,icu" description="build tests">
<javac includeantruntime="false" includes="org/unicode/cldr/test/**/*.java "
excludes="**/CVS/**/*" srcdir="${src.dir}" destdir="${build.dir}"
classpathref="project.class.path" source="1.8" target="1.8" debug="on"
deprecation="off" encoding="UTF-8" />
<!-- copy data files into classes.. -->
<mkdir dir="${build.dir}/org/unicode/cldr/test" />
<copy todir="${build.dir}/org/unicode/cldr/test">
<fileset dir="${src.dir}/org/unicode/cldr/test" excludes="**/CVS/**/* **/**/*.java" />
</copy>
</target>
<target name="clean" depends="init" description="remove all build targets">
<delete dir="${build.dir}" />
<delete file="${jar.file}" />
</target>
<target name="jars" depends="jar,srcJar,docsJar" description="build all jars"/>
<target name="init-githash" depends="init" description="calculate build.githash">
<exec executable="git" outputproperty="build.githash" failifexecutionfails="false">
<arg value="rev-parse" />
<arg value="--short" />
<arg value="HEAD" />
</exec>
<condition property="build.githash" value="(unknown)">
<not>
<isset property="build.githash" />
</not>
</condition>
</target>
<target name="jar" depends="all,init-githash" description="build full 'cldr.jar' jar file">
<jar jarfile="${jar.file}" compress="true"
includes="org/unicode/cldr/draft/**/*,
org/unicode/cldr/api/**/*,
org/unicode/cldr/util/**/*,
org/unicode/cldr/tool/**/*,
org/unicode/cldr/test/**/*,
org/unicode/cldr/posix/**/*,
org/unicode/cldr/ant/**/*,
org/unicode/cldr/json/**/*,
org/unicode/cldr/icu/**/*,
com/ibm/icu/**/*"
basedir="${build.dir}">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="org.unicode.cldr.tool.Main" />
<attribute name="CLDR-Tools-Git-Commit" value="${build.githash}" />
<attribute name="Class-Path"
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" />
</manifest>
</jar>
</target>
<!-- Docs stuff -->
<!-- use excludefiles below when we move to ant 1.5 -->
<target name="docs" depends="init" description="build user javadoc">
<tstamp>
<format property="current.year" pattern="yyyy" />
</tstamp>
<echo message="doc params: ${doc.params}" />
<mkdir dir="${doc.dir}" />
<javadoc packagenames="org.unicode.cldr.*" sourcepath="${src.dir}"
destdir="${doc.dir}" classpathref="project.class.path"
nodeprecatedlist="true" windowtitle="CLDR | Java Tools" doctitle="CLDR | Java Tools"
encoding="utf-8" docencoding="utf-8" additionalparam="${doc.params}"
link="http://docs.oracle.com/javase/7/docs/api"
bottom="&lt;font size=-1>&lt;a target='_top' href='http://www.unicode.org/copyright.html'>Copyright &amp;copy; 2004-${current.year} Unicode, Inc. All Rights Reserved.&lt;/a>&lt;/font>"
source="1.8" />
<!-- bottom="&lt;font size=-1>Copyright (c) ${current.year} IBM Corporation
and others.&lt;/font>" -->
</target>
<target name="docsJar" depends="docs">
<jar jarfile="${jarDocs.file}" compress="true" basedir="${doc.dir}">
<fileset dir="../.." includes="*LICENSE*,*license*"/>
</jar>
</target>
<target name="srcJar" depends="init" description="Build all *.jars (tools/docs/src)">
<jar jarfile="${jarSrc.file}" compress="true">
<fileset dir="org" includes="**/*.java"/>
<fileset dir="com" includes="**/*.java"/>
<fileset dir="../.." includes="*LICENSE*,*license*"/>
</jar>
</target>
<!-- for testing and development -->
<target name="icu4c" depends="init, ant-plugin, icu">
<ant dir="${env.ICU4C_DIR}/source/data" antfile="build.xml"
target="all" />
</target>
<target name="check">
<fail
message="*** Note! unittests have moved to ../cldr-unittest - please try there. See: http://unicode.org/cldr/trac/ticket/5215" />
</target>
<target name="GenerateMaximalLocales" depends="init"
description="Build likelySubtags.xml and supplementalMetadata.xml - see https://sites.google.com/site/cldr/development/updating-codes/likelysubtags">
<antcall target="_runTool">
<param name="runTool.class" value="org.unicode.cldr.tool.GenerateMaximalLocales" />
<param name="runTool.arg" value="" />
<param name="runTool.jvmarg" value="${jvm_options}" />
</antcall>
<antcall target="_toolcopy" />
</target>
<target name="AddPopulationData" depends="init"
description="test population data - see https://sites.google.com/site/cldr/development/updating-codes/update-language-script-info ">
<antcall target="_runTool">
<param name="runTool.class" value="org.unicode.cldr.tool.AddPopulationData" />
<param name="runTool.arg" value="" />
<param name="runTool.jvmarg" value="${jvm_options} -DADD_POP=true" />
</antcall>
</target>
<target name="ConvertLanguageData" depends="init"
description="convert population data - updates supplementalData.xml - see https://sites.google.com/site/cldr/development/updating-codes/update-language-script-info">
<antcall target="_runTool">
<param name="runTool.class" value="org.unicode.cldr.tool.ConvertLanguageData" />
<param name="runTool.arg" value="" />
<param name="runTool.jvmarg" value="${jvm_options} -DADD_POP=true" />
</antcall>
<antcall target="_toolcopy" />
</target>
<target name="AddPseudolocales" depends="init"
description="build pseudo-locale data en_XA.xml and ar_XB.xml">
<antcall target="_runTool">
<param name="runTool.class" value="org.unicode.cldr.tool.CLDRFilePseudolocalizer" />
<param name="runTool.arg" value="" />
<param name="runTool.jvmarg" value="${jvm_options}" />
</antcall>
<antcall target="_toolcopy" />
</target>
<target name="GenerateAllCharts" depends="init"
description="generate all html charts - see http://cldr.unicode.org/development/cldr-big-red-switch/generating-charts">
<antcall target="_runTool">
<param name="runTool.class" value="org.unicode.cldr.tool.GenerateAllCharts" />
<param name="runTool.arg" value="" />
<param name="runTool.jvmarg" value="${jvm_options}" />
</antcall>
<!-- <antcall target="_toolcopy"/> -->
</target>
<target name="RunAllTools"
depends="GenerateMaximalLocales,AddPopulationData,ConvertLanguageData"
description="Run several of the automated tools that are currently available to this build script.">
</target>
<target name="_runTool" depends="all">
<delete dir="${tooltmp.dir}" />
<echo message="JVM argument: ${runTool.jvmarg} -Djava.awt.headless=true" />
<echo message="Tool class: ${runTool.class}" />
<echo message="Tool argument: ${runTool.arg}" />
<java classname="${runTool.class}" fork="yes" failonerror="true"
classpathref="project.class.path">
<arg line="${runTool.arg}" />
<jvmarg
line="${runTool.jvmarg} -DCLDR_GEN_DIR=${tooltmp.dir} -DCLDR_DIR=${CLDR_DIR} -Djava.awt.headless=true" />
</java>
</target>
<target name="_toolcopy">
<copy verbose="true" todir="${CLDR_DIR}/common/">
<fileset dir="${tooltmp.dir}" />
</copy>
<delete dir="${tooltmp.dir}" />
</target>
</project>