• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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
27# Build the srcgen tools.
28cd ${ANDROID_BUILD_TOP}
29make -j16 android_icu4j_srcgen
30
31ICU4J_DIR=${ANDROID_BUILD_TOP}/external/icu/icu4j
32ANDROID_ICU4J_DIR=${ANDROID_BUILD_TOP}/external/icu/android_icu4j
33
34CLASSPATH=${ANDROID_BUILD_TOP}/out/host/common/obj/JAVA_LIBRARIES/currysrc_intermediates/javalib.jar:${ANDROID_BUILD_TOP}/out/host/common/obj/JAVA_LIBRARIES/android_icu4j_srcgen_intermediates/javalib.jar
35
36# The parts of ICU4J to include during srcgen.
37#
38# The following are deliberately excluded:
39#   localespi - is not supported on Android
40#   charset - because icu4c is used instead
41INPUT_DIRS="\
42    ${ICU4J_DIR}/main/classes/collate/src \
43    ${ICU4J_DIR}/main/classes/core/src \
44    ${ICU4J_DIR}/main/classes/currdata/src \
45    ${ICU4J_DIR}/main/classes/langdata/src \
46    ${ICU4J_DIR}/main/classes/regiondata/src \
47    ${ICU4J_DIR}/main/classes/translit/src \
48    "
49
50SAMPLE_INPUT_DIR=${ICU4J_DIR}/samples/src/com/ibm/icu/samples
51# Only generate sample files for code we know should compile on Android with the public APIs.
52SAMPLE_INPUT_FILES="\
53    ${SAMPLE_INPUT_DIR}/text/dateintervalformat/DateIntervalFormatSample.java \
54    ${SAMPLE_INPUT_DIR}/text/datetimepatterngenerator/DateTimePatternGeneratorSample.java \
55    ${SAMPLE_INPUT_DIR}/text/pluralformat/PluralFormatSample.java \
56    "
57
58# See above for an explanation as to why the tests for charset and localespi are not included here.
59TEST_INPUT_DIR=${ICU4J_DIR}/main/tests
60TEST_INPUT_DIRS="\
61    ${TEST_INPUT_DIR}/collate/src \
62    ${TEST_INPUT_DIR}/framework/src \
63    ${TEST_INPUT_DIR}/translit/src \
64    ${TEST_INPUT_DIR}/core/src \
65    ${TEST_INPUT_DIR}/packaging/src"
66
67# Allow override of the java runtime to avoid http://b/27775477
68SRCGEN_JAVA_BINARY=${SRCGEN_JAVA_BINARY:-java}
69