Neil Fuller | 04b2285 | 2015-10-26 16:21:44 +0000 | [diff] [blame] | 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 | |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 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 | |
Neil Fuller | 04b2285 | 2015-10-26 16:21:44 +0000 | [diff] [blame] | 36 | # Build the srcgen tools. |
Neil Fuller | c41fc78 | 2015-12-04 15:59:21 +0000 | [diff] [blame] | 37 | cd ${ANDROID_BUILD_TOP} |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 38 | if [ -z "$DO_NOT_MAKE" ]; then |
| 39 | make -j16 android_icu4j_srcgen_binary |
| 40 | fi |
Neil Fuller | 04b2285 | 2015-10-26 16:21:44 +0000 | [diff] [blame] | 41 | |
Neil Fuller | 9189af5 | 2018-10-01 17:25:00 +0100 | [diff] [blame] | 42 | ICU_SRCGEN_DIR=${ANDROID_BUILD_TOP}/external/icu/tools/srcgen |
Neil Fuller | cc49f81 | 2015-11-02 18:18:32 +0000 | [diff] [blame] | 43 | ICU4J_DIR=${ANDROID_BUILD_TOP}/external/icu/icu4j |
Neil Fuller | 04b2285 | 2015-10-26 16:21:44 +0000 | [diff] [blame] | 44 | ANDROID_ICU4J_DIR=${ANDROID_BUILD_TOP}/external/icu/android_icu4j |
| 45 | |
Neil Fuller | 392019a | 2018-07-12 14:36:43 +0100 | [diff] [blame] | 46 | CLASSPATH=${ANDROID_HOST_OUT}/framework/currysrc.jar:${ANDROID_HOST_OUT}/framework/android_icu4j_srcgen.jar |
Paul Duffin | 69ef1ba | 2016-02-26 16:21:51 +0000 | [diff] [blame] | 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 |
Neil Fuller | 04b2285 | 2015-10-26 16:21:44 +0000 | [diff] [blame] | 53 | INPUT_DIRS="\ |
Neil Fuller | cc49f81 | 2015-11-02 18:18:32 +0000 | [diff] [blame] | 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 \ |
Neil Fuller | 04b2285 | 2015-10-26 16:21:44 +0000 | [diff] [blame] | 68 | " |
Paul Duffin | 69ef1ba | 2016-02-26 16:21:51 +0000 | [diff] [blame] | 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 \ |
Paul Duffin | 69ef1ba | 2016-02-26 16:21:51 +0000 | [diff] [blame] | 75 | ${TEST_INPUT_DIR}/translit/src \ |
| 76 | ${TEST_INPUT_DIR}/core/src \ |
Nikita Iashchenko | 5ef2525 | 2019-12-10 18:06:30 +0000 | [diff] [blame] | 77 | ${TEST_INPUT_DIR}/packaging/src \ |
| 78 | ${ICU4J_DIR}/tools/misc/src/com/ibm/icu/dev/tool/locale" |
Neil Fuller | ff178d4 | 2016-06-08 19:07:01 +0200 | [diff] [blame] | 79 | |
| 80 | # Allow override of the java runtime to avoid http://b/27775477 |
| 81 | SRCGEN_JAVA_BINARY=${SRCGEN_JAVA_BINARY:-java} |