Enable new_robolectric
Allow new robolectric to break soong's exepected machine type restrictions Test: mma in /external/robolectric Bug: 244627502 Change-Id: If58a36b2d84804d586d9c8a773e2e739867fa987 Merged-In: If58a36b2d84804d586d9c8a773e2e739867fa987
This commit is contained in:
@@ -154,6 +154,7 @@ func createJavaDeviceForHostRules() []Rule {
|
||||
"development/build",
|
||||
"external/guava",
|
||||
"external/robolectric-shadows",
|
||||
"external/robolectric",
|
||||
"frameworks/layoutlib",
|
||||
}
|
||||
|
||||
|
@@ -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...)
|
||||
|
Reference in New Issue
Block a user