blob: 31a067012d0e7ba0d95850eead834247f311d19c [file] [log] [blame]
Neil Fuller04b22852015-10-26 16:21:44 +00001# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Common variables and actions for inclusion in srcgen scripts.
16
17set -e
18
19if [[ -z ${ANDROID_BUILD_TOP} ]]; then
20 echo ANDROID_BUILD_TOP not set
21 exit 1
22fi
23
24# source envsetup.sh because functions we use like mm are not exported.
25source ${ANDROID_BUILD_TOP}/build/envsetup.sh
26
Victor Change9935982018-09-21 14:55:40 +010027# Build Options used by Android.bp
28while true; do
29 case "$1" in
30 --do-not-make ) DO_NOT_MAKE=1; shift ;;
31 -- ) shift; break ;;
32 * ) break ;;
33 esac
34done
35
Neil Fuller04b22852015-10-26 16:21:44 +000036# Build the srcgen tools.
Neil Fullerc41fc782015-12-04 15:59:21 +000037cd ${ANDROID_BUILD_TOP}
Victor Change9935982018-09-21 14:55:40 +010038if [ -z "$DO_NOT_MAKE" ]; then
39 make -j16 android_icu4j_srcgen_binary
40fi
Neil Fuller04b22852015-10-26 16:21:44 +000041
Neil Fuller9189af52018-10-01 17:25:00 +010042ICU_SRCGEN_DIR=${ANDROID_BUILD_TOP}/external/icu/tools/srcgen
Neil Fullercc49f812015-11-02 18:18:32 +000043ICU4J_DIR=${ANDROID_BUILD_TOP}/external/icu/icu4j
Neil Fuller04b22852015-10-26 16:21:44 +000044ANDROID_ICU4J_DIR=${ANDROID_BUILD_TOP}/external/icu/android_icu4j
45
Neil Fuller392019a2018-07-12 14:36:43 +010046CLASSPATH=${ANDROID_HOST_OUT}/framework/currysrc.jar:${ANDROID_HOST_OUT}/framework/android_icu4j_srcgen.jar
Paul Duffin69ef1ba2016-02-26 16:21:51 +000047
48# The parts of ICU4J to include during srcgen.
49#
50# The following are deliberately excluded:
51# localespi - is not supported on Android
52# charset - because icu4c is used instead
Neil Fuller04b22852015-10-26 16:21:44 +000053INPUT_DIRS="\
Neil Fullercc49f812015-11-02 18:18:32 +000054 ${ICU4J_DIR}/main/classes/collate/src \
55 ${ICU4J_DIR}/main/classes/core/src \
56 ${ICU4J_DIR}/main/classes/currdata/src \
57 ${ICU4J_DIR}/main/classes/langdata/src \
58 ${ICU4J_DIR}/main/classes/regiondata/src \
59 ${ICU4J_DIR}/main/classes/translit/src \
60 "
61
62SAMPLE_INPUT_DIR=${ICU4J_DIR}/samples/src/com/ibm/icu/samples
63# Only generate sample files for code we know should compile on Android with the public APIs.
64SAMPLE_INPUT_FILES="\
65 ${SAMPLE_INPUT_DIR}/text/dateintervalformat/DateIntervalFormatSample.java \
66 ${SAMPLE_INPUT_DIR}/text/datetimepatterngenerator/DateTimePatternGeneratorSample.java \
67 ${SAMPLE_INPUT_DIR}/text/pluralformat/PluralFormatSample.java \
Neil Fuller04b22852015-10-26 16:21:44 +000068 "
Paul Duffin69ef1ba2016-02-26 16:21:51 +000069
70# See above for an explanation as to why the tests for charset and localespi are not included here.
71TEST_INPUT_DIR=${ICU4J_DIR}/main/tests
72TEST_INPUT_DIRS="\
73 ${TEST_INPUT_DIR}/collate/src \
74 ${TEST_INPUT_DIR}/framework/src \
Paul Duffin69ef1ba2016-02-26 16:21:51 +000075 ${TEST_INPUT_DIR}/translit/src \
76 ${TEST_INPUT_DIR}/core/src \
Nikita Iashchenko5ef25252019-12-10 18:06:30 +000077 ${TEST_INPUT_DIR}/packaging/src \
78 ${ICU4J_DIR}/tools/misc/src/com/ibm/icu/dev/tool/locale"
Neil Fullerff178d42016-06-08 19:07:01 +020079
80# Allow override of the java runtime to avoid http://b/27775477
81SRCGEN_JAVA_BINARY=${SRCGEN_JAVA_BINARY:-java}