Fix a bug where deps were missing for converted proto_library
This is just a partial fix.
Bug: 246997908
Test: Manual build //frameworks/proto_logging/stats:libstats_proto_host_proto
Change-Id: I9e4e62bce22cb68bcd7f917c57f3d1438fcec716
diff --git a/android/filegroup.go b/android/filegroup.go
index e5eec87..6b11172 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -120,9 +120,13 @@
ctx.CreateBazelTargetModule(props, CommonAttributes{Name: fg.Name()}, attrs)
} else {
if fg.ShouldConvertToProtoLibrary(ctx) {
+ // TODO(b/246997908): we can remove this tag if we could figure out a
+ // solution for this bug.
+ tags := []string{"manual"}
attrs := &ProtoAttrs{
Srcs: srcs,
Strip_import_prefix: fg.properties.Path,
+ Tags: tags,
}
ctx.CreateBazelTargetModule(
diff --git a/android/proto.go b/android/proto.go
index 3a5d4da..3cac9a1 100644
--- a/android/proto.go
+++ b/android/proto.go
@@ -164,6 +164,7 @@
Srcs bazel.LabelListAttribute
Strip_import_prefix *string
Deps bazel.LabelListAttribute
+ Tags []string
}
// For each package in the include_dirs property a proto_library target should
@@ -203,6 +204,7 @@
attrs := ProtoAttrs{
Srcs: bazel.MakeLabelListAttribute(directProtoSrcs),
}
+ attrs.Deps.Append(bazel.MakeLabelListAttribute(protoLibraries))
for axis, configToProps := range m.GetArchVariantProperties(ctx, &ProtoProperties{}) {
for _, rawProps := range configToProps {
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index ba7af09..12cffc3 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -2284,6 +2284,7 @@
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("proto_library", "a_proto", AttrNameToString{
+ "deps": `[":a_fg_proto_bp2build_converted"]`,
"srcs": `["a.proto"]`,
}), MakeBazelTarget("cc_lite_proto_library", "a_cc_proto_lite", AttrNameToString{
"deps": `[
@@ -2298,6 +2299,7 @@
"whole_archive_deps": `[":a_cc_proto_lite"]`,
}), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{
"srcs": `["a_fg.proto"]`,
+ "tags": `["manual"]`,
}), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{
"srcs": `["a_fg.proto"]`,
}),
@@ -2336,6 +2338,7 @@
"whole_archive_deps": `[":a_cc_proto_lite"]`,
}), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{
"srcs": `["a_fg.proto"]`,
+ "tags": `["manual"]`,
}), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{
"srcs": `["a_fg.proto"]`,
}),
@@ -2368,6 +2371,7 @@
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("proto_library", "a_proto", AttrNameToString{
+ "deps": `["//path/to/A:a_fg_proto_bp2build_converted"]`,
"srcs": `["a.proto"]`,
}), MakeBazelTarget("cc_lite_proto_library", "a_cc_proto_lite", AttrNameToString{
"deps": `[
diff --git a/bp2build/filegroup_conversion_test.go b/bp2build/filegroup_conversion_test.go
index d84d4b3..e978fb3 100644
--- a/bp2build/filegroup_conversion_test.go
+++ b/bp2build/filegroup_conversion_test.go
@@ -135,7 +135,8 @@
ExpectedBazelTargets: []string{
MakeBazelTargetNoRestrictions("proto_library", "foo_bp2build_converted", AttrNameToString{
"srcs": `["proto/foo.proto"]`,
- "strip_import_prefix": `"proto"`}),
+ "strip_import_prefix": `"proto"`,
+ "tags": `["manual"]`}),
MakeBazelTargetNoRestrictions("filegroup", "foo", AttrNameToString{
"srcs": `["proto/foo.proto"]`}),
}})