Loading core/product_config.rbc +6 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,12 @@ def __print_attr(attr, value): if _options.format == "pretty": print(attr, "=", repr(value)) elif _options.format == "make": value = list(value) for i, x in enumerate(value): if type(x) == "tuple" and len(x) == 1: value[i] = "@inherit:" + x[0] + ".mk" elif type(x) != "string": fail("Wasn't a list of strings:", attr, " value:", value) print(attr, ":=", " ".join(value)) elif _options.format == "pretty": print(attr, "=", repr(value)) Loading tests/inherits_in_regular_variables/inherit1.rbc 0 → 100644 +21 −0 Original line number Diff line number Diff line # Copyright 2023 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.setdefault("PRODUCT_PACKAGES", []) cfg["PRODUCT_PACKAGES"] += ["bar"] tests/inherits_in_regular_variables/product.rbc 0 → 100644 +27 −0 Original line number Diff line number Diff line # Copyright 2023 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") def init(g, handle): cfg = rblf.cfg(handle) cfg.setdefault("PRODUCT_PACKAGES", []) cfg["PRODUCT_PACKAGES"] += ["foo"] g["PRODUCT_PACKAGES_COPY"] = cfg["PRODUCT_PACKAGES"] rblf.inherit(handle, "test/inherit1", _inherit1_init) tests/inherits_in_regular_variables/test.rbc 0 → 100644 +30 −0 Original line number Diff line number Diff line # Copyright 2023 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("//build/make/tests/input_variables.rbc", input_variables_init = "init") load(":product.rbc", "init") def assert_eq(expected, actual): if expected != actual: fail("Expected '%s', got '%s'" % (expected, actual)) def test(): (globals, globals_base) = rblf.product_configuration("test/device", init, input_variables_init) assert_eq(["foo", "bar"], globals["PRODUCTS.test/device.mk.PRODUCT_PACKAGES"]) assert_eq(["foo", ("test/inherit1",)], globals["PRODUCT_PACKAGES_COPY"]) # Ideally we would check that rblf.printvars returns the correct result, but we don't have # a good way to intercept its output or mock rblf_cli tests/run.rbc +2 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ load(":board_input_vars.rbc", board_input_vars_init = "init") load("//build/make/tests/single_value_inheritance:test.rbc", test_single_value_inheritance = "test") load("//build/make/tests/artifact_path_requirements:test.rbc", test_artifact_path_requirements = "test") load("//build/make/tests/prefixed_sort_order:test.rbc", test_prefixed_sort_order = "test") load("//build/make/tests/inherits_in_regular_variables:test.rbc", test_inherits_in_regular_variables = "test") def assert_eq(expected, actual): if expected != actual: Loading Loading @@ -176,3 +177,4 @@ assert_eq("", g.get("NEWVAR")) test_single_value_inheritance() test_artifact_path_requirements() test_prefixed_sort_order() test_inherits_in_regular_variables() Loading
core/product_config.rbc +6 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,12 @@ def __print_attr(attr, value): if _options.format == "pretty": print(attr, "=", repr(value)) elif _options.format == "make": value = list(value) for i, x in enumerate(value): if type(x) == "tuple" and len(x) == 1: value[i] = "@inherit:" + x[0] + ".mk" elif type(x) != "string": fail("Wasn't a list of strings:", attr, " value:", value) print(attr, ":=", " ".join(value)) elif _options.format == "pretty": print(attr, "=", repr(value)) Loading
tests/inherits_in_regular_variables/inherit1.rbc 0 → 100644 +21 −0 Original line number Diff line number Diff line # Copyright 2023 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.setdefault("PRODUCT_PACKAGES", []) cfg["PRODUCT_PACKAGES"] += ["bar"]
tests/inherits_in_regular_variables/product.rbc 0 → 100644 +27 −0 Original line number Diff line number Diff line # Copyright 2023 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") def init(g, handle): cfg = rblf.cfg(handle) cfg.setdefault("PRODUCT_PACKAGES", []) cfg["PRODUCT_PACKAGES"] += ["foo"] g["PRODUCT_PACKAGES_COPY"] = cfg["PRODUCT_PACKAGES"] rblf.inherit(handle, "test/inherit1", _inherit1_init)
tests/inherits_in_regular_variables/test.rbc 0 → 100644 +30 −0 Original line number Diff line number Diff line # Copyright 2023 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("//build/make/tests/input_variables.rbc", input_variables_init = "init") load(":product.rbc", "init") def assert_eq(expected, actual): if expected != actual: fail("Expected '%s', got '%s'" % (expected, actual)) def test(): (globals, globals_base) = rblf.product_configuration("test/device", init, input_variables_init) assert_eq(["foo", "bar"], globals["PRODUCTS.test/device.mk.PRODUCT_PACKAGES"]) assert_eq(["foo", ("test/inherit1",)], globals["PRODUCT_PACKAGES_COPY"]) # Ideally we would check that rblf.printvars returns the correct result, but we don't have # a good way to intercept its output or mock rblf_cli
tests/run.rbc +2 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ load(":board_input_vars.rbc", board_input_vars_init = "init") load("//build/make/tests/single_value_inheritance:test.rbc", test_single_value_inheritance = "test") load("//build/make/tests/artifact_path_requirements:test.rbc", test_artifact_path_requirements = "test") load("//build/make/tests/prefixed_sort_order:test.rbc", test_prefixed_sort_order = "test") load("//build/make/tests/inherits_in_regular_variables:test.rbc", test_inherits_in_regular_variables = "test") def assert_eq(expected, actual): if expected != actual: Loading Loading @@ -176,3 +177,4 @@ assert_eq("", g.get("NEWVAR")) test_single_value_inheritance() test_artifact_path_requirements() test_prefixed_sort_order() test_inherits_in_regular_variables()