bp2build: Handle export_generated_header property
The generated_header property resides in BaseCompilerProperties, while
export_generated_header resides in BaseLinkerProperties. Previously
bp2build handled these property structs separately; however, these two
related properties residing in separate structs requires restructuring
the code to allow access to both BaseCompilerProperties and
BaseLinkerProperties for a single axis/configuration combination to
resolve which generated headers are exported/not for the
axis/configuration..
Test: go test soong tests
Test: build/bazel/ci/bp2build.sh
Change-Id: Id150003637fd19d87e8dc5d6941e9f36dc4031dd
diff --git a/cc/library.go b/cc/library.go
index d63acfb..4231807 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -293,8 +293,9 @@
sharedAttrs := bp2BuildParseSharedProps(ctx, m)
staticAttrs := bp2BuildParseStaticProps(ctx, m)
- compilerAttrs := bp2BuildParseCompilerProps(ctx, m)
- linkerAttrs := bp2BuildParseLinkerProps(ctx, m)
+ baseAttributes := bp2BuildParseBaseProps(ctx, m)
+ compilerAttrs := baseAttributes.compilerAttributes
+ linkerAttrs := baseAttributes.linkerAttributes
exportedIncludes := bp2BuildParseExportedIncludes(ctx, m)
srcs := compilerAttrs.srcs
@@ -309,6 +310,7 @@
Srcs: srcs,
Srcs_c: compilerAttrs.cSrcs,
Srcs_as: compilerAttrs.asSrcs,
+ Hdrs: compilerAttrs.hdrs,
Copts: compilerAttrs.copts,
Cppflags: compilerAttrs.cppFlags,
@@ -2357,8 +2359,10 @@
}
isStatic := modType == "cc_library_static"
- compilerAttrs := bp2BuildParseCompilerProps(ctx, module)
- linkerAttrs := bp2BuildParseLinkerProps(ctx, module)
+ baseAttributes := bp2BuildParseBaseProps(ctx, module)
+ compilerAttrs := baseAttributes.compilerAttributes
+ linkerAttrs := baseAttributes.linkerAttributes
+
exportedIncludes := bp2BuildParseExportedIncludes(ctx, module)
// Append shared/static{} stanza properties. These won't be specified on
@@ -2388,6 +2392,7 @@
Srcs_c: compilerAttrs.cSrcs,
Srcs_as: compilerAttrs.asSrcs,
Copts: compilerAttrs.copts,
+ Hdrs: compilerAttrs.hdrs,
Deps: linkerAttrs.deps,
Implementation_deps: linkerAttrs.implementationDeps,