Bp2build: handle embedded structs as blueprint
For structs that are embedded, Blueprint does not nest under the
embedded name, flattening them into the original struct for blueprint
files (e.g.
9fd2ed93df
:proptools/unpack_test.go;l=402-431;drc=3adb2409648d6f8b25354ac47f083dae87731f10).
We should do the same for bp2build.
This will also allow us to embed structs for bp2build conversion
allowing more reuse.
Test: go test bp2build tests
Change-Id: I9ce088462adaf59bffa80bea76cd488e31f98e9d
This commit is contained in:
@@ -319,6 +319,30 @@ custom {
|
||||
"//build/bazel/platforms/arch:x86": [":dep"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)`,
|
||||
},
|
||||
},
|
||||
{
|
||||
blueprint: `custom {
|
||||
name: "embedded_props",
|
||||
embedded_prop: "abc",
|
||||
bazel_module: { bp2build_available: true },
|
||||
}`,
|
||||
expectedBazelTargets: []string{`custom(
|
||||
name = "embedded_props",
|
||||
embedded_attr = "abc",
|
||||
)`,
|
||||
},
|
||||
},
|
||||
{
|
||||
blueprint: `custom {
|
||||
name: "ptr_to_embedded_props",
|
||||
other_embedded_prop: "abc",
|
||||
bazel_module: { bp2build_available: true },
|
||||
}`,
|
||||
expectedBazelTargets: []string{`custom(
|
||||
name = "ptr_to_embedded_props",
|
||||
other_embedded_attr = "abc",
|
||||
)`,
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user