Alex Light | a02094f | 2018-12-11 10:41:52 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2018 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 | # This will build a target using linux_bionic. It can be called with normal make |
| 18 | # flags. |
Alex Light | a02094f | 2018-12-11 10:41:52 -0800 | [diff] [blame] | 19 | |
Martin Stjernholm | 1048bb7 | 2022-04-13 16:22:30 +0100 | [diff] [blame] | 20 | set -e |
Alex Light | a02094f | 2018-12-11 10:41:52 -0800 | [diff] [blame] | 21 | |
| 22 | if [ ! -d art ]; then |
| 23 | echo "Script needs to be run at the root of the android tree" |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
Martin Stjernholm | 288b2f1 | 2022-04-13 19:11:34 +0100 | [diff] [blame] | 27 | export TARGET_PRODUCT=linux_bionic |
| 28 | |
| 29 | # Avoid Soong error about invalid dependencies on disabled libLLVM_android, |
| 30 | # which we get due to the --soong-only mode. (Another variant is to set |
| 31 | # SOONG_ALLOW_MISSING_DEPENDENCIES). |
| 32 | export FORCE_BUILD_LLVM_COMPONENTS=true |
| 33 | |
Martin Stjernholm | f7e4c3d | 2021-07-23 00:17:36 +0100 | [diff] [blame] | 34 | # TODO(b/194433871): Set MODULE_BUILD_FROM_SOURCE to disable prebuilt modules, |
Colin Cross | 0a42f1e | 2021-10-28 16:31:03 -0700 | [diff] [blame] | 35 | # which Soong otherwise can create duplicate install rules for in --soong-only |
Martin Stjernholm | f7e4c3d | 2021-07-23 00:17:36 +0100 | [diff] [blame] | 36 | # mode. |
Martin Stjernholm | 288b2f1 | 2022-04-13 19:11:34 +0100 | [diff] [blame] | 37 | export MODULE_BUILD_FROM_SOURCE=true |
Martin Stjernholm | 6906910 | 2020-06-16 13:26:40 +0100 | [diff] [blame] | 38 | |
| 39 | # Switch the build system to unbundled mode in the reduced manifest branch. |
Martin Stjernholm | 6906910 | 2020-06-16 13:26:40 +0100 | [diff] [blame] | 40 | if [ ! -d frameworks/base ]; then |
Martin Stjernholm | 288b2f1 | 2022-04-13 19:11:34 +0100 | [diff] [blame] | 41 | export TARGET_BUILD_UNBUNDLED=true |
Martin Stjernholm | 6906910 | 2020-06-16 13:26:40 +0100 | [diff] [blame] | 42 | fi |
| 43 | |
Martin Stjernholm | 288b2f1 | 2022-04-13 19:11:34 +0100 | [diff] [blame] | 44 | vars="$(build/soong/soong_ui.bash --dumpvars-mode --vars="OUT_DIR BUILD_NUMBER")" |
Martin Stjernholm | 1048bb7 | 2022-04-13 16:22:30 +0100 | [diff] [blame] | 45 | # Assign to a variable and eval that, since bash ignores any error status from |
| 46 | # the command substitution if it's directly on the eval line. |
| 47 | eval $vars |
Alex Light | a02094f | 2018-12-11 10:41:52 -0800 | [diff] [blame] | 48 | |
Martin Stjernholm | 288b2f1 | 2022-04-13 19:11:34 +0100 | [diff] [blame] | 49 | # This file is currently not created in --soong-only mode, but some build |
| 50 | # targets depend on it. |
| 51 | printf %s "${BUILD_NUMBER}" > ${OUT_DIR}/soong/build_number.txt |
Alex Light | a02094f | 2018-12-11 10:41:52 -0800 | [diff] [blame] | 52 | |
Martin Stjernholm | 288b2f1 | 2022-04-13 19:11:34 +0100 | [diff] [blame] | 53 | build/soong/soong_ui.bash --make-mode --soong-only "$@" |