diff options
author | Brett Chabot <brettchabot@google.com> | 2023-10-13 09:38:22 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-10-13 09:39:04 -0700 |
commit | ef2b80df361f45db6356ee19ad4c22d239351dd7 (patch) | |
tree | 6c913077f0397f7edc39c6b5d23f906a67fd29a3 /resources | |
parent | 638ce69a2245340217099b5e2dbfdbacaa6afa4b (diff) | |
download | robolectric-ef2b80df361f45db6356ee19ad4c22d239351dd7.tar.gz |
Default to binary resources mode.
Currently Robolectric will select binary resources mode if and only if there
is a binary resources file present. Legacy resources mode is not supported on
Android SDKs greater than P. Thus if a test setup doesn't have a binary
resources file, and is executed on a SDK > P, Robolectric will skip executing
the test.
This commit changes Robolectric behavior so that:
- binary resources mode is preferred by default.
- Support no resources in binary resources mode by defaulting manifest values,
similar to the legacy resource logic.
- Fail a test if legacy resource mode is selected when running on SDKs > P.
A future change, at a TBD date, will remove legacy resources mode support entirely.
Fixes #7249
PiperOrigin-RevId: 573243275
Diffstat (limited to 'resources')
-rw-r--r-- | resources/src/main/java/org/robolectric/manifest/AndroidManifest.java | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/resources/src/main/java/org/robolectric/manifest/AndroidManifest.java b/resources/src/main/java/org/robolectric/manifest/AndroidManifest.java index 073b0fe17..4dd4be2df 100644 --- a/resources/src/main/java/org/robolectric/manifest/AndroidManifest.java +++ b/resources/src/main/java/org/robolectric/manifest/AndroidManifest.java @@ -68,8 +68,6 @@ public class AndroidManifest implements UsesSdk { private final Map<String, String> applicationAttributes = new HashMap<>(); private MetaData applicationMetaData; - private Boolean supportsBinaryResourcesMode; - /** * Creates a Robolectric configuration using specified locations. * @@ -854,9 +852,6 @@ public class AndroidManifest implements UsesSdk { /** @deprecated Do not use. */ @Deprecated synchronized public boolean supportsBinaryResourcesMode() { - if (supportsBinaryResourcesMode == null) { - supportsBinaryResourcesMode = apkFile != null && Files.exists(apkFile); - } - return supportsBinaryResourcesMode; + return true; } } |