diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/aar.go | 25 | ||||
| -rw-r--r-- | java/java.go | 2 |
2 files changed, 21 insertions, 6 deletions
diff --git a/java/aar.go b/java/aar.go index ccd68cd6e..f4a2ff287 100644 --- a/java/aar.go +++ b/java/aar.go @@ -1054,12 +1054,15 @@ func (a *AndroidLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) ctx.ModuleErrorf("Module has direct dependencies but no sources. Bazel will not allow this.") } + name := a.Name() + props := bazel.BazelTargetModuleProperties{ + Rule_class: "android_library", + Bzl_load_location: "@rules_android//rules:rules.bzl", + } + ctx.CreateBazelTargetModule( - bazel.BazelTargetModuleProperties{ - Rule_class: "android_library", - Bzl_load_location: "@rules_android//rules:rules.bzl", - }, - android.CommonAttributes{Name: a.Name()}, + props, + android.CommonAttributes{Name: name}, &bazelAndroidLibrary{ &javaLibraryAttributes{ javaCommonAttributes: commonAttrs, @@ -1069,4 +1072,16 @@ func (a *AndroidLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) a.convertAaptAttrsWithBp2Build(ctx), }, ) + + neverlink := true + ctx.CreateBazelTargetModule( + props, + android.CommonAttributes{Name: name + "-neverlink"}, + &bazelAndroidLibrary{ + javaLibraryAttributes: &javaLibraryAttributes{ + Neverlink: bazel.BoolAttribute{Value: &neverlink}, + Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}), + }, + }, + ) } diff --git a/java/java.go b/java/java.go index 6d53e1e32..927a8d804 100644 --- a/java/java.go +++ b/java/java.go @@ -2681,7 +2681,7 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) if m.properties.Libs != nil { // TODO 244210934 ALIX Check if this else statement breaks presubmits get rid of it if it doesn't - if strings.HasPrefix(ctx.ModuleType(), "java_binary") || strings.HasPrefix(ctx.ModuleType(), "java_library") { + if strings.HasPrefix(ctx.ModuleType(), "java_binary") || strings.HasPrefix(ctx.ModuleType(), "java_library") || ctx.ModuleType() == "android_library" { for _, d := range m.properties.Libs { neverlinkLabel := android.BazelLabelForModuleDepSingle(ctx, d) neverlinkLabel.Label = neverlinkLabel.Label + "-neverlink" |