<!--
/*
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html#License
*******************************************************************************
* Copyright (C) 2010,2016, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
-->
<project name="icu4j-eclipse" default="build" basedir=".">
<property file="build-local.properties"/>
<property file="build.properties"/>
<property name="out.dir" value="out"/>
<property name="eclipse.projects.dir" value="${out.dir}/projects"/>
<property name="main.dir" value="../main"/>
<property name="shared.dir" value="${main.dir}/shared"/>
<import file="${shared.dir}/build/common-targets.xml"/>
<property file="${shared.dir}/build/common.properties"/>
<property file="${shared.dir}/build/locations.properties"/>
<property environment="env"/>
<target name="clean" description="Delete all build outputs">
<delete dir="${out.dir}"/>
</target>
<target name="build"
depends="checkProps,initEnv,icuProjectFiles,icuTestsProjectFiles,icuBaseProjectFiles,icuBaseTestsProjectFiles"
description="Build icu4j plug-ins">
<!-- copy OSGi jar file to baseLocation -->
<mkdir dir="${eclipse.projects.dir}/baseLocation/features"/>
<mkdir dir="${eclipse.projects.dir}/baseLocation/plugins"/>
<copy toDir="${eclipse.projects.dir}/baseLocation/plugins" file="${eclipse.osgi.jar}"/>
<!-- copy PDE build script files and run the build -->
<pathconvert property="eclipse.projects.dir.full" dirsep="/">
<path location="${basedir}/${eclipse.projects.dir}"/>
</pathconvert>
<antcall target="runEclipsePDEBuild">
<param name="icu.plugin.id" value="com.ibm.icu"/>
</antcall>
<antcall target="runEclipsePDEBuild">
<param name="icu.plugin.id" value="com.ibm.icu.base"/>
</antcall>
</target>
<target name="initEclipseHome"
if="env.ECLIPSE_HOME"
unless="eclipse.home"
description="Initialize the property eclipse.home from the environment variable ECLIPSE_HOME">
<property name="eclipse.home" value="${env.ECLIPSE_HOME}"/>
</target>
<target name="checkProps" depends="initEclipseHome">
<fail message="Eclipse home (eclipse.home or env.ECLIPSE_HOME) is not set">
<condition>
<or>
<equals arg1="${eclipse.home}" arg2=""/>
<not>
<isset property="eclipse.home"/>
</not>
</or>
</condition>
</fail>
<fail message="Java runtime jar path (java.rt) is not set">
<condition>
<or>
<equals arg1="${java.rt}" arg2=""/>
<not>
<isset property="java.rt"/>
</not>
</or>
</condition>
</fail>
</target>
<target name="initPluginVersion">
<tstamp>
<format property="build.date" pattern="yyyyMMdd"/>
</tstamp>
<property name="icu4j.eclipse.build.version.string" value="${icu4j.plugin.impl.version.string}.v${build.date}"/>
</target>
<target name="initEnv"
depends="checkProps,initEclipseLauncher,initEclipseOSGiJar,initEclipsePDE"
description="Initialize eclipse PDE build environment">
<echo message="[PDE build configuration properties]"/>
<echo message=" Ant version: ${ant.version}"/>
<echo message=" Eclipse home: ${eclipse.home}"/>
<echo message=" Launcher jar: ${eclipse.launcher}"/>
<echo message=" OSGi bundle jar: ${eclipse.osgi.jar}"/>
<echo message=" Base OS: ${eclipse.baseos}"/>
<echo message=" Base WS: ${eclipse.basews}"/>
<echo message=" Base ARCH: ${eclipse.basearch}"/>
<echo message=" java.rt: ${java.rt}"/>
<!-- try and detect use of backslashes -->
<condition property="java-rt-has-noSlashes">
<matches pattern="/" string="${java.rt}"/>
</condition>
<fail message="java.rt variable has no slashes!" unless="java-rt-has-noSlashes"/>
</target>
<target name="initEclipseLauncher"
if="eclipse.home"
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="initEclipseOSGiJar"
if="eclipse.home"
description="Locate org.eclipse.osgi plugin jar file">
<first id="osgi.bundle">
<fileset dir="${eclipse.home}/plugins">
<include name="org.eclipse.osgi_*.jar"/>
</fileset>
</first>
<pathconvert property="eclipse.osgi.jar" dirsep="/" refid="osgi.bundle"/>
</target>
<target name="initEclipsePDE"
depends="locateEclipsePDE"
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="locateEclipsePDE"
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="runEclipsePDEBuild">
<mkdir dir="${eclipse.projects.dir}/buildScripts/${icu.plugin.id}"/>
<copy toDir="${eclipse.projects.dir}/buildScripts/${icu.plugin.id}">
<fileset dir="pdebuild" includes="**/*"/>
<filterset>
<filter token="PLUGIN_ID" value="${icu.plugin.id}"/>
<filter token="BUILD_DIR" value="${eclipse.projects.dir.full}"/>
<filter token="BUILD_TYPE" value="ICU4J"/>
<filter token="BUILD_ID" value="${icu.plugin.id}"/>
<filter token="BASE_LOCATION" value="${eclipse.projects.dir.full}/baseLocation"/>
<filter token="BASE_OS" value="${eclipse.baseos}"/>
<filter token="BASE_WS" value="${eclipse.basews}"/>
<filter token="BASE_ARCH" value="${eclipse.basearch}"/>
<filter token="JAVA_RT" value="${java.rt}"/>
</filterset>
</copy>
<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=${eclipse.projects.dir.full}/buildScripts/${icu.plugin.id}"/>
</java>
</target>
<target name="icuProjectFiles"
depends="initPluginVersion"
description="Copy com.ibm.icu plug-in project files">
<delete failonerror="no">
<fileset dir="${eclipse.projects.dir}/plugins/com.ibm.icu" />
<fileset dir="${eclipse.projects.dir}/features/com.ibm.icu" />
</delete>
<!-- icu source -->
<copy toDir="${eclipse.projects.dir}/plugins/com.ibm.icu/src">
<fileset dir="${icu4j.collate.dir}/src"/>
<fileset dir="${icu4j.core.dir}/src"/>
<fileset dir="${icu4j.currdata.dir}/src"/>
<fileset dir="${icu4j.langdata.dir}/src"/>
<fileset dir="${icu4j.regiondata.dir}/src"/>
<fileset dir="${icu4j.translit.dir}/src"/>
</copy>
<!-- overwriting the ICU runtime configuration file for forcing ICU4J plugin to use JDK time zone rules -->
<copy file="misc/ICUConfig.properties"
toDir="${eclipse.projects.dir}/plugins/com.ibm.icu/src/com/ibm/icu"
overwrite="true"/>
<!-- icu data -->
<unjar src="${icu4j.data.jar}" dest="${eclipse.projects.dir}/plugins/com.ibm.icu/src">
<patternset>
<exclude name="META-INF"/>
<exclude name="META-INF/**/*"/>
<exclude name="**/*.cnv"/>
<exclude name="**/cnvalias.icu"/>
</patternset>
</unjar>
<!-- icu tz data -->
<unjar src="${icu4j.tzdata.jar}" dest="${eclipse.projects.dir}/plugins/com.ibm.icu/src">
<patternset>
<exclude name="META-INF"/>
<exclude name="META-INF/**/*"/>
</patternset>
</unjar>
<!-- full locale names lists -->
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}"/>
</antcall>
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}/brkitr"/>
</antcall>
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}/coll"/>
</antcall>
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}/curr"/>
</antcall>
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}/lang"/>
</antcall>
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}/rbnf"/>
</antcall>
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}/region"/>
</antcall>
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}/translit"/>
</antcall>
<antcall target="@full-locale-names">
<param name="res.dir" value="${eclipse.projects.dir}/plugins/com.ibm.icu/src/${icu4j.data.path}/zone"/>
</antcall>
<!-- plugin project -->
<copy todir="${eclipse.projects.dir}/plugins/com.ibm.icu">
<fileset dir="plugins.template/com.ibm.icu"/>
<filterset>
<filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
<filter token="COPYRIGHT" value="${copyright.eclipse}" />
<filter token="IMPL_VERSION" value="${icu4j.impl.version}" />
<filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
</filterset>
</copy>
<!-- license -->
<copy file="${shared.dir}/licenses/LICENSE"
todir="${eclipse.projects.dir}/plugins/com.ibm.icu/about_files" />
<!-- about -->
<copy file="misc/about_icu.html"
tofile="${eclipse.projects.dir}/plugins/com.ibm.icu/about.html" />
<!-- FEATURE FILES -->
<copy todir="${eclipse.projects.dir}/features/com.ibm.icu">
<fileset dir="features.template/com.ibm.icu"/>
<filterset>
<filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
<filter token="COPYRIGHT" value="${copyright.eclipse}" />
<filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
</filterset>
</copy>
</target>
<target name="icuTestsProjectFiles"
depends="initPluginVersion"
description="Copy com.ibm.icu.tests plug-in project files">
<delete failonerror="no">
<fileset dir="${eclipse.projects.dir}/plugins/com.ibm.icu.tests" />
</delete>
<!-- icu test source -->
<copy toDir="${eclipse.projects.dir}/plugins/com.ibm.icu.tests/src">
<fileset dir="${icu4j.test-framework.dir}/src"/>
<fileset dir="${icu4j.core-tests.dir}/src"/>
<fileset dir="${icu4j.collate-tests.dir}/src"/>
<fileset dir="${icu4j.translit-tests.dir}/src"/>
</copy>
<!-- icu test data -->
<unjar src="${icu4j.testdata.jar}" dest="${eclipse.projects.dir}/plugins/com.ibm.icu.tests/src">
<patternset>
<exclude name="**/*.cnv"/>
<exclude name="**/cnvalias.icu"/>
<exclude name="META-INF"/>
<exclude name="META-INF/**/*"/>
</patternset>
</unjar>
<!-- plugin project -->
<copy todir="${eclipse.projects.dir}/plugins/com.ibm.icu.tests">
<fileset dir="plugins.template/com.ibm.icu.tests"/>
<filterset>
<filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
<filter token="COPYRIGHT" value="${copyright.eclipse}" />
<filter token="IMPL_VERSION" value="${icu4j.impl.version}" />
<filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
</filterset>
</copy>
<!-- license -->
<copy file="${shared.dir}/licenses/LICENSE"
todir="${eclipse.projects.dir}/plugins/com.ibm.icu.tests/about_files" />
<!-- about -->
<copy file="misc/about_icu.html"
tofile="${eclipse.projects.dir}/plugins/com.ibm.icu.tests/about.html" />
</target>
<target name="icuBaseProjectFiles"
depends="initPluginVersion"
description="Copy com.ibm.icu.base plug-in project files">
<delete failonerror="no">
<fileset dir="${eclipse.projects.dir}/plugins/com.ibm.icu.base" />
<fileset dir="${eclipse.projects.dir}/features/com.ibm.icu.base" />
</delete>
<!-- plugin project -->
<copy todir="${eclipse.projects.dir}/plugins/com.ibm.icu.base">
<fileset dir="plugins.template/com.ibm.icu.base"/>
<filterset>
<filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
<filter token="COPYRIGHT" value="${copyright.eclipse}" />
<filter token="IMPL_VERSION" value="${icu4j.impl.version}" />
<filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
</filterset>
</copy>
<!-- license -->
<copy file="${shared.dir}/licenses/LICENSE"
todir="${eclipse.projects.dir}/plugins/com.ibm.icu.base/about_files" />
<!-- about -->
<copy file="misc/about_icu.html"
tofile="${eclipse.projects.dir}/plugins/com.ibm.icu.base/about.html" />
<!-- FEATURE FILES -->
<copy todir="${eclipse.projects.dir}/features/com.ibm.icu.base">
<fileset dir="features.template/com.ibm.icu.base"/>
<filterset>
<filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
<filter token="COPYRIGHT" value="${copyright.eclipse}" />
<filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
</filterset>
</copy>
</target>
<target name="icuBaseTestsProjectFiles"
depends="initPluginVersion"
description="Copy com.ibm.icu.base.tests plug-in project files">
<delete failonerror="no">
<fileset dir="${eclipse.projects.dir}/plugins/com.ibm.icu.base.tests" />
</delete>
<!-- plugin project -->
<copy todir="${eclipse.projects.dir}/plugins/com.ibm.icu.base.tests">
<fileset dir="plugins.template/com.ibm.icu.base.tests"/>
<filterset>
<filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
<filter token="COPYRIGHT" value="${copyright.eclipse}" />
<filter token="IMPL_VERSION" value="${icu4j.impl.version}" />
<filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
</filterset>
</copy>
<!-- license -->
<copy file="${shared.dir}/licenses/LICENSE"
todir="${eclipse.projects.dir}/plugins/com.ibm.icu.base.tests/about_files" />
<!-- about -->
<copy file="misc/about_icu.html"
tofile="${eclipse.projects.dir}/plugins/com.ibm.icu.base.tests/about.html" />
</target>
</project>