Enable new_robolectric am: ebaac47e4e am: c07abe9ad2

Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/20387913

Change-Id: I57f613dd82abe7fc0132572028c43a44bf00e114
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Rex Hoffman
2022-11-18 07:18:13 +00:00
committed by Automerger Merge Worker
2 changed files with 12 additions and 1 deletions

View File

@@ -155,6 +155,7 @@ func createJavaDeviceForHostRules() []Rule {
"external/guava",
"external/kotlinx.coroutines",
"external/robolectric-shadows",
"external/robolectric",
"frameworks/layoutlib",
}

View File

@@ -23,6 +23,8 @@ import (
"android/soong/android"
"android/soong/java/config"
"android/soong/tradefed"
"github.com/google/blueprint/proptools"
)
func init() {
@@ -63,6 +65,10 @@ type robolectricProperties struct {
// The version number of a robolectric prebuilt to use from prebuilts/misc/common/robolectric
// instead of the one built from source in external/robolectric-shadows.
Robolectric_prebuilt_version *string
// Use /external/robolectric rather than /external/robolectric-shadows as the version of robolectri
// to use. /external/robolectric closely tracks github's master, and will fully replace /external/robolectric-shadows
Upstream *bool
}
type robolectricTest struct {
@@ -106,7 +112,11 @@ func (r *robolectricTest) DepsMutator(ctx android.BottomUpMutatorContext) {
if v := String(r.robolectricProperties.Robolectric_prebuilt_version); v != "" {
ctx.AddVariationDependencies(nil, libTag, fmt.Sprintf(robolectricPrebuiltLibPattern, v))
} else {
ctx.AddVariationDependencies(nil, libTag, robolectricCurrentLib)
if proptools.Bool(r.robolectricProperties.Upstream) {
ctx.AddVariationDependencies(nil, libTag, robolectricCurrentLib+"_upstream")
} else {
ctx.AddVariationDependencies(nil, libTag, robolectricCurrentLib)
}
}
ctx.AddVariationDependencies(nil, libTag, robolectricDefaultLibs...)