| <!-- | |
| /* | |
| ******************************************************************************* | |
| * Copyright (C) 2007-2010, International Business Machines Corporation and * | |
| * others. All Rights Reserved. * | |
| ******************************************************************************* | |
| * This is the ant build file for eclipse ICU4J plug-in data patch. | |
| */ | |
| --> | |
| <project name="Eclipse_ICU_Data_Update" default="build.all" basedir="."> | |
| <property file="icu_data_patch.properties"/> | |
| <property file="eclipse_env.properties"/> | |
| <property name="zoneinfo.res.name" value="zoneinfo.res"/> | |
| <target name="check.props" | |
| depends="check.prop.tz.version, check.prop.eclipse.dir, check.prop.eclipse.version" | |
| description="Check required properties"> | |
| </target> | |
| <target name="check.prop.tz.version" | |
| description="Display error message when tz.version is not set"> | |
| <!-- Set the new resource directory path to new.tz.res.dir if available --> | |
| <available file="../icunew/${tz.version}/${icunew.version.dir}/be" | |
| type="dir" | |
| property="new.tz.res.dir" | |
| value="../icunew/${tz.version}/${icunew.version.dir}/be"/> | |
| <!-- Otherwise, set the old resource directory path to old.tz.res.dir --> | |
| <condition property="old.tz.res.dir" value="../icu/${tz.version}/be"> | |
| <not> | |
| <isset property="new.tz.res.dir"/> | |
| </not> | |
| </condition> | |
| <!-- Check if the main tzdata resource file exists --> | |
| <condition property="tz.file.available"> | |
| <or> | |
| <and> | |
| <isset property="new.tz.res.dir"/> | |
| <available file="${new.tz.res.dir}/${zoneinfo.res.name}"/> | |
| </and> | |
| <and> | |
| <isset property="old.tz.res.dir"/> | |
| <available file="${old.tz.res.dir}/${zoneinfo.res.name}"/> | |
| </and> | |
| </or> | |
| </condition> | |
| <antcall target="err.tz.version"/> | |
| </target> | |
| <target name="err.tz.version" | |
| unless="tz.file.available" | |
| description="Display error message when zoneinfo.res for the specified version is not found"> | |
| <echo message="########################################################"/> | |
| <echo message="ERROR: The required property tz.version is not set or"/> | |
| <echo message="invalid. The build cannot locate the ${zoneinfo.res.name} file."/> | |
| <echo message="########################################################"/> | |
| <fail message="The build stopped due to the fatal error"/> | |
| </target> | |
| <target name="check.prop.eclipse.dir" | |
| description="Check if the eclipse installation directory is set"> | |
| <condition property="eclipse.dir.available"> | |
| <available file="${eclipse.dir}" type="dir"/> | |
| </condition> | |
| <antcall target="warn.eclipse.dir"/> | |
| </target> | |
| <target name="warn.eclipse.dir" | |
| unless="eclipse.dir.available" | |
| description="Display warning message when eclipse.dir is not available"> | |
| <echo message="########################################################"/> | |
| <echo message="WARNING: The property eclipse.dir is not set or the"/> | |
| <echo message="specified directory does not exist. The build continues,"/> | |
| <echo message="but it may only collect eclipse project files to be used"/> | |
| <echo message="for building the patch."/> | |
| <echo message="########################################################"/> | |
| </target> | |
| <target name="check.prop.eclipse.version" | |
| description="Check if the target eclipse verison is set"> | |
| <pathconvert property="project.src.dir" dirsep="/"> | |
| <path location="${basedir}/project_src/eclipse${eclipse.version}"/> | |
| </pathconvert> | |
| <condition property="eclipse.version.available"> | |
| <available file="${project.src.dir}" type="dir"/> | |
| </condition> | |
| <antcall target="err.eclipse.version"/> | |
| </target> | |
| <target name="err.eclipse.version" | |
| unless="eclipse.version.available" | |
| description="Display error message when eclipse.version is not set or invalid"> | |
| <echo message="########################################################"/> | |
| <echo message="ERROR: The property eclipse.version is not set or"/> | |
| <echo message="invalid. The build cannot locate the corresponding"/> | |
| <echo message="project file directory -"/> | |
| <echo message="${project.src.dir}"/> | |
| <echo message="########################################################"/> | |
| <fail message="The build stopped due to the fatal error"/> | |
| </target> | |
| <target name="init.patch.version" | |
| unless="patch.version" | |
| description="Set icu data patch version string"> | |
| <tstamp> | |
| <format property="build.date" pattern="yyyyMMdd"/> | |
| </tstamp> | |
| <property name="build.date.str" value="v${build.date}"/> | |
| <property name="patch.version" value="${eclipse.version.string}.${build.date.str}_${eclipse.version}"/> | |
| <property name="icu.patch.plugin.version" value="${icu.version}.${build.date.str}_${tz.version}"/> | |
| </target> | |
| <target name="init.copyright.year" | |
| unless="copyright.year" | |
| description="Set icu copyright statement year"> | |
| <tstamp> | |
| <format property="copyright.year" pattern="yyyy"/> | |
| </tstamp> | |
| </target> | |
| <target name="init" | |
| depends="check.props, init.patch.version, init.copyright.year, init.eclipse.env" | |
| description="Initialize build properties"> | |
| <pathconvert property="build.dir" dirsep="/"> | |
| <path location="${basedir}/out/${patch.feature.id}_${patch.version}-${tz.version}"/> | |
| </pathconvert> | |
| <property name="project.dir" value="${build.dir}/projects"/> | |
| <property name="build.arc" value="build.arc"/> | |
| <property name="build.label" value="ICU_data_patch"/> | |
| <property name="output.archive" value="${project.dir}/${build.label}/${patch.feature.id}-${patch.version}.zip"/> | |
| <property name="update.site.dir" value="${build.dir}/updatesite"/> | |
| <pathconvert property="release.dir" dirsep="/"> | |
| <path location="${basedir}/versions/${patch.feature.id}_${patch.version}-${tz.version}"/> | |
| </pathconvert> | |
| </target> | |
| <target name="init.eclipse.env" | |
| depends="init.eclipse.home, init.eclipse.launcher, init.eclipse.pde" | |
| description="Initalize eclipse environment properties"> | |
| </target> | |
| <target name="init.eclipse.home" | |
| if="eclipse.dir" | |
| description="Set eclipse base location to the property 'eclipse.home'"> | |
| <pathconvert property="eclipse.home" dirsep="/"> | |
| <path location="${eclipse.dir}"/> | |
| </pathconvert> | |
| </target> | |
| <target name="init.eclipse.launcher" | |
| depends="locate.eclipse32.launcher, locate.eclipse33.launcher" | |
| description="Set eclipse launcher jar file to the property 'eclipse.launcher'"> | |
| </target> | |
| <target name="locate.eclipse32.launcher" | |
| if="eclipse.home" | |
| unless="eclipse.launcher" | |
| description="Locate startup.jar for eclipse 3.2.x"> | |
| <available file="${eclipse.home}/startup.jar" | |
| property="eclipse.launcher" value="${eclipse.home}/startup.jar"/> | |
| </target> | |
| <target name="locate.eclipse33.launcher" | |
| if="eclipse.home" | |
| unless="eclipse.launcher" | |
| description="Locate org.eclipse.equinox.launcher jar file for eclipse 3.3 and beyond"> | |
| <first id="equinox.launcher"> | |
| <fileset dir="${eclipse.home}/plugins"> | |
| <include name="org.eclipse.equinox.launcher_*.jar"/> | |
| </fileset> | |
| </first> | |
| <pathconvert property="eclipse.launcher" dirsep="/" refid="equinox.launcher"/> | |
| </target> | |
| <target name="init.eclipse.pde" | |
| depends="locate.eclipse.pde" | |
| if="eclipse.pde.dir" | |
| description="Set up PDE runtime arguments"> | |
| <property file="${eclipse.pde.dir}/templates/headless-build/build.properties" prefix="pde.template"/> | |
| <property name="eclipse.baseos" value="${pde.template.baseos}"/> | |
| <property name="eclipse.basews" value="${pde.template.basews}"/> | |
| <property name="eclipse.basearch" value="${pde.template.basearch}"/> | |
| </target> | |
| <target name="locate.eclipse.pde" | |
| if="eclipse.home" | |
| description="Locate org.eclipse.pde.build plug-in and set the property 'eclipse.pde.dir'"> | |
| <first id="eclipse.pde.plugin.dir"> | |
| <dirset dir="${eclipse.home}/plugins"> | |
| <include name="org.eclipse.pde.build_*"/> | |
| </dirset> | |
| </first> | |
| <pathconvert property="eclipse.pde.dir" dirsep="/" refid="eclipse.pde.plugin.dir"/> | |
| </target> | |
| <target name="build.info" | |
| depends="init" | |
| description="Display build configuration"> | |
| <echo message="Target feature ID: ${target.feature}"/> | |
| <echo message="Target feature version: ${target.feature.version}"/> | |
| <echo message="Patch feature ID: ${patch.feature.id}"/> | |
| <echo message="Patch version: ${patch.version}"/> | |
| <echo message="ICU data patch plugin ID: ${icu.patch.plugin.id}"/> | |
| <echo message="ICU data patch plugin version: ${icu.patch.plugin.version}"/> | |
| <echo message="ICU zonfinfo file: ${tz.file}"/> | |
| <echo message="Eclipse project directory: ${project.dir}"/> | |
| <echo message="Eclipse install location: ${eclipse.home}"/> | |
| <echo message="Output archive: ${output.archive}"/> | |
| <echo message="Update site directory: ${update.site.dir}"/> | |
| </target> | |
| <target name="project.files" | |
| depends="init" | |
| description="Collect eclipse project files for the ICU data patch"> | |
| <delete dir="${project.dir}" failonerror="false"/> | |
| <!-- Create features directory --> | |
| <mkdir dir="${project.dir}/features/${patch.feature.id}"/> | |
| <copy todir="${project.dir}/features/${patch.feature.id}"> | |
| <fileset dir="${project.src.dir}/feature"/> | |
| <filterset> | |
| <filter token="TARGET.FEATURE" value="${target.feature}"/> | |
| <filter token="TARGET.FEATURE.VERSION" value="${target.feature.version}"/> | |
| <filter token="OLSON.VERSION" value="${tz.version}"/> | |
| <filter token="COPYRIGHT.YEAR" value="${copyright.year}"/> | |
| <filter token="FEATURE.ID" value="${patch.feature.id}"/> | |
| <filter token="FEATURE.NAME" value="${patch.feature.name}"/> | |
| <filter token="FEATURE.LABEL" value="${patch.feature.label}"/> | |
| <filter token="FEATURE.DESCRIPTION" value="${patch.feature.description}"/> | |
| <filter token="PATCH.VERSION" value="${patch.version}"/> | |
| <filter token="PLUGIN.ID" value="${icu.patch.plugin.id}"/> | |
| <filter token="PLUGIN.VERSION" value="${icu.patch.plugin.version}"/> | |
| </filterset> | |
| </copy> | |
| <!-- Create plugins directory --> | |
| <mkdir dir="${project.dir}/plugins/${icu.patch.plugin.id}"/> | |
| <copy todir="${project.dir}/plugins/${icu.patch.plugin.id}"> | |
| <fileset dir="${project.src.dir}/plugin"/> | |
| <filterset> | |
| <filter token="COPYRIGHT.YEAR" value="${copyright.year}"/> | |
| <filter token="PLUGIN.ID" value="${icu.patch.plugin.id}"/> | |
| <filter token="PLUGIN.VERSION" value="${icu.patch.plugin.version}"/> | |
| <filter token="HOST.VERSION" value="${icu.patch.fragment.host.version}"/> | |
| </filterset> | |
| </copy> | |
| <!-- Copy time zone resource files --> | |
| <property name="icu.data.dir" value="${project.dir}/plugins/${icu.patch.plugin.id}/src/com/ibm/icu/impl/data/icudt${icu.data.version}b"/> | |
| <mkdir dir="${icu.data.dir}"/> | |
| <antcall target="copy.tzdata.new"/> | |
| <antcall target="copy.tzdata.old"/> | |
| </target> | |
| <target name="copy.tzdata.new" if="new.tz.res.dir"> | |
| <copy todir="${icu.data.dir}" verbose="true"> | |
| <fileset dir="${new.tz.res.dir}" includes="**/*.res"/> | |
| </copy> | |
| </target> | |
| <target name="copy.tzdata.old" if="old.tz.res.dir"> | |
| <!-- Copy zoneinfo.res and other resource files --> | |
| <copy todir="${icu.data.dir}" file="${old.tz.res.dir}/${zoneinfo.res.name}" verbose="true"/> | |
| <condition property="copy.zoneinfo.only"> | |
| <or> | |
| <equals arg1="${icu.data.version}" arg2="34"/> | |
| <equals arg1="${icu.data.version}" arg2="36"/> | |
| </or> | |
| </condition> | |
| <antcall target="copy.tzdata.old.other.res"/> | |
| </target> | |
| <target name="copy.tzdata.old.other" unless="copy.zoneinfo.only"> | |
| <copy todir="${icu.data.dir}" verbose="true" failonerror="false"> | |
| <fileset dir="${old.tz.res.dir}" includes="*.res" excludes="${zoneinfo.res.name}"/> | |
| </copy> | |
| <copy file="${old.tz.res.dir}/${icu.data.version}/supplementalData.res" | |
| todir="${icu.data.dir}" | |
| verbose="true" | |
| failonerror="false"/> | |
| </target> | |
| <target name="pde.build" | |
| depends="init, project.files" | |
| if="eclipse.home" | |
| description="Run the PDE tool to build the ICU data patch files"> | |
| <!-- Copy headless-build script files from pde plug-in directory--> | |
| <mkdir dir="${build.dir}/config"/> | |
| <copy todir="${build.dir}/config"> | |
| <fileset dir="${project.src.dir}/buildconfig"/> | |
| <filterset> | |
| <filter token="ECLIPSE.BASE.LOCATION" value="${eclipse.home}"/> | |
| <filter token="ECLIPSE.OS" value="${eclipse.baseos}"/> | |
| <filter token="ECLIPSE.WS" value="${eclipse.basews}"/> | |
| <filter token="ECLIPSE.ARCH" value="${eclipse.basearch}"/> | |
| <filter token="FEATURE.ID" value="${patch.feature.id}"/> | |
| <filter token="PROJECT.DIR" value="${project.dir}"/> | |
| <filter token="OUT.ARC.ROOT" value=""/> | |
| <filter token="BUILD.ID" value="${patch.version}"/> | |
| <filter token="BUILD.LABEL" value="${build.label}"/> | |
| </filterset> | |
| </copy> | |
| <!-- Invoke PDE tool to build the feature --> | |
| <java jar="${eclipse.launcher}" fork="true" failonerror="true"> | |
| <arg value="-application"/> | |
| <arg value="org.eclipse.ant.core.antRunner"/> | |
| <arg value="-buildfile"/> | |
| <arg value="${eclipse.pde.dir}/scripts/build.xml"/> | |
| <arg value="-Dbuilder=${build.dir}/config"/> | |
| </java> | |
| </target> | |
| <target name="update.site" | |
| depends="init, pde.build" | |
| description="Build eclipse ICU plug-in data patch and copy them to the test update site"> | |
| <mkdir dir="${update.site.dir}"/> | |
| <unzip src="${output.archive}" dest="${update.site.dir}"/> | |
| <copy todir="${update.site.dir}" file="${project.src.dir}/site/site.xml"> | |
| <filterset> | |
| <filter token="FEATURE.ID" value="${patch.feature.id}"/> | |
| <filter token="PATCH.VERSION" value="${patch.version}"/> | |
| <filter token="SITE.CATEGORY.NAME" value="${update.site.category.name}"/> | |
| <filter token="SITE.CATEGORY.LABEL" value="${update.site.category.label}"/> | |
| </filterset> | |
| </copy> | |
| </target> | |
| <target name="copy.results" | |
| depends="init" | |
| description="Copy the build results to the release location"> | |
| <delete dir="${relaese.dir}"/> | |
| <mkdir dir="${release.dir}"/> | |
| <!-- copy the property file --> | |
| <copy file="icu_data_patch.properties" | |
| todir="${release.dir}"/> | |
| <!-- copy the update site files --> | |
| <mkdir dir="${release.dir}/updatesite"/> | |
| <copy todir="${release.dir}/updatesite"> | |
| <fileset dir="${update.site.dir}"/> | |
| </copy> | |
| </target> | |
| <target name="build.all" | |
| depends="build.info, project.files, pde.build, update.site, copy.results" | |
| description="Build ICU plug-in data patch"> | |
| </target> | |
| <target name="clean" depends="init"> | |
| <delete dir="${build.dir}"/> | |
| <delete dir="${release.dir}"/> | |
| </target> | |
| </project> |