Merge "Make starlark board configuration work with sdk_phone_x86_64" am: 2f1bd70c9c
Original change: https://android-review.googlesource.com/c/platform/build/+/1849978 Change-Id: Idbc98804269ec22eeacbedb7524bf45a1aa95c60
This commit is contained in:
@@ -185,19 +185,44 @@ else
|
|||||||
.KATI_READONLY := TARGET_DEVICE_DIR
|
.KATI_READONLY := TARGET_DEVICE_DIR
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Dumps all variables that match [A-Z][A-Z0-9_]* to the file at $(1)
|
||||||
|
# It is used to print only the variables that are likely to be relevant to the
|
||||||
|
# board configuration.
|
||||||
|
define dump-public-variables
|
||||||
|
$(file >$(OUT_DIR)/dump-public-variables-temp.txt,$(subst $(space),$(newline),$(.VARIABLES)))\
|
||||||
|
$(file >$(1),\
|
||||||
|
$(foreach v, $(shell grep -he "^[A-Z][A-Z0-9_]*$$" $(OUT_DIR)/dump-public-variables-temp.txt | grep -vhe "^SOONG_"),\
|
||||||
|
$(v) := $(strip $($(v)))$(newline)))
|
||||||
|
endef
|
||||||
|
|
||||||
# TODO(colefaust) change this if to RBC_PRODUCT_CONFIG when
|
# TODO(colefaust) change this if to RBC_PRODUCT_CONFIG when
|
||||||
# the board configuration is known to work on everything
|
# the board configuration is known to work on everything
|
||||||
# the product config works on.
|
# the product config works on.
|
||||||
ifndef RBC_BOARD_CONFIG
|
ifndef RBC_BOARD_CONFIG
|
||||||
include $(board_config_mk)
|
include $(board_config_mk)
|
||||||
else
|
else
|
||||||
rc := $(shell build/soong/scripts/rbc-run $(board_config_mk) \
|
$(shell mkdir -p $(OUT_DIR)/rbc)
|
||||||
BUILDING_GSI=$(BUILDING_GSI) >$(OUT_DIR)/rbcboardtemp.mk || echo $$?)
|
|
||||||
ifneq (,$(rc))
|
$(call dump-public-variables, $(OUT_DIR)/rbc/make_vars_pre_board_config.mk)
|
||||||
$(error board configuration converter failed: $(rc))
|
|
||||||
|
$(shell $(OUT_DIR)/soong/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 \
|
||||||
|
$(board_config_mk))
|
||||||
|
ifneq ($(.SHELLSTATUS),0)
|
||||||
|
$(error board configuration converter failed: $(.SHELLSTATUS))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(OUT_DIR)/rbcboardtemp.mk
|
$(shell $(OUT_DIR)/soong/rbcrun \
|
||||||
|
RBC_OUT="make,global" \
|
||||||
|
$(OUT_DIR)/rbc/boardlauncher.rbc \
|
||||||
|
>$(OUT_DIR)/rbc/rbc_board_config_results.mk)
|
||||||
|
ifneq ($(.SHELLSTATUS),0)
|
||||||
|
$(error board configuration runner failed: $(.SHELLSTATUS))
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(OUT_DIR)/rbc/rbc_board_config_results.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(and $(TARGET_ARCH),$(TARGET_ARCH_SUITE)))
|
ifneq (,$(and $(TARGET_ARCH),$(TARGET_ARCH_SUITE)))
|
||||||
|
@@ -1379,7 +1379,7 @@ else ifdef FULL_BUILD
|
|||||||
|
|
||||||
# Verify the artifact path requirements made by included products.
|
# Verify the artifact path requirements made by included products.
|
||||||
is_asan := $(if $(filter address,$(SANITIZE_TARGET)),true)
|
is_asan := $(if $(filter address,$(SANITIZE_TARGET)),true)
|
||||||
ifeq (,$(or $(is_asan),$(DISABLE_ARTIFACT_PATH_REQUIREMENTS),$(RBC_PRODUCT_CONFIG)))
|
ifeq (,$(or $(is_asan),$(DISABLE_ARTIFACT_PATH_REQUIREMENTS),$(RBC_PRODUCT_CONFIG),$(RBC_BOARD_CONFIG)))
|
||||||
include $(BUILD_SYSTEM)/artifact_path_requirements.mk
|
include $(BUILD_SYSTEM)/artifact_path_requirements.mk
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
@@ -81,7 +81,7 @@ $(products_graph): PRIVATE_PRODUCTS := $(all_products)
|
|||||||
$(products_graph): PRIVATE_PRODUCTS_FILTER := $(products_list)
|
$(products_graph): PRIVATE_PRODUCTS_FILTER := $(products_list)
|
||||||
|
|
||||||
$(products_graph): $(this_makefile)
|
$(products_graph): $(this_makefile)
|
||||||
ifeq (,$(RBC_PRODUCT_CONFIG)$(RBC_NO_PRODUCT_GRAPH))
|
ifeq (,$(RBC_PRODUCT_CONFIG)$(RBC_NO_PRODUCT_GRAPH)$(RBC_BOARD_CONFIG))
|
||||||
@echo Product graph DOT: $@ for $(PRIVATE_PRODUCTS_FILTER)
|
@echo Product graph DOT: $@ for $(PRIVATE_PRODUCTS_FILTER)
|
||||||
$(hide) echo 'digraph {' > $@.in
|
$(hide) echo 'digraph {' > $@.in
|
||||||
$(hide) echo 'graph [ ratio=.5 ];' >> $@.in
|
$(hide) echo 'graph [ ratio=.5 ];' >> $@.in
|
||||||
@@ -148,7 +148,7 @@ $(call product-debug-filename, $(p)): \
|
|||||||
$(hide) cat $$< | build/make/tools/product_debug.py > $$@
|
$(hide) cat $$< | build/make/tools/product_debug.py > $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ifeq (,$(RBC_PRODUCT_CONFIG)$(RBC_NO_PRODUCT_GRAPH))
|
ifeq (,$(RBC_PRODUCT_CONFIG)$(RBC_NO_PRODUCT_GRAPH)$(RBC_BOARD_CONFIG))
|
||||||
product_debug_files:=
|
product_debug_files:=
|
||||||
$(foreach p,$(all_products), \
|
$(foreach p,$(all_products), \
|
||||||
$(eval $(call transform-product-debug, $(p))) \
|
$(eval $(call transform-product-debug, $(p))) \
|
||||||
|
@@ -206,10 +206,10 @@ endif
|
|||||||
ifndef RBC_PRODUCT_CONFIG
|
ifndef RBC_PRODUCT_CONFIG
|
||||||
$(call import-products, $(current_product_makefile))
|
$(call import-products, $(current_product_makefile))
|
||||||
else
|
else
|
||||||
rc := $(shell build/soong/scripts/rbc-run $(current_product_makefile) \
|
$(shell build/soong/scripts/rbc-run $(current_product_makefile) \
|
||||||
>$(OUT_DIR)/rbctemp.mk || echo $$?)
|
>$(OUT_DIR)/rbctemp.mk)
|
||||||
ifneq (,$(rc))
|
ifneq ($(.SHELLSTATUS),0)
|
||||||
$(error product configuration converter failed: $(rc))
|
$(error product configuration converter failed: $(.SHELLSTATUS))
|
||||||
endif
|
endif
|
||||||
include $(OUT_DIR)/rbctemp.mk
|
include $(OUT_DIR)/rbctemp.mk
|
||||||
PRODUCTS += $(current_product_makefile)
|
PRODUCTS += $(current_product_makefile)
|
||||||
|
@@ -17,7 +17,7 @@ load("//build/make/core:envsetup.rbc", _envsetup_init = "init")
|
|||||||
"""Runtime functions."""
|
"""Runtime functions."""
|
||||||
|
|
||||||
_soong_config_namespaces_key = "$SOONG_CONFIG_NAMESPACES"
|
_soong_config_namespaces_key = "$SOONG_CONFIG_NAMESPACES"
|
||||||
def _global_init(version_info):
|
def _init_globals(version_info):
|
||||||
"""Returns dict created from the runtime environment."""
|
"""Returns dict created from the runtime environment."""
|
||||||
globals = dict()
|
globals = dict()
|
||||||
|
|
||||||
@@ -50,7 +50,8 @@ def _global_init(version_info):
|
|||||||
|
|
||||||
|
|
||||||
def __print_attr(attr, value):
|
def __print_attr(attr, value):
|
||||||
if not value:
|
# Allow using empty strings to clear variables, but not None values
|
||||||
|
if value == None:
|
||||||
return
|
return
|
||||||
if type(value) == "list":
|
if type(value) == "list":
|
||||||
if _options.rearrange:
|
if _options.rearrange:
|
||||||
@@ -74,6 +75,9 @@ def _printvars(state):
|
|||||||
__print_attr(attr, val)
|
__print_attr(attr, val)
|
||||||
if _options.print_globals:
|
if _options.print_globals:
|
||||||
print()
|
print()
|
||||||
|
_printglobals(globals, globals_base)
|
||||||
|
|
||||||
|
def _printglobals(globals, globals_base):
|
||||||
for attr, val in sorted(globals.items()):
|
for attr, val in sorted(globals.items()):
|
||||||
if attr == _soong_config_namespaces_key:
|
if attr == _soong_config_namespaces_key:
|
||||||
__print_attr("SOONG_CONFIG_NAMESPACES", val.keys())
|
__print_attr("SOONG_CONFIG_NAMESPACES", val.keys())
|
||||||
@@ -109,7 +113,7 @@ def _product_configuration(top_pcm_name, top_pcm, version_info):
|
|||||||
# PCM means "Product Configuration Module", i.e., a Starlark file
|
# PCM means "Product Configuration Module", i.e., a Starlark file
|
||||||
# whose body consists of a single init function.
|
# whose body consists of a single init function.
|
||||||
|
|
||||||
globals_base = _global_init(version_info)
|
globals_base = _init_globals(version_info)
|
||||||
globals = dict(**globals_base)
|
globals = dict(**globals_base)
|
||||||
|
|
||||||
config_postfix = [] # Configs in postfix order
|
config_postfix = [] # Configs in postfix order
|
||||||
@@ -203,6 +207,16 @@ def _product_configuration(top_pcm_name, top_pcm, version_info):
|
|||||||
|
|
||||||
return (globals, configs[top_pcm_name][1], globals_base)
|
return (globals, configs[top_pcm_name][1], globals_base)
|
||||||
|
|
||||||
|
|
||||||
|
def _board_configuration(board_config_init, input_variables_init):
|
||||||
|
globals = {}
|
||||||
|
h = __h_new()
|
||||||
|
input_variables_init(globals, h)
|
||||||
|
globals_base = dict(**globals)
|
||||||
|
board_config_init(globals, h)
|
||||||
|
return (globals, h[1], globals_base)
|
||||||
|
|
||||||
|
|
||||||
def _substitute_inherited(configs, pcm_name, cfg):
|
def _substitute_inherited(configs, pcm_name, cfg):
|
||||||
"""Substitutes inherited values in all the attributes.
|
"""Substitutes inherited values in all the attributes.
|
||||||
|
|
||||||
@@ -645,7 +659,7 @@ rblf = struct(
|
|||||||
filter = _filter,
|
filter = _filter,
|
||||||
filter_out = _filter_out,
|
filter_out = _filter_out,
|
||||||
find_and_copy = _find_and_copy,
|
find_and_copy = _find_and_copy,
|
||||||
global_init = _global_init,
|
init_globals = _init_globals,
|
||||||
inherit = _inherit,
|
inherit = _inherit,
|
||||||
indirect = _indirect,
|
indirect = _indirect,
|
||||||
mkinfo = _mkinfo,
|
mkinfo = _mkinfo,
|
||||||
@@ -655,7 +669,9 @@ rblf = struct(
|
|||||||
mkstrip = _mkstrip,
|
mkstrip = _mkstrip,
|
||||||
mksubst = _mksubst,
|
mksubst = _mksubst,
|
||||||
printvars = _printvars,
|
printvars = _printvars,
|
||||||
|
printglobals = _printglobals,
|
||||||
product_configuration = _product_configuration,
|
product_configuration = _product_configuration,
|
||||||
|
board_configuration = _board_configuration,
|
||||||
product_copy_files_by_pattern = _product_copy_files_by_pattern,
|
product_copy_files_by_pattern = _product_copy_files_by_pattern,
|
||||||
require_artifacts_in_path = _require_artifacts_in_path,
|
require_artifacts_in_path = _require_artifacts_in_path,
|
||||||
require_artifacts_in_path_relaxed = _require_artifacts_in_path_relaxed,
|
require_artifacts_in_path_relaxed = _require_artifacts_in_path_relaxed,
|
||||||
|
Reference in New Issue
Block a user