Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a85fb19 authored by Yu Liu's avatar Yu Liu
Browse files

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
parent 609c3e07
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -120,9 +120,13 @@ func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) {
		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(
+2 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ type ProtoAttrs struct {
	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 @@ func Bp2buildProtoProperties(ctx Bp2buildMutatorContext, m *ModuleBase, srcs baz
		attrs := ProtoAttrs{
			Srcs: bazel.MakeLabelListAttribute(directProtoSrcs),
		}
		attrs.Deps.Append(bazel.MakeLabelListAttribute(protoLibraries))

		for axis, configToProps := range m.GetArchVariantProperties(ctx, &ProtoProperties{}) {
			for _, rawProps := range configToProps {
+4 −0
Original line number Diff line number Diff line
@@ -2284,6 +2284,7 @@ cc_library {
}`,
		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 @@ cc_library {
				"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 @@ cc_library {
				"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 @@ cc_library {
}`,
		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": `[
+2 −1
Original line number Diff line number Diff line
@@ -135,7 +135,8 @@ filegroup {
		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"]`}),
		}})