xref: /aosp_15_r20/build/bazel/scripts/incremental_build/pretty.sh (revision 7594170e27e0732bc44b93d1440d87a54b6ffe7c)
1*7594170eSAndroid Build Coastguard Worker#!/bin/bash -eu
2*7594170eSAndroid Build Coastguard Worker#
3*7594170eSAndroid Build Coastguard Worker# Copyright (C) 2023 The Android Open Source Project
4*7594170eSAndroid Build Coastguard Worker#
5*7594170eSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
6*7594170eSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
7*7594170eSAndroid Build Coastguard Worker# You may obtain a copy of the License at
8*7594170eSAndroid Build Coastguard Worker#
9*7594170eSAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
10*7594170eSAndroid Build Coastguard Worker#
11*7594170eSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
12*7594170eSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
13*7594170eSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*7594170eSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
15*7594170eSAndroid Build Coastguard Worker# limitations under the License.
16*7594170eSAndroid Build Coastguard Worker
17*7594170eSAndroid Build Coastguard Workerreadonly TOP="$(realpath "$(dirname "$0")/../../../..")"
18*7594170eSAndroid Build Coastguard Workerif [[ -z ${OUT_DIR+x} ]]; then
19*7594170eSAndroid Build Coastguard Worker  OUT_DIR="$TOP/out"
20*7594170eSAndroid Build Coastguard Workerfi
21*7594170eSAndroid Build Coastguard Worker
22*7594170eSAndroid Build Coastguard Workerif [[ ! -f ${OUT_DIR}/soong/workspace/WORKSPACE ]]; then
23*7594170eSAndroid Build Coastguard Worker  "$TOP/build/soong/soong_ui.bash" \
24*7594170eSAndroid Build Coastguard Worker    --build-mode \
25*7594170eSAndroid Build Coastguard Worker    --all-modules \
26*7594170eSAndroid Build Coastguard Worker    --dir="$(pwd)" \
27*7594170eSAndroid Build Coastguard Worker    --skip-soong-tests \
28*7594170eSAndroid Build Coastguard Worker    bp2build
29*7594170eSAndroid Build Coastguard Workerfi
30*7594170eSAndroid Build Coastguard Worker
31*7594170eSAndroid Build Coastguard WorkerANDROID_BUILD_TOP=$TOP "$TOP/build/bazel/bin/bazel" \
32*7594170eSAndroid Build Coastguard Worker  run --config=bp2build --verbose_failures \
33*7594170eSAndroid Build Coastguard Worker  //build/bazel/scripts/incremental_build:pretty -- "$@"
34