From f0d7d8ff73e238a2c8023159ab47863a693f42d4 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Mon, 22 Nov 2021 16:31:46 -0800 Subject: [PATCH] Return product config variables from board_configuration The board config can actually change a few product config variables that are not made read-only. Bug: 201700692 Test: ./build/bazel/ci/rbc_regression_test.sh -b aosp_cf_x86_64_phone Change-Id: Ib2ac04ac2c5a56d32bca51fc8189e44e180075ee --- core/product_config.rbc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/product_config.rbc b/core/product_config.rbc index c32db7644a..fde05f59e1 100644 --- a/core/product_config.rbc +++ b/core/product_config.rbc @@ -207,13 +207,21 @@ def _product_configuration(top_pcm_name, top_pcm, version_info): return (globals, configs[top_pcm_name][1], globals_base) +def _dictionary_difference(a, b): + result = {} + for attr, val in a.items(): + if attr not in b or b[attr] != val: + result[attr] = val + return result + def _board_configuration(board_config_init, input_variables_init): globals = {} h = __h_new() input_variables_init(globals, h) + cfg_base = dict(**h[0]) globals_base = dict(**globals) board_config_init(globals, h) - return (globals, h[1], globals_base) + return (globals, _dictionary_difference(h[0], cfg_base), globals_base) def _substitute_inherited(configs, pcm_name, cfg):