1#!/bin/bash 2# 3# Copyright (C) 2022 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17# Set up prog to be the path of this script, including following 18# symlinks, and set up progdir to be the fully-qualified pathname of 19# its directory. Switch the current directory to progdir for the 20# remainder of the script. 21set -e 22 23if [[ -z ${ANDROID_BUILD_TOP} ]]; then 24 echo ANDROID_BUILD_TOP not set 25 exit 1 26fi 27 28OJLUNI_JAVA_ROOT=${ANDROID_BUILD_TOP}/libcore/ojluni/src/main/java 29 30AWK=awk SCRIPTS=${ANDROID_BUILD_TOP}/libcore/ojluni/src/tools/scripts/ \ 31${ANDROID_BUILD_TOP}/libcore/ojluni/src/tools/scripts/genExceptions.sh \ 32 ${OJLUNI_JAVA_ROOT}/java/nio/charset/exceptions \ 33 ${OJLUNI_JAVA_ROOT}/java/nio/charset 34 35MAKE_ROOT=${ANDROID_BUILD_TOP}/libcore/ojluni/src/tools/make 36gmake -C ${MAKE_ROOT} all 37 38JAVA_NIO_OUT=${MAKE_ROOT}/out/gensrc/java.base/java/nio 39OJLUNI_NIO_ROOT=${OJLUNI_JAVA_ROOT}/java/nio 40cp ${JAVA_NIO_OUT}/charset/CharsetEncoder.java \ 41 ${OJLUNI_NIO_ROOT}/charset/CharsetEncoder.java 42cp ${JAVA_NIO_OUT}/charset/CharsetDecoder.java \ 43 ${OJLUNI_NIO_ROOT}/charset/CharsetDecoder.java 44 45NIO_CLASSES=( 46 "HeapByteBuffer" 47 "HeapCharBuffer" 48 "HeapDoubleBuffer" 49 "HeapFloatBuffer" 50 "HeapIntBuffer" 51 "HeapLongBuffer" 52 "HeapShortBuffer" 53 "ByteBuffer" 54 "CharBuffer" 55 "DoubleBuffer" 56 "FloatBuffer" 57 "IntBuffer" 58 "LongBuffer" 59 "ShortBuffer" 60) 61 62for clazz in ${NIO_CLASSES[*]}; do 63 cp ${JAVA_NIO_OUT}/${clazz}.java ${OJLUNI_NIO_ROOT}/${clazz}.java 64done 65 66NIO_AS_CLASSES=( 67 "ByteBufferAsCharBuffer" 68 "ByteBufferAsDoubleBuffer" 69 "ByteBufferAsFloatBuffer" 70 "ByteBufferAsIntBuffer" 71 "ByteBufferAsLongBuffer" 72 "ByteBufferAsShortBuffer" 73) 74 75for clazz in ${NIO_AS_CLASSES[*]}; do 76 cp ${JAVA_NIO_OUT}/${clazz}L.java ${OJLUNI_NIO_ROOT}/${clazz}.java 77done 78 79pushd ${ANDROID_BUILD_TOP}/libcore/ojluni/src/test/java/nio/Buffer/ 80./genBasic.sh 81./genCopyDirectMemory.sh 82./genOrder.sh 83popd 84