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 17 set -e 18 19 if [[ -z ${ANDROID_BUILD_TOP} ]]; then 20 echo ANDROID_BUILD_TOP not set 21 exit 1 22 fi 23 24 # source envsetup.sh because functions we use like mm are not exported. 25 source ${ANDROID_BUILD_TOP}/build/envsetup.sh 26 27 # Build Options used by Android.bp 28 while true; do 29 case "$1" in 30 --do-not-make ) DO_NOT_MAKE=1; shift ;; 31 -- ) shift; break ;; 32 * ) break ;; 33 esac 34 done 35 36 # Build the srcgen tools. 37 cd ${ANDROID_BUILD_TOP} 38 if [ -z "$DO_NOT_MAKE" ]; then 39 make -j16 android_icu4j_srcgen_binary 40 fi 41 42 ICU_SRCGEN_DIR=${ANDROID_BUILD_TOP}/external/icu/tools/srcgen 43 ICU4J_DIR=${ANDROID_BUILD_TOP}/external/icu/icu4j 44 ANDROID_ICU4J_DIR=${ANDROID_BUILD_TOP}/external/icu/android_icu4j 45 46 CLASSPATH=${ANDROID_HOST_OUT}/framework/currysrc.jar:${ANDROID_HOST_OUT}/framework/android_icu4j_srcgen.jar 47 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 53 INPUT_DIRS="\ 54 ${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 62 SAMPLE_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. 64 SAMPLE_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 \ 68 " 69 70 # See above for an explanation as to why the tests for charset and localespi are not included here. 71 TEST_INPUT_DIR=${ICU4J_DIR}/main/tests 72 TEST_INPUT_DIRS="\ 73 ${TEST_INPUT_DIR}/collate/src \ 74 ${TEST_INPUT_DIR}/framework/src \ 75 ${TEST_INPUT_DIR}/translit/src \ 76 ${TEST_INPUT_DIR}/core/src \ 77 ${TEST_INPUT_DIR}/packaging/src" 78 79 # Allow override of the java runtime to avoid http://b/27775477 80 SRCGEN_JAVA_BINARY=${SRCGEN_JAVA_BINARY:-java} 81