diff options
| author | 2022-01-29 20:20:37 +0000 | |
|---|---|---|
| committer | 2022-01-29 20:20:37 +0000 | |
| commit | bf670bc2c5bbe03e81c6f8e1a480b2b39bd8e81f (patch) | |
| tree | a0a820de2e1f5b39768075c60702b76fa518bbbf /java/java.go | |
| parent | 996117ca3717732aa1e21e058cf79791a303ba60 (diff) | |
| parent | ea64e62dab0fa0a62ed1390546c2bdecd777e7b1 (diff) | |
Merge "Basic bp2build converter for java_import." am: ea64e62dab
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1965379
Change-Id: I0f486709cd7e33dfb8a0f43afeafe0a95b3d1670
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go index 171415207..ca4b3cf41 100644 --- a/java/java.go +++ b/java/java.go @@ -1328,6 +1328,7 @@ type Import struct { android.ModuleBase android.DefaultableModuleBase android.ApexModuleBase + android.BazelModuleBase prebuilt android.Prebuilt android.SdkBase @@ -1683,6 +1684,7 @@ func ImportFactory() android.Module { android.InitPrebuiltModule(module, &module.properties.Jars) android.InitApexModule(module) android.InitSdkAwareModule(module) + android.InitBazelModule(module) InitJavaModule(module, android.HostAndDeviceSupported) return module } @@ -2101,3 +2103,21 @@ func javaBinaryHostBp2Build(ctx android.TopDownMutatorContext, m *Binary) { // Create the BazelTargetModule. ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs) } + +type bazelJavaImportAttributes struct { + Jars bazel.LabelListAttribute +} + +// java_import bp2Build converter. +func (i *Import) ConvertWithBp2build(ctx android.TopDownMutatorContext) { + //TODO(b/209577426): Support multiple arch variants + jars := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, i.properties.Jars, []string(nil))) + + attrs := &bazelJavaImportAttributes{ + Jars: jars, + } + props := bazel.BazelTargetModuleProperties{Rule_class: "java_import"} + + ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: android.RemoveOptionalPrebuiltPrefix(i.Name())}, attrs) + +} |