Merge "Build modules from source for module products."
diff --git a/core/board_config.mk b/core/board_config.mk
index 5ca2a4c..72a8044 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -243,7 +243,7 @@
$(shell mkdir -p $(OUT_DIR)/rbc)
$(call dump-variables-rbc, $(OUT_DIR)/rbc/make_vars_pre_board_config.mk)
- $(shell $(OUT_DIR)/soong/mk2rbc \
+ $(shell $(OUT_DIR)/mk2rbc \
--mode=write -r --outdir $(OUT_DIR)/rbc \
--boardlauncher=$(OUT_DIR)/rbc/boardlauncher.rbc \
--input_variables=$(OUT_DIR)/rbc/make_vars_pre_board_config.mk \
@@ -254,7 +254,7 @@
endif
$(shell build/soong/scripts/update_out $(OUT_DIR)/rbc/rbc_board_config_results.mk \
- $(OUT_DIR)/soong/rbcrun RBC_OUT="make,global" $(OUT_DIR)/rbc/boardlauncher.rbc)
+ $(OUT_DIR)/rbcrun RBC_OUT="make,global" $(OUT_DIR)/rbc/boardlauncher.rbc)
ifneq ($(.SHELLSTATUS),0)
$(error board configuration runner failed: $(.SHELLSTATUS))
endif
diff --git a/core/build-system.html b/core/build-system.html
index b872909c..181e939 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -444,8 +444,12 @@
<p>Unbundled build has several meanings by the context.
Let me explain the meaning by the flags related to "unbundled build"</p>
<h4>TARGET_BUILD_UNBUNDLED</h4>
-<p>The source tree might not have the full platform sources. It is always set if
-<code>TARGET_BUILD_APPS</code> or <code>TARGET_BUILD_UNBUNDLED_IMAGE</code> is set.</p>
+<p>
+ The source tree might not have the full platform sources. It turns on
+ <code>TARGET_BUILD_USE_PREBUILT_SDKS</code>, unless
+ <code>UNBUNDLED_BUILD_SDKS_FROM_SOURCE</code> is set. It is always set if
+ <code>TARGET_BUILD_APPS</code> or <code>TARGET_BUILD_UNBUNDLED_IMAGE</code> is set.
+</p>
<h4>TARGET_BUILD_USE_PREBUILT_SDKS</h4>
<p>It is an internal flag. If it is set, prebuilt SDKs are used, even if a module's
<code>LOCAL_SDK_VERSION</code> is <code>current</code> (including <code>system_current</code>,
diff --git a/core/config.mk b/core/config.mk
index 48aa724..e2bdcbd 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -496,7 +496,9 @@
DISABLE_PREOPT :=
ifneq (,$(TARGET_BUILD_APPS)$(TARGET_BUILD_UNBUNDLED_IMAGE))
DISABLE_PREOPT := true
- ifndef UNBUNDLED_BUILD_SDKS_FROM_SOURCE
+endif
+ifeq (true,$(TARGET_BUILD_UNBUNDLED))
+ ifneq (true,$(UNBUNDLED_BUILD_SDKS_FROM_SOURCE))
TARGET_BUILD_USE_PREBUILT_SDKS := true
endif
endif
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 8f70e57..62ea1b6 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -325,9 +325,17 @@
# instead of the raw variable values, because mk2rbc can't read the
# raw ones.
define dump-variables-rbc
-$(file >$(OUT_DIR)/dump-variables-rbc-temp.txt,$(subst $(space),$(newline),$(.VARIABLES)))\
+$(eval _dump_variables_rbc_excluded := \
+ LOCAL_PATH \
+ TOPDIR \
+ TRACE_BEGIN_SOONG \
+ BOARD_PLAT_PUBLIC_SEPOLICY_DIR \
+ BOARD_PLAT_PRIVATE_SEPOLICY_DIR \
+ USER \
+ SOONG_% \
+ PRODUCT_COPY_OUT_%)\
$(file >$(1),\
-$(foreach v, $(shell grep -he "^[A-Z][A-Z0-9_]*$$" $(OUT_DIR)/dump-variables-rbc-temp.txt | grep -vhE "^(SOONG_.*|LOCAL_PATH|TOPDIR|PRODUCT_COPY_OUT_.*|TRACE_BEGIN_SOONG)$$"),\
+$(foreach v, $(shell echo $(filter-out $(_dump_variables_rbc_excluded),$(.VARIABLES)) | tr ' ' '\n' | grep -he "^[A-Z][A-Z0-9_]*$$"),\
$(v) := $(strip $($(v)))$(newline))\
$(foreach ns,$(SOONG_CONFIG_NAMESPACES),\
$(foreach v,$(SOONG_CONFIG_$(ns)),\
diff --git a/envsetup.sh b/envsetup.sh
index 87e6e0a..7331d5e 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1727,15 +1727,17 @@
# Convenience entry point (like m) to use Bazel in AOSP.
function b()
(
+ local skip_tests=$(echo "$@" | grep -ow -- "--skip-soong-tests")
+ local bazel_args=(${@/--skip-soong-tests/})
# Generate BUILD, bzl files into the synthetic Bazel workspace (out/soong/workspace).
- _trigger_build "all-modules" bp2build USE_BAZEL_ANALYSIS= || return 1
+ _trigger_build "all-modules" bp2build USE_BAZEL_ANALYSIS= "$skip_tests" || return 1
# Then, run Bazel using the synthetic workspace as the --package_path.
- if [[ -z "$@" ]]; then
+ if [[ -z "$bazel_args" ]]; then
# If there are no args, show help.
bazel help
else
# Else, always run with the bp2build configuration, which sets Bazel's package path to the synthetic workspace.
- bazel "$@" --config=bp2build
+ bazel $bazel_args --config=bp2build
fi
)