Always convert prebuilt cc library headers
Test: go tests Test: CI Test: patch in CL using prebuilts for mainline modules and build Bug: 300640274 Change-Id: I73f70dac679e341670e1484ce57bc984f413d409
This commit is contained in:
@@ -922,6 +922,7 @@ var (
|
|||||||
"aconfig_values",
|
"aconfig_values",
|
||||||
"aidl_interface_headers",
|
"aidl_interface_headers",
|
||||||
"bpf",
|
"bpf",
|
||||||
|
"cc_prebuilt_library_headers",
|
||||||
"combined_apis",
|
"combined_apis",
|
||||||
"droiddoc_exported_dir",
|
"droiddoc_exported_dir",
|
||||||
"java_import",
|
"java_import",
|
||||||
|
@@ -57,6 +57,7 @@ func TestCcLibraryHeadersLoadStatement(t *testing.T) {
|
|||||||
|
|
||||||
func registerCcLibraryHeadersModuleTypes(ctx android.RegistrationContext) {
|
func registerCcLibraryHeadersModuleTypes(ctx android.RegistrationContext) {
|
||||||
cc.RegisterCCBuildComponents(ctx)
|
cc.RegisterCCBuildComponents(ctx)
|
||||||
|
cc.RegisterLibraryHeadersBuildComponents(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCcLibraryHeadersTestCase(t *testing.T, tc Bp2buildTestCase) {
|
func runCcLibraryHeadersTestCase(t *testing.T, tc Bp2buildTestCase) {
|
||||||
@@ -66,9 +67,7 @@ func runCcLibraryHeadersTestCase(t *testing.T, tc Bp2buildTestCase) {
|
|||||||
|
|
||||||
func TestCcLibraryHeadersSimple(t *testing.T) {
|
func TestCcLibraryHeadersSimple(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers test",
|
Description: "cc_library_headers test",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
|
||||||
Filesystem: map[string]string{
|
Filesystem: map[string]string{
|
||||||
"lib-1/lib1a.h": "",
|
"lib-1/lib1a.h": "",
|
||||||
"lib-1/lib1b.h": "",
|
"lib-1/lib1b.h": "",
|
||||||
@@ -127,10 +126,8 @@ cc_library_headers {
|
|||||||
// variant info(select) should go before general info.
|
// variant info(select) should go before general info.
|
||||||
func TestCcLibraryHeadersOsSpecificHeader(t *testing.T) {
|
func TestCcLibraryHeadersOsSpecificHeader(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers test with os-specific header_libs props",
|
Description: "cc_library_headers test with os-specific header_libs props",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
Filesystem: map[string]string{},
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
|
||||||
Filesystem: map[string]string{},
|
|
||||||
StubbedBuildDefinitions: []string{"android-lib", "base-lib", "darwin-lib",
|
StubbedBuildDefinitions: []string{"android-lib", "base-lib", "darwin-lib",
|
||||||
"linux-lib", "linux_bionic-lib", "windows-lib"},
|
"linux-lib", "linux_bionic-lib", "windows-lib"},
|
||||||
Blueprint: soongCcLibraryPreamble + `
|
Blueprint: soongCcLibraryPreamble + `
|
||||||
@@ -197,11 +194,9 @@ cc_library_headers {
|
|||||||
|
|
||||||
func TestCcLibraryHeadersOsSpecficHeaderLibsExportHeaderLibHeaders(t *testing.T) {
|
func TestCcLibraryHeadersOsSpecficHeaderLibsExportHeaderLibHeaders(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers test with os-specific header_libs and export_header_lib_headers props",
|
Description: "cc_library_headers test with os-specific header_libs and export_header_lib_headers props",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
Filesystem: map[string]string{},
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
StubbedBuildDefinitions: []string{"android-lib", "exported-lib"},
|
||||||
Filesystem: map[string]string{},
|
|
||||||
StubbedBuildDefinitions: []string{"android-lib", "exported-lib"},
|
|
||||||
Blueprint: soongCcLibraryPreamble + `
|
Blueprint: soongCcLibraryPreamble + `
|
||||||
cc_library_headers {
|
cc_library_headers {
|
||||||
name: "android-lib",
|
name: "android-lib",
|
||||||
@@ -232,10 +227,8 @@ cc_library_headers {
|
|||||||
|
|
||||||
func TestCcLibraryHeadersArchAndTargetExportSystemIncludes(t *testing.T) {
|
func TestCcLibraryHeadersArchAndTargetExportSystemIncludes(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers test with arch-specific and target-specific export_system_include_dirs props",
|
Description: "cc_library_headers test with arch-specific and target-specific export_system_include_dirs props",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
Filesystem: map[string]string{},
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
|
||||||
Filesystem: map[string]string{},
|
|
||||||
Blueprint: soongCcLibraryPreamble + `cc_library_headers {
|
Blueprint: soongCcLibraryPreamble + `cc_library_headers {
|
||||||
name: "foo_headers",
|
name: "foo_headers",
|
||||||
export_system_include_dirs: [
|
export_system_include_dirs: [
|
||||||
@@ -291,9 +284,7 @@ func TestCcLibraryHeadersArchAndTargetExportSystemIncludes(t *testing.T) {
|
|||||||
|
|
||||||
func TestCcLibraryHeadersNoCrtIgnored(t *testing.T) {
|
func TestCcLibraryHeadersNoCrtIgnored(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers test",
|
Description: "cc_library_headers test",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
|
||||||
Filesystem: map[string]string{
|
Filesystem: map[string]string{
|
||||||
"lib-1/lib1a.h": "",
|
"lib-1/lib1a.h": "",
|
||||||
"lib-1/lib1b.h": "",
|
"lib-1/lib1b.h": "",
|
||||||
@@ -324,11 +315,9 @@ cc_library_headers {
|
|||||||
|
|
||||||
func TestCcLibraryHeadersExportedStaticLibHeadersReexported(t *testing.T) {
|
func TestCcLibraryHeadersExportedStaticLibHeadersReexported(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers exported_static_lib_headers is reexported",
|
Description: "cc_library_headers exported_static_lib_headers is reexported",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
Filesystem: map[string]string{},
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
StubbedBuildDefinitions: []string{"foo_export"},
|
||||||
Filesystem: map[string]string{},
|
|
||||||
StubbedBuildDefinitions: []string{"foo_export"},
|
|
||||||
Blueprint: soongCcLibraryHeadersPreamble + `
|
Blueprint: soongCcLibraryHeadersPreamble + `
|
||||||
cc_library_headers {
|
cc_library_headers {
|
||||||
name: "foo_headers",
|
name: "foo_headers",
|
||||||
@@ -347,11 +336,9 @@ cc_library_headers {
|
|||||||
|
|
||||||
func TestCcLibraryHeadersExportedSharedLibHeadersReexported(t *testing.T) {
|
func TestCcLibraryHeadersExportedSharedLibHeadersReexported(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers exported_shared_lib_headers is reexported",
|
Description: "cc_library_headers exported_shared_lib_headers is reexported",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
Filesystem: map[string]string{},
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
StubbedBuildDefinitions: []string{"foo_export"},
|
||||||
Filesystem: map[string]string{},
|
|
||||||
StubbedBuildDefinitions: []string{"foo_export"},
|
|
||||||
Blueprint: soongCcLibraryHeadersPreamble + `
|
Blueprint: soongCcLibraryHeadersPreamble + `
|
||||||
cc_library_headers {
|
cc_library_headers {
|
||||||
name: "foo_headers",
|
name: "foo_headers",
|
||||||
@@ -370,11 +357,9 @@ cc_library_headers {
|
|||||||
|
|
||||||
func TestCcLibraryHeadersExportedHeaderLibHeadersReexported(t *testing.T) {
|
func TestCcLibraryHeadersExportedHeaderLibHeadersReexported(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers exported_header_lib_headers is reexported",
|
Description: "cc_library_headers exported_header_lib_headers is reexported",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
Filesystem: map[string]string{},
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
StubbedBuildDefinitions: []string{"foo_export"},
|
||||||
Filesystem: map[string]string{},
|
|
||||||
StubbedBuildDefinitions: []string{"foo_export"},
|
|
||||||
Blueprint: soongCcLibraryHeadersPreamble + `
|
Blueprint: soongCcLibraryHeadersPreamble + `
|
||||||
cc_library_headers {
|
cc_library_headers {
|
||||||
name: "foo_headers",
|
name: "foo_headers",
|
||||||
@@ -393,11 +378,9 @@ cc_library_headers {
|
|||||||
|
|
||||||
func TestCcLibraryHeadersWholeStaticLibsReexported(t *testing.T) {
|
func TestCcLibraryHeadersWholeStaticLibsReexported(t *testing.T) {
|
||||||
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
Description: "cc_library_headers whole_static_libs is reexported",
|
Description: "cc_library_headers whole_static_libs is reexported",
|
||||||
ModuleTypeUnderTest: "cc_library_headers",
|
Filesystem: map[string]string{},
|
||||||
ModuleTypeUnderTestFactory: cc.LibraryHeaderFactory,
|
StubbedBuildDefinitions: []string{"foo_export"},
|
||||||
Filesystem: map[string]string{},
|
|
||||||
StubbedBuildDefinitions: []string{"foo_export"},
|
|
||||||
Blueprint: soongCcLibraryHeadersPreamble + `
|
Blueprint: soongCcLibraryHeadersPreamble + `
|
||||||
cc_library_headers {
|
cc_library_headers {
|
||||||
name: "foo_headers",
|
name: "foo_headers",
|
||||||
@@ -412,3 +395,25 @@ cc_library_headers {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPrebuiltCcLibraryHeadersWholeStaticLibsReexported(t *testing.T) {
|
||||||
|
runCcLibraryHeadersTestCase(t, Bp2buildTestCase{
|
||||||
|
Description: "cc_library_headers whole_static_libs is reexported",
|
||||||
|
Filesystem: map[string]string{
|
||||||
|
"foo/bar/Android.bp": simpleModule("cc_library_headers", "foo_headers"),
|
||||||
|
},
|
||||||
|
StubbedBuildDefinitions: []string{"foo_export"},
|
||||||
|
Blueprint: soongCcLibraryHeadersPreamble + `
|
||||||
|
cc_prebuilt_library_headers {
|
||||||
|
name: "foo_headers",
|
||||||
|
whole_static_libs: ["foo_export"],
|
||||||
|
bazel_module: { bp2build_available: true },
|
||||||
|
}
|
||||||
|
` + simpleModule("cc_library_headers", "foo_export"),
|
||||||
|
ExpectedBazelTargets: []string{
|
||||||
|
MakeBazelTarget("cc_library_headers", "foo_headers", AttrNameToString{
|
||||||
|
"deps": `[":foo_export"]`,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -153,8 +153,13 @@ func libraryHeadersBp2Build(ctx android.TopDownMutatorContext, module *Module) {
|
|||||||
|
|
||||||
tags := android.ApexAvailableTagsWithoutTestApexes(ctx, module)
|
tags := android.ApexAvailableTagsWithoutTestApexes(ctx, module)
|
||||||
|
|
||||||
|
name := module.Name()
|
||||||
|
if module.IsPrebuilt() {
|
||||||
|
name = android.RemoveOptionalPrebuiltPrefix(name)
|
||||||
|
}
|
||||||
|
|
||||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{
|
ctx.CreateBazelTargetModule(props, android.CommonAttributes{
|
||||||
Name: module.Name(),
|
Name: name,
|
||||||
Tags: tags,
|
Tags: tags,
|
||||||
}, attrs)
|
}, attrs)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user