Add more colors to generated product graphs
Color the node nodes by their location to:
- /build/make/target/product/* => light yellow
- /vendor/* => light red
Test: m product-graph
Change-Id: I911764352e7dc4e2ead2b3770300f48d23dc20b8
diff --git a/core/product-graph.mk b/core/product-graph.mk
index a114b65..9db277c 100644
--- a/core/product-graph.mk
+++ b/core/product-graph.mk
@@ -52,13 +52,27 @@
open_parethesis := (
close_parenthesis := )
+node_color_target := orange
+node_color_common := beige
+node_color_vendor := lavenderblush
+node_color_default := white
+define node-color
+$(if $(filter $(1),$(PRIVATE_PRODUCTS_FILTER)),\
+ $(node_color_target),\
+ $(if $(filter build/make/target/product/%,$(1)),\
+ $(node_color_common),\
+ $(if $(filter vendor/%,$(1)),$(node_color_vendor),$(node_color_default))\
+ )\
+)
+endef
+
# Emit properties of a product node to a file.
# $(1) the product
# $(2) the output file
define emit-product-node-props
$(hide) echo \"$(1)\" [ \
label=\"$(dir $(1))\\n$(notdir $(1))\\n\\n$(subst $(close_parenthesis),,$(subst $(open_parethesis),,$(PRODUCTS.$(strip $(1)).PRODUCT_MODEL)))\\n$(PRODUCTS.$(strip $(1)).PRODUCT_DEVICE)\" \
-$(if $(filter $(1),$(PRIVATE_PRODUCTS_FILTER)), style=\"filled\" fillcolor=\"#FFFDB0\",) \
+style=\"filled\" fillcolor=\"$(strip $(call node-color,$(1)))\" \
colorscheme=\"svg\" fontcolor=\"darkblue\" href=\"products/$(1).html\" \
] >> $(2)