Handle proto.include_dirs for java
The proto_library(s) created for include_dirs will be added to transitive_deps This also fixes an existing bug for java_library containing .protos in srcs via filegroups. ``` java_library { name: "foo", srcs: ["foo.proto", "foo_filegroup"], } ``` At ToT, foo_filegroup was missing from the equivalent proto_library in bp2build workspace. Bug: 285140726 Test: allowlisted pandora-proto-java and built that Change-Id: I2657d8cdef2e47434bc3e0d09a074c8e27299afc
This commit is contained in:
@@ -144,6 +144,13 @@ func protoFlags(ctx android.ModuleContext, j *CommonProperties, p *android.Proto
|
|||||||
|
|
||||||
type protoAttributes struct {
|
type protoAttributes struct {
|
||||||
Deps bazel.LabelListAttribute
|
Deps bazel.LabelListAttribute
|
||||||
|
|
||||||
|
// A list of proto_library targets that the proto_library in `deps` depends on
|
||||||
|
// This list is overestimation.
|
||||||
|
// Overestimation is necessary since Soong includes other protos via proto.include_dirs and not
|
||||||
|
// a specific .proto file module explicitly.
|
||||||
|
Transitive_deps bazel.LabelListAttribute
|
||||||
|
|
||||||
Sdk_version bazel.StringAttribute
|
Sdk_version bazel.StringAttribute
|
||||||
Java_version bazel.StringAttribute
|
Java_version bazel.StringAttribute
|
||||||
}
|
}
|
||||||
@@ -176,9 +183,9 @@ func bp2buildProto(ctx android.Bp2buildMutatorContext, m *Module, protoSrcs baze
|
|||||||
ctx.PropertyErrorf("proto.type", "cannot handle conversion at this time: %q", typ)
|
ctx.PropertyErrorf("proto.type", "cannot handle conversion at this time: %q", typ)
|
||||||
}
|
}
|
||||||
|
|
||||||
protoLabel := bazel.Label{Label: ":" + m.Name() + "_proto"}
|
|
||||||
protoAttrs := &protoAttributes{
|
protoAttrs := &protoAttributes{
|
||||||
Deps: bazel.MakeSingleLabelListAttribute(protoLabel),
|
Deps: bazel.MakeLabelListAttribute(protoInfo.Proto_libs),
|
||||||
|
Transitive_deps: bazel.MakeLabelListAttribute(protoInfo.Transitive_proto_libs),
|
||||||
Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
|
Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
|
||||||
Sdk_version: bazel.StringAttribute{Value: m.deviceProperties.Sdk_version},
|
Sdk_version: bazel.StringAttribute{Value: m.deviceProperties.Sdk_version},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user