Merge "sh_binary: Use pointers for optional attributes" am: d461407cae
am: df49e17eb2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1931258 Change-Id: I74b2a34fd2e3c7bbdad0c19afee48e2810dec22b
This commit is contained in:
commit
8078d15e35
2 changed files with 23 additions and 6 deletions
|
@ -73,3 +73,20 @@ func TestShBinarySimple(t *testing.T) {
|
|||
})},
|
||||
})
|
||||
}
|
||||
|
||||
func TestShBinaryDefaults(t *testing.T) {
|
||||
runShBinaryTestCase(t, bp2buildTestCase{
|
||||
description: "sh_binary test",
|
||||
moduleTypeUnderTest: "sh_binary",
|
||||
moduleTypeUnderTestFactory: sh.ShBinaryFactory,
|
||||
blueprint: `sh_binary {
|
||||
name: "foo",
|
||||
src: "foo.sh",
|
||||
bazel_module: { bp2build_available: true },
|
||||
}`,
|
||||
expectedBazelTargets: []string{
|
||||
makeBazelTarget("sh_binary", "foo", attrNameToString{
|
||||
"srcs": `["foo.sh"]`,
|
||||
})},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -511,8 +511,8 @@ func ShTestHostFactory() android.Module {
|
|||
|
||||
type bazelShBinaryAttributes struct {
|
||||
Srcs bazel.LabelListAttribute
|
||||
Filename string
|
||||
Sub_dir string
|
||||
Filename *string
|
||||
Sub_dir *string
|
||||
// Bazel also supports the attributes below, but (so far) these are not required for Bionic
|
||||
// deps
|
||||
// data
|
||||
|
@ -538,14 +538,14 @@ func (m *ShBinary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
srcs := bazel.MakeLabelListAttribute(
|
||||
android.BazelLabelForModuleSrc(ctx, []string{*m.properties.Src}))
|
||||
|
||||
var filename string
|
||||
var filename *string
|
||||
if m.properties.Filename != nil {
|
||||
filename = *m.properties.Filename
|
||||
filename = m.properties.Filename
|
||||
}
|
||||
|
||||
var subDir string
|
||||
var subDir *string
|
||||
if m.properties.Sub_dir != nil {
|
||||
subDir = *m.properties.Sub_dir
|
||||
subDir = m.properties.Sub_dir
|
||||
}
|
||||
|
||||
attrs := &bazelShBinaryAttributes{
|
||||
|
|
Loading…
Reference in a new issue