Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Robolectric to 3.6.1 #20621

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ aliases:

- &restore-cache-downloads-gradle
keys:
- v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}-{{ checksum "ReactAndroid/gradle.properties" }}
- v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
- v1-gradle-
- &save-cache-downloads-gradle
paths:
- ~/.gradle
- ReactAndroid/build/downloads
- ReactAndroid/build/third-party-ndk
key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}-{{ checksum "ReactAndroid/gradle.properties" }}

# Branch Filtering
- &filter-only-master-stable
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ POM_PACKAGING=aar

MOCKITO_CORE_VERSION=2.19.1
POWERMOCK_VERSION=1.6.2
ROBOLECTRIC_VERSION=3.0
ROBOLECTRIC_VERSION=3.6.1
JUNIT_VERSION=4.12
FEST_ASSERT_CORE_VERSION=2.0M10

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//ReactNative:DEFS.bzl", "rn_android_library", "rn_prebuilt_jar")
load("//ReactNative:DEFS.bzl", "react_native_dep", "rn_android_library", "rn_prebuilt_jar")

rn_android_library(
name = "powermock",
Expand All @@ -15,7 +15,7 @@ rn_android_library(
":powermock-reflect",
":xmlpull",
":xpp3",
":xstream",
react_native_dep("third-party/java/xstream:xstream"),
],
)

Expand Down Expand Up @@ -91,18 +91,6 @@ remote_file(
url = "mvn:org.powermock:powermock-classloading-base:jar:1.6.2",
)

rn_prebuilt_jar(
name = "xstream",
binary_jar = ":download-xstream.jar",
visibility = ["//ReactAndroid/..."],
)

remote_file(
name = "download-xstream.jar",
sha1 = "97e5013f391487cce4de6b0eebcde21549e91872",
url = "mvn:com.thoughtworks.xstream:xstream:jar:1.4.2",
)

rn_prebuilt_jar(
name = "powermock-reflect",
binary_jar = ":download-powermock-reflect.jar",
Expand Down
133 changes: 58 additions & 75 deletions ReactAndroid/src/main/third-party/java/robolectric3/robolectric/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ rn_android_library(
name = "robolectric",
visibility = ["//ReactAndroid/..."],
exported_deps = [
":android-all-4.1.2_r1-robolectric-0",
":android-all-4.1.2_r1-robolectric-r1",
":bouncycastle",
":icu",
":json-20080701",
":robolectric-annotations",
":robolectric-core",
":robolectric-junit",
":robolectric-resources",
":robolectric-sandbox",
":robolectric-shadowapi",
":robolectric-shadows-framework",
":robolectric-utils",
":shadows-core-3.0-16",
":tagsoup-1.2",
":vtd-xml",
":guava",
react_native_dep("third-party/java/asm:asm"),
react_native_dep("third-party/java/sqlite:sqlite"),
react_native_dep("third-party/java/xstream:xstream"),
],
)

Expand All @@ -28,8 +29,8 @@ rn_prebuilt_jar(

remote_file(
name = "robolectric-binary.jar",
sha1 = "f888cea3bc1a24110e315eb9827ab593610ea62f",
url = "mvn:org.robolectric:robolectric:jar:3.0",
sha1 = "26cfb22e682110716ccd516da2f2851016b3efae",
url = "mvn:org.robolectric:robolectric:jar:3.6.1",
)

rn_prebuilt_jar(
Expand All @@ -40,8 +41,8 @@ rn_prebuilt_jar(

remote_file(
name = "robolectric-resources-binary.jar",
sha1 = "1ab609054aab67cd13a434567467f4b4774f2465",
url = "mvn:org.robolectric:robolectric-resources:jar:3.0",
sha1 = "f8b6cf44b7729839ce3e1778424d97d47b55d305",
url = "mvn:org.robolectric:resources:jar:3.6.1",
)

rn_prebuilt_jar(
Expand All @@ -52,128 +53,110 @@ rn_prebuilt_jar(

remote_file(
name = "robolectric-annotations-binary.jar",
sha1 = "2a6cfc072d7680694c1ff893c5dc8fec33163110",
url = "mvn:org.robolectric:robolectric-annotations:jar:3.0",
sha1 = "bc643af7206d2de1ab8902c80baf620ffd5ad302",
url = "mvn:org.robolectric:annotations:jar:3.6.1",
)

rn_prebuilt_jar(
name = "robolectric-utils",
binary_jar = ":robolectric-utils-binary.jar",
name = "robolectric-junit",
binary_jar = ":robolectric-junit-binary.jar",
visibility = ["//ReactAndroid/..."],
)

remote_file(
name = "robolectric-utils-binary.jar",
sha1 = "4bcecd8115fe7296088bb1636e6cbd7ae8927392",
url = "mvn:org.robolectric:robolectric-utils:jar:3.0",
name = "robolectric-junit-binary.jar",
sha1 = "a2e92127ed9596fb9406d1b49dc9daf091d5fa43",
url = "mvn:org.robolectric:junit:jar:3.6.1",
)

rn_prebuilt_jar(
name = "bouncycastle",
binary_jar = ":bouncycastle-binary.jar",
name = "robolectric-sandbox",
binary_jar = ":robolectric-sandbox-binary.jar",
visibility = ["//ReactAndroid/..."],
)

remote_file(
name = "bouncycastle-binary.jar",
sha1 = "ce091790943599535cbb4de8ede84535b0c1260c",
url = "mvn:org.bouncycastle:bcprov-jdk16:jar:1.46",
name = "robolectric-sandbox-binary.jar",
sha1 = "7b700eb7938ac3857c70013403e478b44e1d27c3",
url = "mvn:org.robolectric:sandbox:jar:3.6.1",
)

rn_prebuilt_jar(
name = "vtd-xml",
binary_jar = ":vtd-xml-binary.jar",
name = "robolectric-shadows-framework",
binary_jar = ":robolectric-shadows-framework-binary.jar",
visibility = ["//ReactAndroid/..."],
)

remote_file(
name = "vtd-xml-binary.jar",
sha1 = "ee5bcf62c1acf76434ee9f1c67a840bafef72a6d",
url = "mvn:com.ximpleware:vtd-xml:jar:2.11",
name = "robolectric-shadows-framework-binary.jar",
sha1 = "157acb72761a31a8eaa2e41d9d9b57d81a232c8b",
url = "mvn:org.robolectric:shadows-framework:jar:3.6.1",
)

rn_prebuilt_jar(
name = "icu",
binary_jar = ":icu-binary.jar",
name = "robolectric-utils",
binary_jar = ":robolectric-utils-binary.jar",
visibility = ["//ReactAndroid/..."],
)

remote_file(
name = "icu-binary.jar",
sha1 = "786d9055d4ca8c1aab4a7d4ac8283f973fd7e41f",
url = "mvn:com.ibm.icu:icu4j:jar:53.1",
name = "robolectric-utils-binary.jar",
sha1 = "a561992a644530a5a39eda744288bdb05c796141",
url = "mvn:org.robolectric:utils:jar:3.6.1",
)

rn_prebuilt_jar(
name = "android-all-4.1.2_r1-robolectric-0", # name defines filename used by robolectric in runtime
binary_jar = ":robolectric-android-all-binary.jar",
name = "bouncycastle",
binary_jar = ":bouncycastle-binary.jar",
visibility = ["//ReactAndroid/..."],
)

# This new rule will make the .jar file appear in the "right" location,
# though that may change in the future
export_file(
name = "robolectric-android-all-binary.jar",
src = ":robolectric-android-all-binary-remote.jar",
out = "../android-all-4.1.2_r1-robolectric-0.jar", # name defines filename used by robolectric in runtime
)

remote_file(
name = "robolectric-android-all-binary-remote.jar",
sha1 = "aecc8ce5119a25fcea1cdf8285469c9d1261a352",
url = "mvn:org.robolectric:android-all:jar:4.1.2_r1-robolectric-0",
name = "bouncycastle-binary.jar",
sha1 = "88a941faf9819d371e3174b5ed56a3f3f7d73269",
url = "mvn:org.bouncycastle:bcprov-jdk15on:jar:1.52",
)

rn_prebuilt_jar(
name = "json-20080701", # name defines filename used by robolectric in runtime
binary_jar = ":json.jar",
name = "guava",
binary_jar = ":guava-binary.jar",
visibility = ["//ReactAndroid/..."],
)

export_file(
name = "json.jar",
src = ":json-remote.jar",
out = "../json-20080701.jar", # name defines filename used by robolectric in runtime
)

remote_file(
name = "json-remote.jar",
sha1 = "d652f102185530c93b66158b1859f35d45687258",
url = "mvn:org.json:json:jar:20080701",
name = "guava-binary.jar",
sha1 = "89507701249388e1ed5ddcf8c41f4ce1be7831ef",
url = "mvn:com.google.guava:guava:jar:20.0",
)

rn_prebuilt_jar(
name = "tagsoup-1.2", # name defines filename used by robolectric in runtime
binary_jar = ":tagsoup.jar",
name = "android-all-4.1.2_r1-robolectric-r1", # name defines filename used by robolectric in runtime
binary_jar = ":robolectric-android-all-binary.jar",
visibility = ["//ReactAndroid/..."],
)

# This new rule will make the .jar file appear in the "right" location,
# though that may change in the future
export_file(
name = "tagsoup.jar",
src = ":tagsoup-remote.jar",
out = "../tagsoup-1.2.jar", # name defines filename used by robolectric in runtime
name = "robolectric-android-all-binary.jar",
src = ":robolectric-android-all-binary-remote.jar",
out = "../android-all-4.1.2_r1-robolectric-r1.jar", # name defines filename used by robolectric in runtime
)

remote_file(
name = "tagsoup-remote.jar",
sha1 = "639fd364750d7363c85797dc944b4a80f78fa684",
url = "mvn:org.ccil.cowan.tagsoup:tagsoup:jar:1.2",
name = "robolectric-android-all-binary-remote.jar",
sha1 = "8355a2da59fe0233ca45070ca32f08da98d0b806",
url = "mvn:org.robolectric:android-all:jar:4.1.2_r1-robolectric-r1",
)

rn_prebuilt_jar(
name = "shadows-core-3.0-16", # name defines filename used by robolectric in runtime
binary_jar = ":robolectric-shadows-binary.jar",
name = "robolectric-shadowapi", # name defines filename used by robolectric in runtime
binary_jar = ":robolectric-shadows.jar",
visibility = ["//ReactAndroid/..."],
)

export_file(
name = "robolectric-shadows-binary.jar",
src = ":robolectric-shadows-binary-remote.jar",
out = "../shadows-core-3.0-16.jar", # name defines filename used by robolectric in runtime
)

remote_file(
name = "robolectric-shadows-binary-remote.jar",
sha1 = "39d7a856bf91640b1a6d044333336a2b3f3c198f",
url = "https://repo1.maven.org/maven2/org/robolectric/shadows-core/3.0/shadows-core-3.0-16.jar",
name = "robolectric-shadows.jar",
sha1 = "a1fcdb89cf593aa01fde2ad35f4f85cc2a9c1e15",
url = "mvn:org.robolectric:shadowapi:jar:3.6.1",
)
13 changes: 13 additions & 0 deletions ReactAndroid/src/main/third-party/java/xstream/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("//ReactNative:DEFS.bzl", "rn_prebuilt_jar")

rn_prebuilt_jar(
name = "xstream",
binary_jar = ":xstream.jar",
visibility = ["//ReactAndroid/..."],
)

remote_file(
name = "xstream.jar",
sha1 = "520d90f30f36a0d6ba2dc929d980831631ad6a92",
url = "mvn:com.thoughtworks.xstream:xstream:jar:1.4.8",
)
1 change: 1 addition & 0 deletions ReactAndroid/src/test/java/com/facebook/react/modules/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rn_robolectric_test(
YOGA_TARGET,
react_native_dep("libraries/fbcore/src/test/java/com/facebook/powermock:powermock"),
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
react_native_dep("third-party/java/fest:fest"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_dep("third-party/java/junit:junit"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@
import android.content.Context;
import android.text.ClipboardManager;

import com.facebook.react.bridge.ReactTestHelper;
import com.facebook.react.modules.clipboard.ClipboardModule;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.util.ActivityController;
import org.robolectric.android.controller.ActivityController;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactTestHelper;
import com.facebook.react.bridge.JavaOnlyMap;

Expand All @@ -30,10 +29,9 @@
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.rule.PowerMockRule;
import org.robolectric.internal.ShadowExtractor;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.shadows.ShadowApplication;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -84,7 +82,7 @@ public void testShareDialog() {
mShareModule.share(content, dialogTitle, promise);

final Intent chooserIntent =
((ShadowApplication)ShadowExtractor.extract(RuntimeEnvironment.application)).getNextStartedActivity();
((ShadowApplication) Shadow.extract(RuntimeEnvironment.application)).getNextStartedActivity();
assertNotNull("Dialog was not displayed", chooserIntent);
assertEquals(Intent.ACTION_CHOOSER, chooserIntent.getAction());
assertEquals(dialogTitle, chooserIntent.getExtras().get(Intent.EXTRA_TITLE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.robolectric.RuntimeEnvironment;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.util.concurrent.RoboExecutorService;
import org.robolectric.android.util.concurrent.RoboExecutorService;

import static org.mockito.Mockito.mock;
import static org.fest.assertions.api.Assertions.assertThat;
Expand Down