xref: /aosp_15_r20/external/bouncycastle/srcgen_platform/generate_android_src.sh (revision 4e4b8e5883c385eeacd42791bab3326d1395de26)
1#!/bin/bash
2# Copyright (C) 2018 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16if [[ -z "${ANDROID_BUILD_TOP}" ]]; then
17    echo "Missing environment variables. Did you run build/envsetup.sh and lunch?" >&2
18    exit 1
19fi
20
21PROJECT_DIR=external/bouncycastle
22
23PACKAGE_TRANSFORMATIONS="\
24    org.bouncycastle:com.android.internal.org.bouncycastle \
25"
26
27MODULE_DIRS="\
28    bcprov \
29    bcpkix \
30"
31DEFAULT_CONSTRUCTORS_FILE=${BOUNCY_CASTLE_DIR}/srcgen/default-constructors.txt
32
33REPACKAGED_DIR="${ANDROID_BUILD_TOP}/${PROJECT_DIR}/repackaged_platform"
34
35SOURCE_DIRS="\
36    src/main/java \
37"
38
39SRCGEN_DIR=${PROJECT_DIR}/srcgen_platform
40
41# Repackage the project's source.
42source ${ANDROID_BUILD_TOP}/tools/currysrc/scripts/repackage-common.sh
43
44# Remove some unused source files:
45rm -fr ${REPACKAGED_DIR}/bcprov/src/main/java/com/android/org/bouncycastle/asn1/ocsp/
46rm -fr ${REPACKAGED_DIR}/bcpkix/src/main/java/com/android/org/bouncycastle/cert/ocsp/
47rm -fr ${REPACKAGED_DIR}/bcpkix/src/main/java/com/android/org/bouncycastle/cmc/
48rm -fr ${REPACKAGED_DIR}/bcpkix/src/main/java/com/android/org/bouncycastle/openssl/
49rm -fr ${REPACKAGED_DIR}/bcpkix/src/main/java/com/android/org/bouncycastle/pkix/
50