Integrate Starlark-based configuration runner
If RBC_PRODUCT_CONFIG variable is set, obtain product configuration
variables by converting product configuration makefiles to Starlark
files and then executing them.
Also, introduce RBC_NO_PRODUCT_GRAPH variable to suppress product graph
generation. We cannot generate product graph with Starlark, so this
option allows to verify that the rest of the contents of the generated
Ninja files remains the same when Starlark-based converter is used.
This allows to perform the regression testing, i.e. running
`RBC_NO_PRODUCT_GRAPH=t DISABLE_ARTIFACT_PATH_REQUIREMENTS=t m nothing`
and
`RBC_PRODUCT_CONFIG=t m nothing`
should generate identical *.ninja files.
Bug: 181797530
Test: Manual
Change-Id: Ic6173a9640f32766b71c02a2b1833ce7a278e4cc
diff --git a/core/product-graph.mk b/core/product-graph.mk
index 968d01b..de4e581 100644
--- a/core/product-graph.mk
+++ b/core/product-graph.mk
@@ -81,6 +81,7 @@
$(products_graph): PRIVATE_PRODUCTS_FILTER := $(products_list)
$(products_graph): $(this_makefile)
+ifeq (,$(RBC_PRODUCT_CONFIG)$(RBC_NO_PRODUCT_GRAPH))
@echo Product graph DOT: $@ for $(PRIVATE_PRODUCTS_FILTER)
$(hide) echo 'digraph {' > $@.in
$(hide) echo 'graph [ ratio=.5 ];' >> $@.in
@@ -89,6 +90,10 @@
$(foreach p,$(PRIVATE_PRODUCTS),$(call emit-product-node-props,$(p),$@.in))
$(hide) echo '}' >> $@.in
$(hide) build/make/tools/filter-product-graph.py $(PRIVATE_PRODUCTS_FILTER) < $@.in > $@
+else
+ @echo RBC_PRODUCT_CONFIG and RBC_NO_PRODUCT_GRAPH should be unset to generate product graph
+ false
+endif
# Evaluates to the name of the product file
# $(1) product file
@@ -143,6 +148,7 @@
$(hide) cat $$< | build/make/tools/product_debug.py > $$@
endef
+ifeq (,$(RBC_PRODUCT_CONFIG)$(RBC_NO_PRODUCT_GRAPH))
product_debug_files:=
$(foreach p,$(all_products), \
$(eval $(call transform-product-debug, $(p))) \
@@ -154,3 +160,8 @@
@echo Product graph .dot file: $(products_graph)
@echo Command to convert to pdf: dot -Tpdf -Nshape=box -o $(OUT_DIR)/products.pdf $(products_graph)
@echo Command to convert to svg: dot -Tsvg -Nshape=box -o $(OUT_DIR)/products.svg $(products_graph)
+else
+.PHONY: product-graph
+ @echo RBC_PRODUCT_CONFIG and RBC_NO_PRODUCT_GRAPH should be unset to generate product graph
+ false
+endif
\ No newline at end of file