Skip to content

buildozer dict_set does not support selects? #1421

@jmacnak

Description

@jmacnak

Adding the following to buildozer/buildozer_test.sh:

function test_dict_set_with_select() {
  in='cc_library(
    name = "lib",
    a_dictionary_attribute = {
        "key1": "val1",
    } | select({
        "@platforms//cpu:arm64": {
            "key2": "val2",
        },
        "//conditions:default": {},
    }),
)'
  run "$in" 'dict_set a_dictionary_attribute "key3":"val3"' //pkg:lib
  assert_equals 'cc_library(
    name = "lib",
    a_dictionary_attribute = {
        "key1": "val1",
        "key3": "val3",
    } | select({
        "@platforms//cpu:arm64": {
            "key2": "val2",
        },
        "//conditions:default": {},
    }),
)'
}

and running bazel test buildozer:buildozer_test --test_output=streamed shows

 cc_library(
     name = "lib",
-    a_dictionary_attribute = {
-        "key1": "val1",
-        "key3": "val3",
-    } | select({
-        "@platforms//cpu:arm64": {
-            "key2": "val2",
-        },
-        "//conditions:default": {},
-    }),
+    a_dictionary_attribute = {"\"key3\"": "val3"},
 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions