Split asm and c flags and srcs in bp2build output
This allows removal of almost all current items from the mixed build
denylist, which were previously broken due to being unable to separately
control flags for compilations of different languages within the same
target.
Note that this does not appropriately implement asm/c srcs and flags for
either the shared variant or the static variant. This will require a
followup.
Test: bp2build.sh and mixed_libc.sh CI scripts
Test: Updated b2build tests
Change-Id: I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
diff --git a/cc/library.go b/cc/library.go
index c918b96..9fb7a24 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -230,6 +230,13 @@
Copts bazel.StringListAttribute
Includes bazel.StringListAttribute
Linkopts bazel.StringListAttribute
+
+ Cppflags bazel.StringListAttribute
+ Srcs_c bazel.LabelListAttribute
+ Conlyflags bazel.StringListAttribute
+ Srcs_as bazel.LabelListAttribute
+ Asflags bazel.StringListAttribute
+
// Attributes pertaining to shared variant.
Shared_copts bazel.StringListAttribute
Shared_srcs bazel.LabelListAttribute
@@ -239,6 +246,7 @@
Whole_archive_deps_for_shared bazel.LabelListAttribute
User_link_flags bazel.StringListAttribute
Version_script bazel.LabelAttribute
+
// Attributes pertaining to static variant.
Static_copts bazel.StringListAttribute
Static_srcs bazel.LabelListAttribute
@@ -294,20 +302,27 @@
srcs.Append(compilerAttrs.srcs)
attrs := &bazelCcLibraryAttributes{
- Srcs: srcs,
- Implementation_deps: linkerAttrs.deps,
- Deps: linkerAttrs.exportedDeps,
- Dynamic_deps: linkerAttrs.dynamicDeps,
- Whole_archive_deps: linkerAttrs.wholeArchiveDeps,
- Copts: compilerAttrs.copts,
- Includes: exportedIncludes,
- Linkopts: linkerAttrs.linkopts,
+ Srcs: srcs,
+ Implementation_deps: linkerAttrs.deps,
+ Deps: linkerAttrs.exportedDeps,
+ Dynamic_deps: linkerAttrs.dynamicDeps,
+ Whole_archive_deps: linkerAttrs.wholeArchiveDeps,
+ Copts: compilerAttrs.copts,
+ Includes: exportedIncludes,
+ Linkopts: linkerAttrs.linkopts,
+ Cppflags: compilerAttrs.cppFlags,
+ Srcs_c: compilerAttrs.cSrcs,
+ Conlyflags: compilerAttrs.conlyFlags,
+ Srcs_as: compilerAttrs.asSrcs,
+ Asflags: compilerAttrs.asFlags,
+
Shared_copts: sharedAttrs.copts,
Shared_srcs: sharedAttrs.srcs,
Static_deps_for_shared: sharedAttrs.staticDeps,
Whole_archive_deps_for_shared: sharedAttrs.wholeArchiveDeps,
Dynamic_deps_for_shared: sharedAttrs.dynamicDeps,
Version_script: linkerAttrs.versionScript,
+
Static_copts: staticAttrs.copts,
Static_srcs: staticAttrs.srcs,
Static_deps_for_static: staticAttrs.staticDeps,
@@ -2230,6 +2245,12 @@
Linkstatic bool
Includes bazel.StringListAttribute
Hdrs bazel.LabelListAttribute
+
+ Cppflags bazel.StringListAttribute
+ Srcs_c bazel.LabelListAttribute
+ Conlyflags bazel.StringListAttribute
+ Srcs_as bazel.LabelListAttribute
+ Asflags bazel.StringListAttribute
}
type bazelCcLibraryStatic struct {
@@ -2259,6 +2280,12 @@
Linkopts: linkerAttrs.linkopts,
Linkstatic: true,
Includes: exportedIncludes,
+
+ Cppflags: compilerAttrs.cppFlags,
+ Srcs_c: compilerAttrs.cSrcs,
+ Conlyflags: compilerAttrs.conlyFlags,
+ Srcs_as: compilerAttrs.asSrcs,
+ Asflags: compilerAttrs.asFlags,
}
props := bazel.BazelTargetModuleProperties{