diff --git a/android/bazel.go b/android/bazel.go index 0940205ec..8e2e3508e 100644 --- a/android/bazel.go +++ b/android/bazel.go @@ -291,7 +291,7 @@ var ( "external/bouncycastle": Bp2BuildDefaultTrue, "external/brotli": Bp2BuildDefaultTrue, "external/conscrypt": Bp2BuildDefaultTrue, - "external/error_prone": Bp2BuildDefaultTrue, + "external/error_prone": Bp2BuildDefaultTrueRecursively, "external/fmtlib": Bp2BuildDefaultTrueRecursively, "external/google-benchmark": Bp2BuildDefaultTrueRecursively, "external/googletest": Bp2BuildDefaultTrueRecursively, @@ -431,8 +431,19 @@ var ( "libprotobuf-internal-protos", // b/210751803, we don't handle path property for filegroups "libprotobuf-internal-python-srcs", // b/210751803, we don't handle path property for filegroups "libprotobuf-java-full", // b/210751803, we don't handle path property for filegroups + "host-libprotobuf-java-full", // b/210751803, we don't handle path property for filegroups "libprotobuf-java-util-full", // b/210751803, we don't handle path property for filegroups - "conscrypt", // b/210751803, we don't handle path property for filegroups + + "conscrypt", // b/210751803, we don't handle path property for filegroups + "conscrypt-for-host", // b/210751803, we don't handle path property for filegroups + + "host-libprotobuf-java-lite", // b/217236083, java_library cannot have deps without srcs + "host-libprotobuf-java-micro", // b/217236083, java_library cannot have deps without srcs + "host-libprotobuf-java-nano", // b/217236083, java_library cannot have deps without srcs + "error_prone_core", // b/217236083, java_library cannot have deps without srcs + "bouncycastle-host", // b/217236083, java_library cannot have deps without srcs + + "apex_manifest_proto_java", // b/215230097, we don't handle .proto files in java_library srcs attribute // python protos "libprotobuf-python", // contains .proto sources diff --git a/java/base.go b/java/base.go index a3eb8de21..42d7733ca 100644 --- a/java/base.go +++ b/java/base.go @@ -1969,7 +1969,7 @@ var _ ModuleWithStem = (*Module)(nil) func (j *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) { switch ctx.ModuleType() { - case "java_library", "java_library_host": + case "java_library", "java_library_host", "java_library_static": if lib, ok := ctx.Module().(*Library); ok { javaLibraryBp2Build(ctx, lib) } @@ -1978,5 +1978,4 @@ func (j *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) { javaBinaryHostBp2Build(ctx, binary) } } - } diff --git a/java/java.go b/java/java.go index ca4b3cf41..867045aa0 100644 --- a/java/java.go +++ b/java/java.go @@ -2005,7 +2005,7 @@ type javaLibraryAttributes struct { Javacopts bazel.StringListAttribute } -func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) { +func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) *javaLibraryAttributes { srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs)) attrs := &javaLibraryAttributes{ Srcs: srcs, @@ -2015,9 +2015,21 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) { attrs.Javacopts = bazel.MakeStringListAttribute(m.properties.Javacflags) } + var deps bazel.LabelList if m.properties.Libs != nil { - attrs.Deps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, m.properties.Libs)) + deps.Append(android.BazelLabelForModuleDeps(ctx, m.properties.Libs)) } + if m.properties.Static_libs != nil { + //TODO(b/217236083) handle static libs similarly to Soong + deps.Append(android.BazelLabelForModuleDeps(ctx, m.properties.Static_libs)) + } + attrs.Deps = bazel.MakeLabelListAttribute(deps) + + return attrs +} + +func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) { + attrs := m.convertLibraryAttrsBp2Build(ctx) props := bazel.BazelTargetModuleProperties{ Rule_class: "java_library",