summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Alix Espino <agespino@google.com> 2023-03-06 20:32:16 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-03-06 20:32:16 +0000
commit09907dab557fa3e2bdfdc4241ce207b7e0daa05e (patch)
treec781a377607ec1f8f303a68168029442d012b274 /java/java.go
parent6bc5e2cefa5c161300f8aadcbf760476a8368e4a (diff)
parent5afd9fad98f5a30edae4f8f23044d4be6ab73fc6 (diff)
Merge changes from topic "ktResourceStrip"
* changes: code cleanup for bp2build java_binary with kt srcs resource_strip_prefix support for kotlin srcs
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go24
1 files changed, 6 insertions, 18 deletions
diff --git a/java/java.go b/java/java.go
index a00e26f83..6a764cfe9 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2838,7 +2838,7 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
props = bazel.BazelTargetModuleProperties{
Rule_class: "kt_jvm_library",
- Bzl_load_location: "@rules_kotlin//kotlin:jvm_library.bzl",
+ Bzl_load_location: "//build/bazel/rules/kotlin:kt_jvm_library.bzl",
}
}
@@ -2933,14 +2933,15 @@ func javaBinaryHostBp2Build(ctx android.TopDownMutatorContext, m *Binary) {
ktName := m.Name() + "_kt"
ktProps := bazel.BazelTargetModuleProperties{
Rule_class: "kt_jvm_library",
- Bzl_load_location: "@rules_kotlin//kotlin:jvm_library.bzl",
+ Bzl_load_location: "//build/bazel/rules/kotlin:kt_jvm_library.bzl",
}
ktAttrs := &javaLibraryAttributes{
Deps: deps,
javaCommonAttributes: &javaCommonAttributes{
- Srcs: commonAttrs.Srcs,
- Plugins: commonAttrs.Plugins,
- Javacopts: commonAttrs.Javacopts,
+ Srcs: commonAttrs.Srcs,
+ Plugins: commonAttrs.Plugins,
+ Javacopts: commonAttrs.Javacopts,
+ javaResourcesAttributes: commonAttrs.javaResourcesAttributes,
},
}
@@ -2948,19 +2949,6 @@ func javaBinaryHostBp2Build(ctx android.TopDownMutatorContext, m *Binary) {
ktAttrs.javaCommonAttributes.Common_srcs = bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, m.properties.Common_srcs))
}
- // kt_jvm_library does not support resource_strip_prefix, if this attribute
- // is set, than javaResourcesAttributes needs to be set in the
- // javaCommonAttributes of the java_binary target
- if commonAttrs.javaResourcesAttributes != nil {
- if commonAttrs.javaResourcesAttributes.Resource_strip_prefix != nil {
- attrs.javaCommonAttributes = &javaCommonAttributes{
- javaResourcesAttributes: commonAttrs.javaResourcesAttributes,
- }
- } else {
- ktAttrs.javaCommonAttributes.javaResourcesAttributes = commonAttrs.javaResourcesAttributes
- }
- }
-
ctx.CreateBazelTargetModule(ktProps, android.CommonAttributes{Name: ktName}, ktAttrs)
attrs.Runtime_deps.Add(&bazel.LabelAttribute{Value: &bazel.Label{Label: ":" + ktName}})
}