Loading core/product_config.rbc +4 −1 Original line number Diff line number Diff line Loading @@ -291,7 +291,10 @@ def _percolate_inherited(configs, cfg_name, cfg, children_names): child_cfg = configs[child_name][1] for attr, value in child_cfg.items(): if type(value) != "list": if attr in percolated_attrs or not attr in cfg: # Single value variables take the first value available from the leftmost # branch of the tree. If we also had "or attr in percolated_attrs" in this # if statement, it would take the value from the rightmost branch. if cfg.get(attr, "") == "": cfg[attr] = value percolated_attrs[attr] = True continue Loading tests/run.rbc +3 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ load(":input_variables.rbc", input_variables_init = "init") load(":product.rbc", "init") load(":board.rbc", board_init = "init") load(":board_input_vars.rbc", board_input_vars_init = "init") load("//build/make/tests/single_value_inheritance:test.rbc", test_single_value_inheritance = "test") def assert_eq(expected, actual): if expected != actual: Loading Loading @@ -129,3 +130,5 @@ assert_eq( (board_globals, board_config, board_globals_base) = rblf.board_configuration(board_init, board_input_vars_init) assert_eq({"A_LIST_VARIABLE": ["foo", "bar"]}, board_globals) assert_eq({"A_LIST_VARIABLE": ["foo"]}, board_globals_base) test_single_value_inheritance() tests/single_value_inheritance/inherit1.rbc 0 → 100644 +21 −0 Original line number Diff line number Diff line # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("//build/make/core:product_config.rbc", "rblf") def init(g, handle): cfg = rblf.cfg(handle) cfg["PRODUCT_CHARACTERISTICS"] = "tablet" cfg["PRODUCT_DEFAULT_DEV_CERTIFICATE"] = "vendor/myvendor/certs/devkeys/devkey" tests/single_value_inheritance/inherit2.rbc 0 → 100644 +20 −0 Original line number Diff line number Diff line # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("//build/make/core:product_config.rbc", "rblf") def init(g, handle): cfg = rblf.cfg(handle) cfg["PRODUCT_CHARACTERISTICS"] = "nosdcard" tests/single_value_inheritance/product.rbc 0 → 100644 +24 −0 Original line number Diff line number Diff line # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("//build/make/core:product_config.rbc", "rblf") load(":inherit1.rbc", _inherit1_init = "init") load(":inherit2.rbc", _inherit2_init = "init") def init(g, handle): cfg = rblf.cfg(handle) rblf.inherit(handle, "test/inherit1", _inherit1_init) rblf.inherit(handle, "test/inherit2", _inherit2_init) cfg["PRODUCT_DEFAULT_DEV_CERTIFICATE"] = "" Loading
core/product_config.rbc +4 −1 Original line number Diff line number Diff line Loading @@ -291,7 +291,10 @@ def _percolate_inherited(configs, cfg_name, cfg, children_names): child_cfg = configs[child_name][1] for attr, value in child_cfg.items(): if type(value) != "list": if attr in percolated_attrs or not attr in cfg: # Single value variables take the first value available from the leftmost # branch of the tree. If we also had "or attr in percolated_attrs" in this # if statement, it would take the value from the rightmost branch. if cfg.get(attr, "") == "": cfg[attr] = value percolated_attrs[attr] = True continue Loading
tests/run.rbc +3 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ load(":input_variables.rbc", input_variables_init = "init") load(":product.rbc", "init") load(":board.rbc", board_init = "init") load(":board_input_vars.rbc", board_input_vars_init = "init") load("//build/make/tests/single_value_inheritance:test.rbc", test_single_value_inheritance = "test") def assert_eq(expected, actual): if expected != actual: Loading Loading @@ -129,3 +130,5 @@ assert_eq( (board_globals, board_config, board_globals_base) = rblf.board_configuration(board_init, board_input_vars_init) assert_eq({"A_LIST_VARIABLE": ["foo", "bar"]}, board_globals) assert_eq({"A_LIST_VARIABLE": ["foo"]}, board_globals_base) test_single_value_inheritance()
tests/single_value_inheritance/inherit1.rbc 0 → 100644 +21 −0 Original line number Diff line number Diff line # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("//build/make/core:product_config.rbc", "rblf") def init(g, handle): cfg = rblf.cfg(handle) cfg["PRODUCT_CHARACTERISTICS"] = "tablet" cfg["PRODUCT_DEFAULT_DEV_CERTIFICATE"] = "vendor/myvendor/certs/devkeys/devkey"
tests/single_value_inheritance/inherit2.rbc 0 → 100644 +20 −0 Original line number Diff line number Diff line # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("//build/make/core:product_config.rbc", "rblf") def init(g, handle): cfg = rblf.cfg(handle) cfg["PRODUCT_CHARACTERISTICS"] = "nosdcard"
tests/single_value_inheritance/product.rbc 0 → 100644 +24 −0 Original line number Diff line number Diff line # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("//build/make/core:product_config.rbc", "rblf") load(":inherit1.rbc", _inherit1_init = "init") load(":inherit2.rbc", _inherit2_init = "init") def init(g, handle): cfg = rblf.cfg(handle) rblf.inherit(handle, "test/inherit1", _inherit1_init) rblf.inherit(handle, "test/inherit2", _inherit2_init) cfg["PRODUCT_DEFAULT_DEV_CERTIFICATE"] = ""