Bp2build converter for java_host_for_device.
Change-Id: I70a345c641bbed3223dc6222062fb6948f7dc6cb Bug: 276710283 Test: Presubmit
This commit is contained in:
@@ -19,12 +19,14 @@ import (
|
||||
"io"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
"android/soong/dexpreopt"
|
||||
)
|
||||
|
||||
type DeviceHostConverter struct {
|
||||
android.ModuleBase
|
||||
android.DefaultableModuleBase
|
||||
android.BazelModuleBase
|
||||
|
||||
properties DeviceHostConverterProperties
|
||||
|
||||
@@ -76,6 +78,7 @@ func HostForDeviceFactory() android.Module {
|
||||
module.AddProperties(&module.properties)
|
||||
|
||||
InitJavaModule(module, android.DeviceSupported)
|
||||
android.InitBazelModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
@@ -186,3 +189,30 @@ func (d *DeviceHostConverter) AndroidMk() android.AndroidMkData {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type bazelDeviceHostConverterAttributes struct {
|
||||
Deps bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (d *DeviceHostConverter) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
ctx.CreateBazelTargetModule(
|
||||
bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "java_host_for_device",
|
||||
Bzl_load_location: "//build/bazel/rules/java:host_for_device.bzl",
|
||||
},
|
||||
android.CommonAttributes{Name: d.Name()},
|
||||
&bazelDeviceHostConverterAttributes{
|
||||
Deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, d.properties.Libs)),
|
||||
},
|
||||
)
|
||||
neverlinkProp := true
|
||||
neverLinkAttrs := &javaLibraryAttributes{
|
||||
Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + d.Name()}),
|
||||
Neverlink: bazel.BoolAttribute{Value: &neverlinkProp},
|
||||
}
|
||||
ctx.CreateBazelTargetModule(
|
||||
javaLibraryBazelTargetModuleProperties(),
|
||||
android.CommonAttributes{Name: d.Name() + "-neverlink"},
|
||||
neverLinkAttrs)
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user