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
This commit is contained in:
@@ -120,9 +120,13 @@ func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
|||||||
ctx.CreateBazelTargetModule(props, CommonAttributes{Name: fg.Name()}, attrs)
|
ctx.CreateBazelTargetModule(props, CommonAttributes{Name: fg.Name()}, attrs)
|
||||||
} else {
|
} else {
|
||||||
if fg.ShouldConvertToProtoLibrary(ctx) {
|
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{
|
attrs := &ProtoAttrs{
|
||||||
Srcs: srcs,
|
Srcs: srcs,
|
||||||
Strip_import_prefix: fg.properties.Path,
|
Strip_import_prefix: fg.properties.Path,
|
||||||
|
Tags: tags,
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.CreateBazelTargetModule(
|
ctx.CreateBazelTargetModule(
|
||||||
|
@@ -164,6 +164,7 @@ type ProtoAttrs struct {
|
|||||||
Srcs bazel.LabelListAttribute
|
Srcs bazel.LabelListAttribute
|
||||||
Strip_import_prefix *string
|
Strip_import_prefix *string
|
||||||
Deps bazel.LabelListAttribute
|
Deps bazel.LabelListAttribute
|
||||||
|
Tags []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// For each package in the include_dirs property a proto_library target should
|
// For each package in the include_dirs property a proto_library target should
|
||||||
@@ -203,6 +204,7 @@ func Bp2buildProtoProperties(ctx Bp2buildMutatorContext, m *ModuleBase, srcs baz
|
|||||||
attrs := ProtoAttrs{
|
attrs := ProtoAttrs{
|
||||||
Srcs: bazel.MakeLabelListAttribute(directProtoSrcs),
|
Srcs: bazel.MakeLabelListAttribute(directProtoSrcs),
|
||||||
}
|
}
|
||||||
|
attrs.Deps.Append(bazel.MakeLabelListAttribute(protoLibraries))
|
||||||
|
|
||||||
for axis, configToProps := range m.GetArchVariantProperties(ctx, &ProtoProperties{}) {
|
for axis, configToProps := range m.GetArchVariantProperties(ctx, &ProtoProperties{}) {
|
||||||
for _, rawProps := range configToProps {
|
for _, rawProps := range configToProps {
|
||||||
|
@@ -2284,6 +2284,7 @@ cc_library {
|
|||||||
}`,
|
}`,
|
||||||
ExpectedBazelTargets: []string{
|
ExpectedBazelTargets: []string{
|
||||||
MakeBazelTarget("proto_library", "a_proto", AttrNameToString{
|
MakeBazelTarget("proto_library", "a_proto", AttrNameToString{
|
||||||
|
"deps": `[":a_fg_proto_bp2build_converted"]`,
|
||||||
"srcs": `["a.proto"]`,
|
"srcs": `["a.proto"]`,
|
||||||
}), MakeBazelTarget("cc_lite_proto_library", "a_cc_proto_lite", AttrNameToString{
|
}), MakeBazelTarget("cc_lite_proto_library", "a_cc_proto_lite", AttrNameToString{
|
||||||
"deps": `[
|
"deps": `[
|
||||||
@@ -2298,6 +2299,7 @@ cc_library {
|
|||||||
"whole_archive_deps": `[":a_cc_proto_lite"]`,
|
"whole_archive_deps": `[":a_cc_proto_lite"]`,
|
||||||
}), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{
|
}), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{
|
||||||
"srcs": `["a_fg.proto"]`,
|
"srcs": `["a_fg.proto"]`,
|
||||||
|
"tags": `["manual"]`,
|
||||||
}), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{
|
}), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{
|
||||||
"srcs": `["a_fg.proto"]`,
|
"srcs": `["a_fg.proto"]`,
|
||||||
}),
|
}),
|
||||||
@@ -2336,6 +2338,7 @@ cc_library {
|
|||||||
"whole_archive_deps": `[":a_cc_proto_lite"]`,
|
"whole_archive_deps": `[":a_cc_proto_lite"]`,
|
||||||
}), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{
|
}), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{
|
||||||
"srcs": `["a_fg.proto"]`,
|
"srcs": `["a_fg.proto"]`,
|
||||||
|
"tags": `["manual"]`,
|
||||||
}), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{
|
}), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{
|
||||||
"srcs": `["a_fg.proto"]`,
|
"srcs": `["a_fg.proto"]`,
|
||||||
}),
|
}),
|
||||||
@@ -2368,6 +2371,7 @@ cc_library {
|
|||||||
}`,
|
}`,
|
||||||
ExpectedBazelTargets: []string{
|
ExpectedBazelTargets: []string{
|
||||||
MakeBazelTarget("proto_library", "a_proto", AttrNameToString{
|
MakeBazelTarget("proto_library", "a_proto", AttrNameToString{
|
||||||
|
"deps": `["//path/to/A:a_fg_proto_bp2build_converted"]`,
|
||||||
"srcs": `["a.proto"]`,
|
"srcs": `["a.proto"]`,
|
||||||
}), MakeBazelTarget("cc_lite_proto_library", "a_cc_proto_lite", AttrNameToString{
|
}), MakeBazelTarget("cc_lite_proto_library", "a_cc_proto_lite", AttrNameToString{
|
||||||
"deps": `[
|
"deps": `[
|
||||||
|
@@ -135,7 +135,8 @@ filegroup {
|
|||||||
ExpectedBazelTargets: []string{
|
ExpectedBazelTargets: []string{
|
||||||
MakeBazelTargetNoRestrictions("proto_library", "foo_bp2build_converted", AttrNameToString{
|
MakeBazelTargetNoRestrictions("proto_library", "foo_bp2build_converted", AttrNameToString{
|
||||||
"srcs": `["proto/foo.proto"]`,
|
"srcs": `["proto/foo.proto"]`,
|
||||||
"strip_import_prefix": `"proto"`}),
|
"strip_import_prefix": `"proto"`,
|
||||||
|
"tags": `["manual"]`}),
|
||||||
MakeBazelTargetNoRestrictions("filegroup", "foo", AttrNameToString{
|
MakeBazelTargetNoRestrictions("filegroup", "foo", AttrNameToString{
|
||||||
"srcs": `["proto/foo.proto"]`}),
|
"srcs": `["proto/foo.proto"]`}),
|
||||||
}})
|
}})
|
||||||
|
Reference in New Issue
Block a user