blob: cd55f98efb81c0e2b543c1423b8789d3534716a3 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
*******************************************************************************
* Copyright (C) 2008-2016, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
* This is the ant build file for ICU Meta.
*/
-->
<project name="meta" default="hello" basedir=".">
<target name="init" depends="initBase"/>
<target name="initBase"
description="Initialized meta build environment">
<tstamp />
<property name="project" value="icumeta" />
<property name="src.dir" value="src" />
<property name="dtdcache.dir" location="./dtdcache" />
<property name="dtd.dir" location="./dtd" />
<property name="build.dir" value="classes" />
<property name="doc.dir" value="doc" />
<property name="merger.class" value="com.ibm.icu.dev.meta.Merger" />
<property name="validate.class" value="org.unicode.cldr.util.XMLValidator" />
<property name="xml.dir" value="xml" />
<property name="xml-base.file" value="icumeta.xml" />
<property name="xml.file" value="${xml.dir}/${xml-base.file}" />
<property name="json.file" value="${xml.dir}/icumeta.json" />
<property name="input.dir" value="input" />
<property name="lib.dir" value="lib" />
<property name="jar.file" value="icumeta.jar" />
<property file="build.properties" />
<property name="icumeta.javac.source" value="1.7" />
<property name="icumeta.javac.target" value="1.7" />
<!-- snag all jars in lib/*.jar -->
<fileset id="libjars" dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<fileset id="srcxml" dir="${input.dir}">
<include name="**/*.xml"/>
</fileset>
<path id="build.classpath">
<fileset refid="libjars" />
<pathelement path="${build.dir}" />
</path>
<!-- Load environment variables -->
<property environment="env" />
<!-- Capture the computer name in a cross-platform manner -->
<property name="env.COMPUTERNAME" value="${env.HOSTNAME}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${dtdcache.dir}" />
<echo message="java home: ${java.home}" />
<echo message="java version: ${java.version}" />
<echo message="ant java version: ${ant.java.version}" />
<echo message="${ant.version}" />
<echo message="${env.COMPUTERNAME} with ${os.name} ${os.version} on ${os.arch}" />
<tstamp>
<format property="date.time" pattern="yyyy-MM-dd 'at' hh:mm:ss z" locale="en,US" />
</tstamp>
<echo message="Initialized at ${date.time}" />
</target>
<target name="clean" depends="initBase" description="remove all build targets">
<delete dir="${build.dir}" />
<delete dir="${doc.dir}" />
<delete dir="${dtdcache.dir}" />
<delete file="${jar.file}" />
</target>
<target name="core" depends="init">
<javac sourcepath=""
srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
source="${icumeta.javac.source}"
target="${icumeta.javac.source}"
debug="on"
deprecation="on"
includeantruntime="false"
encoding="ascii">
<include name="com/ibm/icu/dev/meta/**/*.java" />
</javac>
<copy todir="${build.dir}/com/ibm/icu/dev/meta/">
<fileset dir="${dtd.dir}" includes="icumeta.*" />
</copy>
</target>
<target name="check-xml" depends="init">
<dependset>
<srcfileset refid="srcxml"/>
<targetfilelist dir="${xml.dir}" files="${xml-base.file}"/>
</dependset>
<available file="${xml.file}" property="xml-ok"/>
</target>
<target name="rebuild-xml" depends="init,core" unless="xml-ok">
<echo message="DTD Cache: ${dtdcache.dir}" />
<echo message="DTD Override: ${dtd.dir}" />
<java classname="${merger.class}" classpathref="build.classpath">
<arg value="-v"/>
<arg value="-o:${xml.file}"/>
<arg value="-j:${json.file}"/>
<arg value="${input.dir}/"/> <!-- load all .xml files from there -->
<sysproperty key="CLDR_DTD_CACHE" value="${dtdcache.dir}"/>
<sysproperty key="CLDR_DTD_OVERRIDE" value="${dtd.dir}"/>
<!-- sysproperty key="CLDR_DTD_CACHE_DEBUG" value="y"/>
<sysproperty key="CLDR_DTD_CACHE_ADEBUG" value="y"/>
<sysproperty key="ICU_DTD_CACHE_DEBUG" value="y"/>
<sysproperty key="ICU_DTD_CACHE_ADEBUG" value="y" -->
<sysproperty key="ICU_DTD_CACHE" value="${dtdcache.dir}"/>
<sysproperty key="ICU_DTD_OVERRIDE" value="${dtd.dir}"/>
</java>
</target>
<target name="validate-xml" depends="init">
<java classname="${validate.class}" classpathref="build.classpath">
<arg value="${xml.file}"/>
<sysproperty key="CLDR_DTD_CACHE" value="${dtdcache.dir}"/>
<sysproperty key="CLDR_DTD_OVERRIDE" value="${dtd.dir}"/>
<!-- sysproperty key="CLDR_DTD_CACHE_DEBUG" value="y"/>
<sysproperty key="CLDR_DTD_CACHE_ADEBUG" value="y"/>
<sysproperty key="ICU_DTD_CACHE_DEBUG" value="y"/>
<sysproperty key="ICU_DTD_CACHE_ADEBUG" value="y" -->
<sysproperty key="ICU_DTD_CACHE" value="${dtdcache.dir}"/>
<sysproperty key="ICU_DTD_OVERRIDE" value="${dtd.dir}"/>
</java>
<echo message="(No errors here means ${xml.file} is OK.)"/>
</target>
<target name="xml" depends="init,core,check-xml,rebuild-xml,validate-xml">
</target>
<target name="hello" depends="init">
<echo message="This is ${project}." />
<echo message="Interesting targets:" />
<echo message=" core - build base class(es)"/>
<echo message=" clean - cleanup stuff"/>
<echo message=" xml - regenerate ${xml.file} if needed"/>
<echo message=" rebuild-xml - regenerate ${xml.file} irregardless"/>
<echo message=" (the 'dtd' subdirectory has its own makefile, which see.)"/>
<!-- echo message=" dtd - rebuild dtd (may require download)" / -->
<echo message=""/>
<echo message="Don't forget to put into ${lib.dir} the usual fun jars: cldr.jar icu4j.jar utilities.jar xalan.jar xerces.jar" />
</target>
<target name="jar"
depends="core"
description="build 'icumeta.jar' jar file">
<jar jarfile="${jar.file}" compress="true">
<!-- fileset dir="${basedir}" includes="license.html,unicode-license.txt" -->
<!-- fileset dir="${src.dir}" includes="com/ibm/icu/ICUConfig.properties" -->
<fileset dir="${build.dir}" includes="com/ibm/icu/dev/meta/**/*" excludes="META-INF/services/**/*,com/ibm/icu/charset/**/*,${icu4j.data.path}/*.cnv,${icu4j.data.path}/cnvalias.icu" />
<manifest>
<attribute name="Built-By" value="${corp}" />
<section name="common">
<attribute name="Specification-Title" value="${manifest.specification.title}" />
<attribute name="Specification-Version" value="${icu4j.spec.version.string}" />
<attribute name="Specification-Vendor" value="ICU" />
<attribute name="Implementation-Title" value=" ICU Metadata Processing" />
<attribute name="Implementation-Version" value="?" />
<attribute name="Implementation-Vendor" value="${corp}" />
<attribute name="Implementation-Vendor-Id" value="com.ibm.icu" />
<attribute name="Copyright-Info" value="${copyright}" />
<attribute name="Sealed" value="false" />
</section>
</manifest>
</jar>
</target>
</project>