Set strict_mode to true
The default strict_mode is now set to true. We are encourage teams to write tests in strict_mode to make tests Bivalent (able to run on device and devicelessly)
When opting out from strict_mode, "robolectric_strict_mode_res" should be included in lib for whitelisting purpose.
Test: atest MyRoboTests
Bug: 334089788
Change-Id: I3098e2c1ef1b5fd2ee1a98950db5e4f2e8d87d1e
diff --git a/java/robolectric.go b/java/robolectric.go
index 18386c9..cb22fa0 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -116,7 +116,7 @@
if v := String(r.robolectricProperties.Robolectric_prebuilt_version); v != "" {
ctx.AddVariationDependencies(nil, libTag, fmt.Sprintf(robolectricPrebuiltLibPattern, v))
- } else if !proptools.Bool(r.robolectricProperties.Strict_mode) {
+ } else if !proptools.BoolDefault(r.robolectricProperties.Strict_mode, true) {
if proptools.Bool(r.robolectricProperties.Upstream) {
ctx.AddVariationDependencies(nil, libTag, robolectricCurrentLib+"_upstream")
} else {
@@ -124,8 +124,11 @@
}
}
- if proptools.Bool(r.robolectricProperties.Strict_mode) {
+ if proptools.BoolDefault(r.robolectricProperties.Strict_mode, true) {
ctx.AddVariationDependencies(nil, roboRuntimeOnlyTag, robolectricCurrentLib+"_upstream")
+ } else {
+ // opting out from strict mode, robolectric_non_strict_mode_permission lib should be added
+ ctx.AddVariationDependencies(nil, libTag, "robolectric_non_strict_mode_permission")
}
ctx.AddVariationDependencies(nil, libTag, robolectricDefaultLibs...)