Merge "Propagate implementation_whole_archive_deps"

This commit is contained in:
Treehugger Robot
2022-09-16 22:28:06 +00:00
committed by Gerrit Code Review
2 changed files with 25 additions and 20 deletions

View File

@@ -2078,7 +2078,8 @@ func TestCcLibraryProtoSimple(t *testing.T) {
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
"deps": `[":libprotobuf-cpp-lite"]`,
}), MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
}),
},
})
@@ -2104,7 +2105,8 @@ func TestCcLibraryProtoNoCanonicalPathFromRoot(t *testing.T) {
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
"deps": `[":libprotobuf-cpp-lite"]`,
}), MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
}),
},
})
@@ -2129,7 +2131,8 @@ func TestCcLibraryProtoExplicitCanonicalPathFromRoot(t *testing.T) {
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
"deps": `[":libprotobuf-cpp-lite"]`,
}), MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
}),
},
})
@@ -2156,7 +2159,8 @@ func TestCcLibraryProtoFull(t *testing.T) {
"implementation_whole_archive_deps": `[":foo_cc_proto"]`,
"deps": `[":libprotobuf-cpp-full"]`,
}), MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"dynamic_deps": `[":libprotobuf-cpp-full"]`,
"dynamic_deps": `[":libprotobuf-cpp-full"]`,
"implementation_whole_archive_deps": `[":foo_cc_proto"]`,
}),
},
})
@@ -2183,7 +2187,8 @@ func TestCcLibraryProtoLite(t *testing.T) {
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
"deps": `[":libprotobuf-cpp-lite"]`,
}), MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
}),
},
})
@@ -2239,7 +2244,8 @@ func TestCcLibraryProtoIncludeDirs(t *testing.T) {
"deps": `[":libprotobuf-cpp-lite"]`,
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
}), MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
"implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
}),
},
})
@@ -2954,10 +2960,9 @@ cc_library {
"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
"local_includes": `["."]`,
}),
// TODO(b/239311679) Add implementation_whole_archive_deps to cc_library_shared
// for bp2build to be fully correct. This fallback is affecting proto as well.
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"local_includes": `["."]`,
"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
"local_includes": `["."]`,
}),
},
})
@@ -2991,10 +2996,9 @@ cc_library {
"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
"local_includes": `["."]`,
}),
// TODO(b/239311679) Add implementation_whole_archive_deps to cc_library_shared
// for bp2build to be fully correct. This fallback is affecting proto as well.
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"local_includes": `["."]`,
"local_includes": `["."]`,
"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
}),
},
})

View File

@@ -339,14 +339,15 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
Copts: *compilerAttrs.copts.Clone().Append(sharedAttrs.Copts),
Hdrs: *compilerAttrs.hdrs.Clone().Append(sharedAttrs.Hdrs),
Deps: *linkerAttrs.deps.Clone().Append(sharedAttrs.Deps),
Implementation_deps: *linkerAttrs.implementationDeps.Clone().Append(sharedAttrs.Implementation_deps),
Dynamic_deps: *linkerAttrs.dynamicDeps.Clone().Append(sharedAttrs.Dynamic_deps),
Implementation_dynamic_deps: *linkerAttrs.implementationDynamicDeps.Clone().Append(sharedAttrs.Implementation_dynamic_deps),
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(sharedAttrs.Whole_archive_deps),
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps),
Runtime_deps: linkerAttrs.runtimeDeps,
sdkAttributes: bp2BuildParseSdkAttributes(m),
Deps: *linkerAttrs.deps.Clone().Append(sharedAttrs.Deps),
Implementation_deps: *linkerAttrs.implementationDeps.Clone().Append(sharedAttrs.Implementation_deps),
Dynamic_deps: *linkerAttrs.dynamicDeps.Clone().Append(sharedAttrs.Dynamic_deps),
Implementation_dynamic_deps: *linkerAttrs.implementationDynamicDeps.Clone().Append(sharedAttrs.Implementation_dynamic_deps),
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(sharedAttrs.Whole_archive_deps),
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps),
Runtime_deps: linkerAttrs.runtimeDeps,
sdkAttributes: bp2BuildParseSdkAttributes(m),
}
staticTargetAttrs := &bazelCcLibraryStaticAttributes{