Merge "Create bp2build converter for versioned_ndk_headers" into main

This commit is contained in:
Spandan Das
2023-10-05 02:00:55 +00:00
committed by Gerrit Code Review
5 changed files with 61 additions and 6 deletions

View File

@@ -576,7 +576,7 @@ func createBuildConversionMetadata(ctx *android.Context) buildConversionMetadata
Dir: ctx.ModuleDir(m),
Deps: m.(*bootstrap.GoPackage).Deps(),
}
} else if moduleType == "ndk_headers" {
} else if moduleType == "ndk_headers" || moduleType == "versioned_ndk_headers" {
ndkHeaders = append(ndkHeaders, m)
}
})

View File

@@ -5198,7 +5198,7 @@ ndk_headers {
name: "libfoo_headers",
from: "from",
to: "to",
srcs: ["foo.h", "foo_other.h"]
srcs: ["from/foo.h", "from/foo_other.h"]
}
`,
ExpectedBazelTargets: []string{
@@ -5206,11 +5206,42 @@ ndk_headers {
"strip_import_prefix": `"from"`,
"import_prefix": `"to"`,
"hdrs": `[
"foo.h",
"foo_other.h",
"from/foo.h",
"from/foo_other.h",
]`,
}),
},
}
runCcLibraryTestCase(t, tc)
}
func TestVersionedNdkHeadersConversion(t *testing.T) {
tc := Bp2buildTestCase{
Description: "versioned_ndk_headers conversion",
ModuleTypeUnderTest: "versioned_ndk_headers",
ModuleTypeUnderTestFactory: cc.VersionedNdkHeadersFactory,
Blueprint: `
versioned_ndk_headers {
name: "libfoo_headers",
from: "from",
to: "to",
}
`,
Filesystem: map[string]string{
"from/foo.h": "",
"from/foo_other.h": "",
},
ExpectedBazelTargets: []string{
MakeBazelTargetNoRestrictions("ndk_headers", "libfoo_headers", AttrNameToString{
"strip_import_prefix": `"from"`,
"import_prefix": `"to"`,
"hdrs": `[
"from/foo.h",
"from/foo_other.h",
]`,
"run_versioner": "True",
}),
},
}
runCcLibraryTestCase(t, tc)
}