Skip to content

Commit

Permalink
Fix React Native Robolectric 4.4 deps (#30073)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #30073

Changelog: [Android][Added] - Test infra: Robolectric 4.3.1 -> 4.4 upgrade

Reviewed By: fkgozali

Differential Revision: D24009953

fbshipit-source-id: 70549187f4af0abd2ea10f6725eecadbaef7281b
  • Loading branch information
Joshua Selbo authored and facebook-github-bot committed Sep 30, 2020
1 parent c92e767 commit d373a8d
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 3 deletions.
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.26.0
POWERMOCK_VERSION=2.0.2
ROBOLECTRIC_VERSION=4.3.1
ROBOLECTRIC_VERSION=4.4
JUNIT_VERSION=4.12
FEST_ASSERT_CORE_VERSION=2.0M10

Expand Down
216 changes: 216 additions & 0 deletions ReactAndroid/src/main/third-party/java/robolectric/4.4/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
load("//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "rn_android_library", "rn_prebuilt_jar")

rn_android_library(
name = "robolectric",
visibility = ["PUBLIC"],
exported_deps = [
":android-all-4.1.2_r1-robolectric-r1",
":bouncycastle",
":guava",
":javax-annotation-api",
":javax-inject",
":robolectric4-annotations-prebuilt",
":robolectric4-junit-prebuilt",
":robolectric4-pluginapi-prebuilt",
":robolectric4-plugins-maven-dependency-resolver-prebuilt",
":robolectric4-prebuilt",
":robolectric4-resources-prebuilt",
":robolectric4-sandbox-prebuilt",
":robolectric4-shadowapi-prebuilt",
":robolectric4-shadows-framework-prebuilt",
":robolectric4-utils-prebuilt",
":robolectric4-utils-reflector-prebuilt",
react_native_dep("third-party/java/asm:asm"),
react_native_dep("third-party/java/sqlite:sqlite"),
react_native_dep("third-party/java/junit:junit"),
react_native_dep("third-party/android/androidx:test-monitor"),
],
)

rn_prebuilt_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
fb_native.export_file(
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
)

fb_native.remote_file(
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 = "bouncycastle",
binary_jar = ":bouncycastle-binary.jar",
visibility = ["//ReactAndroid/..."],
)

fb_native.remote_file(
name = "bouncycastle-binary.jar",
sha1 = "320b989112f00a63a3bcfa5a98f31a4f865a20fa",
url = "mvn:org.bouncycastle:bcprov-jdk15on:jar:1.65",
)

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

fb_native.remote_file(
name = "guava-binary.jar",
sha1 = "ef69663836b339db335fde0df06fb3cd84e3742b",
url = "mvn:com.google.guava:guava:jar:26.0-android",
)

rn_prebuilt_jar(
name = "robolectric4-prebuilt",
binary_jar = ":robolectric4.jar",
)

fb_native.remote_file(
name = "robolectric4.jar",
sha1 = "418c5bfae392fdbf71cd463a42a3e8c3b839a924",
url = "mvn:org.robolectric:robolectric:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-annotations-prebuilt",
binary_jar = ":robolectric4-annotations.jar",
)

fb_native.remote_file(
name = "robolectric4-annotations.jar",
sha1 = "70fc5b1699467dfd7de606fc6c02ff9fc1816d9f",
url = "mvn:org.robolectric:annotations:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-junit-prebuilt",
binary_jar = ":robolectric4-junit.jar",
)

fb_native.remote_file(
name = "robolectric4-junit.jar",
sha1 = "fbcda51d8e6f3a3897ae5cedc7aa481815745290",
url = "mvn:org.robolectric:junit:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-pluginapi-prebuilt",
binary_jar = ":robolectric4-pluginapi.jar",
)

fb_native.remote_file(
name = "robolectric4-pluginapi.jar",
sha1 = "1ee94260f8c51620a35eac33fc1efc01350c751f",
url = "mvn:org.robolectric:pluginapi:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-plugins-maven-dependency-resolver-prebuilt",
binary_jar = ":robolectric4-plugins-maven-dependency-resolver.jar",
)

fb_native.remote_file(
name = "robolectric4-plugins-maven-dependency-resolver.jar",
sha1 = "9241a3c4bd01627447c76d9b67614808c78ffdd9",
url = "mvn:org.robolectric:plugins-maven-dependency-resolver:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-resources-prebuilt",
binary_jar = ":robolectric4-resources.jar",
)

fb_native.remote_file(
name = "robolectric4-resources.jar",
sha1 = "a2ee1324bcb62724e6cbfa655bdb5683948a554c",
url = "mvn:org.robolectric:resources:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-sandbox-prebuilt",
binary_jar = ":robolectric4-sandbox.jar",
)

fb_native.remote_file(
name = "robolectric4-sandbox.jar",
sha1 = "03cedd73c5aedaf79fb9a593552816c9fb3282f2",
url = "mvn:org.robolectric:sandbox:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-shadowapi-prebuilt",
binary_jar = ":robolectric4-shadowapi.jar",
)

fb_native.remote_file(
name = "robolectric4-shadowapi.jar",
sha1 = "529649474b53cf8f6f4a483044ade43aebed8a4c",
url = "mvn:org.robolectric:shadowapi:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-shadows-framework-prebuilt",
binary_jar = ":robolectric4-shadows-framework.jar",
)

fb_native.remote_file(
name = "robolectric4-shadows-framework.jar",
sha1 = "90028766e71353ad6f57d7bcb56ac0d861da18c3",
url = "mvn:org.robolectric:shadows-framework:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-utils-prebuilt",
binary_jar = ":robolectric4-utils.jar",
)

fb_native.remote_file(
name = "robolectric4-utils.jar",
sha1 = "c54b2638d64e7bd4e1e45c4fe8038305402bd711",
url = "mvn:org.robolectric:utils:jar:4.4",
)

rn_prebuilt_jar(
name = "robolectric4-utils-reflector-prebuilt",
binary_jar = ":robolectric4-utils-reflector.jar",
)

fb_native.remote_file(
name = "robolectric4-utils-reflector.jar",
sha1 = "44c40ac0d2ef1e7c8b0f6c4e224ef26d356170f1",
url = "mvn:org.robolectric:utils-reflector:jar:4.4",
)

rn_prebuilt_jar(
name = "javax-annotation-api",
binary_jar = ":javax-annotation-api.jar",
)

fb_native.remote_file(
name = "javax-annotation-api.jar",
sha1 = "934c04d3cfef185a8008e7bf34331b79730a9d43",
url = "mvn:javax.annotation:javax.annotation-api:jar:1.3.2",
)

rn_prebuilt_jar(
name = "javax-inject",
binary_jar = ":javax-inject.jar",
)

fb_native.remote_file(
name = "javax-inject.jar",
sha1 = "6975da39a7040257bd51d21a231b76c915872d38",
url = "mvn:javax.inject:javax.inject:jar:1",
)
5 changes: 3 additions & 2 deletions tools/build_defs/oss/rn_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs):
"-XX:+UseConcMarkSweepGC", # required by -XX:+CMSClassUnloadingEnabled
"-XX:+CMSClassUnloadingEnabled",
"-XX:ReservedCodeCacheSize=150M",
"-Drobolectric.dependency.dir=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.3.1",
"-Dlibraries=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.3.1/*.jar",
"-Drobolectric.dependency.dir=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.4",
"-Dlibraries=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.4/*.jar",
"-Drobolectric.logging.enabled=true",
"-XX:MaxPermSize=620m",
"-Drobolectric.offline=true",
"-Drobolectric.looperMode=LEGACY",
]
if native.read_config("user", "use_dev_shm"):
extra_vm_args.append("-Djava.io.tmpdir=/dev/shm")
Expand Down

0 comments on commit d373a8d

Please sign in to comment.