Remove library decorator for extracting headers
It is unused and removing it allows us to use the same function for
prebuilt/not libraries.
Test: bp2build.sh
Change-Id: I92ac56496cff2c2e55d6eb9f261fe75a1b232856
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 19855fa..5c2523c 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -828,22 +828,7 @@
SystemIncludes bazel.StringListAttribute
}
-func bp2BuildParseExportedIncludes(ctx android.BazelConversionPathContext, module *Module, existingIncludes BazelIncludes) BazelIncludes {
- libraryDecorator := module.linker.(*libraryDecorator)
- return bp2BuildParseExportedIncludesHelper(ctx, module, libraryDecorator, &existingIncludes)
-}
-
-// Bp2buildParseExportedIncludesForPrebuiltLibrary returns a BazelIncludes with Bazel-ified values
-// to export includes from the underlying module's properties.
-func Bp2BuildParseExportedIncludesForPrebuiltLibrary(ctx android.BazelConversionPathContext, module *Module) BazelIncludes {
- prebuiltLibraryLinker := module.linker.(*prebuiltLibraryLinker)
- libraryDecorator := prebuiltLibraryLinker.libraryDecorator
- return bp2BuildParseExportedIncludesHelper(ctx, module, libraryDecorator, nil)
-}
-
-// bp2BuildParseExportedIncludes creates a string list attribute contains the
-// exported included directories of a module.
-func bp2BuildParseExportedIncludesHelper(ctx android.BazelConversionPathContext, module *Module, libraryDecorator *libraryDecorator, includes *BazelIncludes) BazelIncludes {
+func bp2BuildParseExportedIncludes(ctx android.BazelConversionPathContext, module *Module, includes *BazelIncludes) BazelIncludes {
var exported BazelIncludes
if includes != nil {
exported = *includes
diff --git a/cc/library.go b/cc/library.go
index fdbbccb..8f8e038 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -289,7 +289,7 @@
baseAttributes := bp2BuildParseBaseProps(ctx, m)
compilerAttrs := baseAttributes.compilerAttributes
linkerAttrs := baseAttributes.linkerAttributes
- exportedIncludes := bp2BuildParseExportedIncludes(ctx, m, compilerAttrs.includes)
+ exportedIncludes := bp2BuildParseExportedIncludes(ctx, m, &compilerAttrs.includes)
srcs := compilerAttrs.srcs
@@ -2450,7 +2450,7 @@
compilerAttrs := baseAttributes.compilerAttributes
linkerAttrs := baseAttributes.linkerAttributes
- exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, compilerAttrs.includes)
+ exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, &compilerAttrs.includes)
// Append shared/static{} stanza properties. These won't be specified on
// cc_library_* itself, but may be specified in cc_defaults that this module
diff --git a/cc/library_headers.go b/cc/library_headers.go
index 41ebcc7..cdeb392 100644
--- a/cc/library_headers.go
+++ b/cc/library_headers.go
@@ -122,7 +122,7 @@
func libraryHeadersBp2Build(ctx android.TopDownMutatorContext, module *Module) {
baseAttributes := bp2BuildParseBaseProps(ctx, module)
- exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, baseAttributes.includes)
+ exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, &baseAttributes.includes)
linkerAttrs := baseAttributes.linkerAttributes
attrs := &bazelCcLibraryHeadersAttributes{
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index f54c6f8..57f7299 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -354,7 +354,7 @@
func prebuiltLibraryStaticBp2Build(ctx android.TopDownMutatorContext, module *Module, fullBuild bool) {
prebuiltAttrs := Bp2BuildParsePrebuiltLibraryProps(ctx, module, true)
- exportedIncludes := Bp2BuildParseExportedIncludesForPrebuiltLibrary(ctx, module)
+ exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, nil)
attrs := &bazelPrebuiltLibraryStaticAttributes{
Static_library: prebuiltAttrs.Src,