Make robolectric runtimes a host module
I931f9145f1ced21a9f86d647cfbb6d2b645b4f18 made robolectric_android-all-stub
empty, breaking running robolectric tests packaged by Soong.
To enable using robolectric-host-android_all instead, make the
runtimes module a host module.
Also remove the empty robolectric_android-all-stub dependency.
Test: m checkbuild
Change-Id: Idc158d84fd8b6d98d824a6bdc8be297ac43ec2f2
diff --git a/java/robolectric.go b/java/robolectric.go
index ec112bc..04fc117 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -31,7 +31,6 @@
}
var robolectricDefaultLibs = []string{
- "robolectric_android-all-stub",
"Robolectric_all-target",
"mockito-robolectric-prebuilt",
"truth-prebuilt",
@@ -99,7 +98,8 @@
ctx.AddVariationDependencies(nil, roboCoverageLibsTag, r.robolectricProperties.Coverage_libs...)
- ctx.AddVariationDependencies(nil, roboRuntimesTag, "robolectric-android-all-prebuilts")
+ ctx.AddFarVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(),
+ roboRuntimesTag, "robolectric-android-all-prebuilts")
}
func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -335,7 +335,7 @@
func robolectricRuntimesFactory() android.Module {
module := &robolectricRuntimes{}
module.AddProperties(&module.props)
- android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
+ android.InitAndroidArchModule(module, android.HostSupportedNoCross, android.MultilibCommon)
return module
}
@@ -365,6 +365,10 @@
}
func (r *robolectricRuntimes) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ if ctx.Target().Os != ctx.Config().BuildOSCommonTarget.Os {
+ return
+ }
+
files := android.PathsForModuleSrc(ctx, r.props.Jars)
androidAllDir := android.PathForModuleInstall(ctx, "android-all")