blob: bbe71b6f6f3ea60d02f98fb49f1932ed6cf16ff1 [file] [log] [blame]
Alex Lighta02094f2018-12-11 10:41:52 -08001#!/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 Lighta02094f2018-12-11 10:41:52 -080019
Martin Stjernholm1048bb72022-04-13 16:22:30 +010020set -e
Alex Lighta02094f2018-12-11 10:41:52 -080021
22if [ ! -d art ]; then
23 echo "Script needs to be run at the root of the android tree"
24 exit 1
25fi
26
Martin Stjernholm288b2f12022-04-13 19:11:34 +010027export 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).
32export FORCE_BUILD_LLVM_COMPONENTS=true
33
Martin Stjernholmf7e4c3d2021-07-23 00:17:36 +010034# TODO(b/194433871): Set MODULE_BUILD_FROM_SOURCE to disable prebuilt modules,
Colin Cross0a42f1e2021-10-28 16:31:03 -070035# which Soong otherwise can create duplicate install rules for in --soong-only
Martin Stjernholmf7e4c3d2021-07-23 00:17:36 +010036# mode.
Martin Stjernholm288b2f12022-04-13 19:11:34 +010037export MODULE_BUILD_FROM_SOURCE=true
Martin Stjernholm69069102020-06-16 13:26:40 +010038
39# Switch the build system to unbundled mode in the reduced manifest branch.
Martin Stjernholm69069102020-06-16 13:26:40 +010040if [ ! -d frameworks/base ]; then
Martin Stjernholm288b2f12022-04-13 19:11:34 +010041 export TARGET_BUILD_UNBUNDLED=true
Martin Stjernholm69069102020-06-16 13:26:40 +010042fi
43
Martin Stjernholm288b2f12022-04-13 19:11:34 +010044vars="$(build/soong/soong_ui.bash --dumpvars-mode --vars="OUT_DIR BUILD_NUMBER")"
Martin Stjernholm1048bb72022-04-13 16:22:30 +010045# 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.
47eval $vars
Alex Lighta02094f2018-12-11 10:41:52 -080048
Martin Stjernholm288b2f12022-04-13 19:11:34 +010049# This file is currently not created in --soong-only mode, but some build
50# targets depend on it.
51printf %s "${BUILD_NUMBER}" > ${OUT_DIR}/soong/build_number.txt
Alex Lighta02094f2018-12-11 10:41:52 -080052
Martin Stjernholm288b2f12022-04-13 19:11:34 +010053build/soong/soong_ui.bash --make-mode --soong-only "$@"