xref: /aosp_15_r20/build/bazel/ci/ensure_allowlist_integrity.sh (revision 7594170e27e0732bc44b93d1440d87a54b6ffe7c)
1#!/bin/bash -eu
2
3# Copyright (C) 2023 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# Verifies that the soong mixed_build allowlists are fully-Bazelable.
18if [[ -z ${OUT_DIR+x} ]]; then
19  OUT_DIR="out"
20fi
21
22if [[ -z ${DIST_DIR+x} ]]; then
23  echo "DIST_DIR not set. Using ${OUT_DIR}/dist. This should only be used for manual developer testing."
24  DIST_DIR="${OUT_DIR}/dist"
25fi
26
27if [[ -z ${TARGET_PRODUCT+x} ]]; then
28  echo "TARGET_PRODUCT not set. Using aosp_arm64"
29  TARGET_PRODUCT=aosp_arm64
30fi
31
32if [[ -z ${TARGET_BUILD_VARIANT+x} ]]; then
33  echo "TARGET_BUILD_VARIANT not set. Using userdebug"
34  TARGET_BUILD_VARIANT=userdebug
35fi
36
37build/soong/soong_ui.bash --make-mode \
38  --mk-metrics \
39  BAZEL_STARTUP_ARGS="--max_idle_secs=5" \
40  BAZEL_BUILD_ARGS="--color=no --curses=no --show_progress_rate_limit=5" \
41  TARGET_PRODUCT=${TARGET_PRODUCT} \
42  TARGET_BUILD_VARIANT=${TARGET_BUILD_VARIANT} \
43  --bazel-mode-staging \
44  --ensure-allowlist-integrity \
45  nothing \
46  dist DIST_DIR=$DIST_DIR
47