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

[Hermes] Android integration #410

Merged
merged 122 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
93f3f15
externalize @player-ui/player from native bundles
sugarmanz May 22, 2024
79ef3e4
hermes building for mac (`bazel run //jvm/hermes/src/main/jni:hermes_…
sugarmanz Jun 4, 2024
d4d6c0a
reorg hermes build and add sanity test
sugarmanz Jun 5, 2024
fd8c9d2
wip on runtime holder
sugarmanz Jun 7, 2024
df4ce9f
simple test for executor
sugarmanz Jun 10, 2024
0c8b18e
wip: using fbjni + nativeloader to load libs, need to get hybrid clas…
sugarmanz Jun 21, 2024
8d0ef0c
initial working slim jni hermesruntime impl
sugarmanz Jun 21, 2024
05ff72f
working test
sugarmanz Jun 21, 2024
6c52da3
initial jjsivalue wrapper
sugarmanz Jun 22, 2024
6b40f5b
step towards explicit jsi jni wrappers since jsi value encapsulates p…
sugarmanz Jun 22, 2024
faacc96
fuller jsi value w/ jsi runtime hybrid class
sugarmanz Jun 23, 2024
3bf94f7
initial jsi object wrapper with getProperty
sugarmanz Jun 23, 2024
18d0752
jsi object apis
sugarmanz Jun 23, 2024
b91f14a
initial jsi array impl
sugarmanz Jun 23, 2024
8b714ba
initial function wrapper
sugarmanz Jun 23, 2024
6fdd9f1
jsi symbol wrapper
sugarmanz Jun 23, 2024
071c943
consolidate jsi runtime wrapper implementation
sugarmanz Jun 24, 2024
c1148f9
more value initializers and passing test through strict equals
sugarmanz Jun 24, 2024
0469f44
initial jsi runtime tests
sugarmanz Jun 24, 2024
d580ce0
fbjni patch
sugarmanz Jun 24, 2024
de47cdc
host function support :phew:
sugarmanz Jun 25, 2024
5c13252
JJSIRuntimeWrapper cleanup
sugarmanz Jun 25, 2024
6c46714
more tests
sugarmanz Jun 25, 2024
6534859
wip: hermes node
sugarmanz Jun 25, 2024
58cca1c
compiling runtime impl
sugarmanz Jun 25, 2024
eafbfa7
add hermes runtime service loader and disable dangling ptr assert for…
sugarmanz Jun 26, 2024
8522335
wip serialization, working primitive decoders, failing function decoders
sugarmanz Jun 27, 2024
05ff3fb
add config flag for building hermes debug or not
sugarmanz Jun 27, 2024
9470473
encoding tests pass
sugarmanz Jun 27, 2024
6c966c6
clone jsi ptr references when converting to values, fix hermes node e…
sugarmanz Jun 28, 2024
280da27
various fixes and test additions for jsi decoding layer
sugarmanz Jun 28, 2024
9e48890
attach thisVal when creating invokable from a JS function
sugarmanz Jun 28, 2024
b90b260
temporary setImmediate solution
sugarmanz Jun 28, 2024
acfdfeb
enable context receivers
sugarmanz Jun 29, 2024
aa115ab
jsi runtime thread context receivers to force runtime access on a ded…
sugarmanz Jun 30, 2024
a62bb4b
disable context receiver for native functions :( maybe just wrap it u…
sugarmanz Jun 30, 2024
4d7d167
automatically decode numbers as ints for player runtime compat -- 132…
sugarmanz Jun 30, 2024
4a1ac67
setup for hermes x-compile
sugarmanz Jul 2, 2024
66f1353
working host jvm tests with x-compile starter
sugarmanz Jul 2, 2024
ba0915e
react native scoping for rn specific artifacts
sugarmanz Jul 2, 2024
4d7baff
attempt at build rn jsi
sugarmanz Jul 2, 2024
b0aa65d
setup for compiling hermes_jni for android
sugarmanz Jul 2, 2024
edc631c
android player & demo setup for consuming hermes
sugarmanz Jul 2, 2024
8e2a1dd
update prebuilt hermes/jsi to rn 0.74.1
sugarmanz Jul 2, 2024
78248d8
remove j2v8 from android demo altogether (still some comments)
sugarmanz Jul 2, 2024
07f35b1
clean up android build
sugarmanz Jul 3, 2024
06828e0
some more cleanup
sugarmanz Jul 3, 2024
8400548
building manual aar to publish, works in demo app, doesn't for host, …
sugarmanz Jul 3, 2024
dc54a69
initial packaging for hermes-android
sugarmanz Jul 4, 2024
6a3cba8
cleanup
sugarmanz Jul 4, 2024
ec7e14c
fix hermes-android publish
sugarmanz Jul 4, 2024
151cfd5
attempt to define rules to manually compile android libs
sugarmanz Jul 4, 2024
a457bba
more cleanup
sugarmanz Jul 4, 2024
d013b31
fix publishing issue for binaries
sugarmanz Jul 5, 2024
7feec54
demo app running after rebase
sugarmanz Jul 6, 2024
167afa0
use jni headers from host platform for @fbjni//:host
sugarmanz Jul 7, 2024
3de2414
some minor fbjni cleanup
sugarmanz Jul 7, 2024
2def3cf
revisit host build and dynamically include jni headers based on confi…
sugarmanz Jul 7, 2024
1ed1bc8
configure resource loader through testutils base class
sugarmanz Jul 7, 2024
d75de1d
guard jsi microtask for host build
sugarmanz Jul 7, 2024
be7c8fd
convert numbers to int if they can be without losing info
sugarmanz Jul 7, 2024
28a06da
start of release strategy
sugarmanz Jul 7, 2024
e10f14a
remove automatic set timeout/immediate on hermes runtime (use plugin …
sugarmanz Jul 7, 2024
5bfa3aa
initial source map support, pull fbjni from aar for android, better s…
sugarmanz Jul 7, 2024
a6befe4
move set timeout init to hermes runtime again, disable release until …
sugarmanz Jul 7, 2024
3642b46
fix hermes factory (load jni first), propagate cancellation exception…
sugarmanz Jul 7, 2024
095bb2f
cleanup cmake and cmake dependent copts
sugarmanz Jul 7, 2024
dcb609f
cleanup pt 2
sugarmanz Jul 7, 2024
2ce8889
fix platform configs for third party builds
sugarmanz Jul 8, 2024
e57488f
groundwork for release mechanism
sugarmanz Jul 8, 2024
edebbfa
v8 executeRaw implementation
sugarmanz Jul 8, 2024
271d015
trackRef release strategy to guard against dangling runtime pointer v…
sugarmanz Jul 8, 2024
0ae5119
some minor tweaks to fix racy exceptions
sugarmanz Jul 8, 2024
4140ddc
fix small issue with JHermesRuntime::release that would blow up the d…
sugarmanz Jul 9, 2024
73b5f92
pin fbjni to 0.6.0 to help fix some core tests
sugarmanz Jul 9, 2024
e779860
partial cherry pick to get new ndk on ci
sugarmanz Jul 9, 2024
cadf1d3
fix ndk image reference
sugarmanz Jul 9, 2024
f20931e
handle decode function todo
sugarmanz Jul 9, 2024
17acf81
hold globals to absolutely ensure we release everything before releas…
sugarmanz Jul 9, 2024
5584fdd
undo ndk image reference and disable third party test
sugarmanz Jul 9, 2024
3a0b21f
choose the right file extension for shared objs
sugarmanz Jul 9, 2024
bd0f50e
fix selects for string vals
sugarmanz Jul 10, 2024
bc1fb11
Revert "externalize @player-ui/player from native bundles"
sugarmanz Jul 10, 2024
9005344
statically define outs for copy_shared_lib
sugarmanz Jul 10, 2024
19f6635
grep only libname and hope for the best
sugarmanz Jul 10, 2024
8e06211
opt into experimental player apis and suppress unused parameter warni…
sugarmanz Jul 10, 2024
ae8d211
apply cxx 17 config through bazelrc
sugarmanz Jul 10, 2024
efe31be
fix demo deps
sugarmanz Jul 10, 2024
755d5d8
reorg hermes-host dep to avoid building for release
sugarmanz Jul 10, 2024
377f777
fix a bunch of tests
sugarmanz Jul 10, 2024
c10ea6b
hermes build is crapping out due to resource constraints (?)
sugarmanz Jul 10, 2024
a622bee
remove todo
sugarmanz Jul 10, 2024
eb216b0
guess we can't do 2xlarge :(
sugarmanz Jul 10, 2024
20cec9b
don't care about ios (failing due to resource constraints) right now
sugarmanz Jul 10, 2024
3ce86c4
revert set timeout plugin strategy for hermes runtime, and give optio…
sugarmanz Jul 10, 2024
6cc8a96
revamped jmh perf
sugarmanz Jul 11, 2024
012829a
build hermes first to avoid running out resources
sugarmanz Jul 26, 2024
ad0d871
build hermes first to avoid running out resources
sugarmanz Jul 26, 2024
a99d3b6
build hermes for testing first to avoid running out resources
sugarmanz Jul 30, 2024
fcf55d8
collapse rc flags
sugarmanz Jul 30, 2024
127c033
use jdk 17
sugarmanz Jul 30, 2024
ffa205e
uncollapse bazelrcs for remote builds
sugarmanz Jul 30, 2024
b71bfff
fix issue with handling undefined values in hermes node
sugarmanz Jul 30, 2024
80160ca
fix setImmediate polyfill (don't delegate to setTimeout)
sugarmanz Jul 30, 2024
9e53539
lint hermes kt
sugarmanz Jul 30, 2024
09ebaa5
4 dex shards cause why not
sugarmanz Jul 30, 2024
a384f04
redo delegation to setTimeout for setImmediate and fix core tests
sugarmanz Aug 1, 2024
f1b32d1
fix hermes test
sugarmanz Aug 1, 2024
bba9dd0
add build config for using hermes with android player
sugarmanz Aug 1, 2024
0d6900f
consolidate config settings for j2v8 & hermes
sugarmanz Aug 1, 2024
fe04079
lint
sugarmanz Aug 1, 2024
8c1e834
lots of cleanup
sugarmanz Aug 1, 2024
c2bd6c2
properly support runtime thread context receiver at jni layer
sugarmanz Aug 1, 2024
e917a36
lint
sugarmanz Aug 1, 2024
ad6d7ca
re-add stetho dep to demo app
sugarmanz Aug 1, 2024
d2c3484
pt. 2
sugarmanz Aug 1, 2024
513b5e5
re-add j2v8-debugger dep to demo app for compilation reasons
sugarmanz Aug 1, 2024
612b3d0
add docs for js runtimes
sugarmanz Aug 2, 2024
e92e509
consolidate build_type defines with //player/android:runtime
sugarmanz Aug 2, 2024
9f4f1e8
fix j2v8 poms using manually specified aar dep
sugarmanz Aug 2, 2024
becf214
update circle config to specify build type through //android/player:r…
sugarmanz Aug 2, 2024
a728ef6
Merge branch 'main' into hermes/android
brocollie08 Aug 2, 2024
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
23 changes: 11 additions & 12 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ coverage --combined_report=lcov

# TODO: Custom compiler version breaks embedded jdeps generator plugin - enable when removing custom kotlinc
build --@rules_kotlin//kotlin/settings:jvm_emit_jdeps=False
build --cxxopt=-std=c++17

# Android databinding flags
# TODO: Verify the follow doesn't break host compil
build --android_crosstool_top=@androidndk//:toolchain
build --experimental_android_databinding_v2
build --android_databinding_use_v3_4_args
build --android_databinding_use_androidx
build --experimental_google_legacy_api
query --experimental_google_legacy_api
sync --experimental_google_legacy_api
common --android_crosstool_top=@androidndk//:toolchain
common --experimental_android_databinding_v2
common --android_databinding_use_v3_4_args
common --android_databinding_use_androidx
common --experimental_google_legacy_api

# Android demo app flags
build --noincremental_dexing --fat_apk_cpu=armeabi-v7a,arm64-v8a,x86,x86_64
Expand Down Expand Up @@ -46,16 +44,17 @@ coverage --remote_download_toplevel
coverage --remote_timeout=3600
coverage --build_metadata=REPO_URL=https://github.com/player-ui/player.git

build:ci --build_metadata=ROLE=CI --workspace_status_command=./scripts/workspace-status.sh
common:ci --build_metadata=ROLE=CI --workspace_status_command=./scripts/workspace-status.sh

# Circle xlarge has 8 CPU cores/16GB mem
build:ci --local_cpu_resources=8
build:ci --local_ram_resources=15000
build:ci --config="release"
common:ci --local_cpu_resources=8
common:ci --local_ram_resources=15000
common:ci --config="release"
# Circle macos.m1.large.gen1 8 cores 12gb ram
common:ci-mac --config=ci --local_cpu_resources=8 --local_ram_resources=11000

build:release --stamp --workspace_status_command=./scripts/workspace-status.sh
build:release --//:cmake_build_type=MinSizeRel

# Cache action outputs on disk so they persist across output_base and bazel shutdown (eg. changing branches)
# build --disk_cache=~/.cache/bazel-disk-cache
Expand Down
10 changes: 6 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ orbs:
executors:
base:
docker:
- image: docker.io/playerui/bazel-docker
- image: docker.io/playerui/bazel-docker:11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we merge the docker changes in before merging this so we're not targeting a specific image?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can! I was avoiding merging that PR until the release was done to make sure it wouldn't accidentally break CI (does make a strong case for tagging our images per release and always targeting a tag).

working_directory: ~/player
resource_class: xlarge
environment:
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
steps:
- attach_workspace:
at: ~/player
# need to filter because //android/demo rules dont resolve

- run: bazel build --config=ci -- $(bazel query 'filter("native_bundle$", //...)')

- save_cache:
Expand Down Expand Up @@ -237,6 +237,7 @@ jobs:

- run: |
bazel test --config=ci -- $(bazel query 'kind(".*_test", //...) except filter("ios|swiftui", //...)') -//android/demo:android_instrumentation_test
bazel test --config=ci --//android/player:runtime=hermes -- $(bazel query 'kind(".*_test", //...) except filter("ios|swiftui", //...)') -//android/demo:android_instrumentation_test
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, plus the one below ensure we re-run all relevant tests (that depend on //android/player:runtime) against the Hermes runtime. It'll return the cached result for all tests that don't use that config flag, directly or transitively.


- run:
when: always
Expand Down Expand Up @@ -292,7 +293,9 @@ jobs:
command: |
circle-android wait-for-boot

- run: bazel test --config=ci -- //android/demo:android_instrumentation_test
- run: |
bazel test --config=ci -- //android/demo:android_instrumentation_test
bazel test --config=ci --//android/player:runtime=hermes -- //android/demo:android_instrumentation_test

- run:
when: always
Expand Down Expand Up @@ -427,7 +430,6 @@ workflows:
- Publish
requires:
- build-trunk
- build-ios-trunk

- test:
name: test-trunk
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ typedoc
/.idea/
/.ijwb/
/.aswb/
/.clwb/
/.project
/.settings
/.vscode/
Expand Down
75 changes: 69 additions & 6 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("@rules_player//ios:defs.bzl", "assemble_pod", "ios_publish")
load("@rules_player//internal:defs.bzl", "stamp")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@bazel_gazelle//:def.bzl", "gazelle_binary", "gazelle")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@rules_player//internal:defs.bzl", "stamp")
load("@rules_player//ios:defs.bzl", "assemble_pod", "ios_publish")
load("@rules_swift_package_manager//swiftpkg:defs.bzl", "swift_update_packages")
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -90,14 +90,14 @@ stamp(
name = "PlayerUI_Podspec",
files = ["//:PlayerUI.podspec"],
stable = True,
stamp = -1,
substitutions = {
"0.0.1-placeholder": "{STABLE_VERSION}",
},
stamp = -1,
)

exports_files([
"PlayerUI.podspec"
"PlayerUI.podspec",
])

assemble_pod(
Expand Down Expand Up @@ -286,3 +286,66 @@ java_plugin(
)
#SwiftLint
exports_files([".swiftlint.yml"])

# Native platform settings

string_flag(
name = "cmake_build_type",
build_setting_default = "Debug",
make_variable = "CMAKE_BUILD_TYPE",
values = [
"Debug",
"Release",
"MinSizeRel",
"RelWithDebInfo",
],
)

config_setting(
name = "cmake_build_type_debug",
flag_values = {
":cmake_build_type": "Debug",
},
)

config_setting(
name = "cmake_build_type_release",
flag_values = {
":cmake_build_type": "Release",
},
)

config_setting(
name = "cmake_build_type_minsizerel",
flag_values = {
":cmake_build_type": "MinSizeRel",
},
)

config_setting(
name = "cmake_build_type_relwithdebinfo",
flag_values = {
":cmake_build_type": "RelWithDebInfo",
},
)

# TODO: Enable platform support for detecting Android OS as well as cpu
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be something we'll have better support for w/ Bazel 7

config_setting(
name = "arm64-v8a",
values = {"cpu": "arm64-v8a"},
)

config_setting(
name = "armeabi-v7a",
values = {"cpu": "armeabi-v7a"},
)

config_setting(
name = "x86",
values = {"cpu": "x86"},
)

config_setting(
name = "x86_64",
values = {"cpu": "x86_64"},
)
19 changes: 14 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "aspect_rules_ts", version = "2.4.2")

# C++
bazel_dep(name = "rules_foreign_cc", version = "0.10.1")
bazel_dep(name = "googletest", version = "1.14.0")

####### Node.js version #########
bazel_dep(name = "rules_nodejs", version = "6.2.0")

Expand Down Expand Up @@ -78,9 +82,10 @@ rules_ts_ext.deps()
use_repo(rules_ts_ext, "npm_typescript")

# Kotlin
bazel_dep(
name = "rules_kotlin",
version = "1.9.1",
bazel_dep(name = "rules_kotlin", version = "1.9.1")
single_version_override(
module_name = "rules_kotlin",
patches = ["//patches:rules_kotlin.context_receivers.patch"],
)

# TODO: Custom compiler version breaks embedded jdeps generator plugin - enable when removing custom kotlinc (see .bazelrc jvm_emit_jdeps)
Expand Down Expand Up @@ -120,8 +125,7 @@ use_repo(remote_android_extensions, "android_gmaven_r8")
bazel_dep(name = "rules_jvm_external")
git_override(
module_name = "rules_jvm_external",
# bazel-6 branch
commit = "44f4355b2dbe0d6fd73d690ad66bf5744d482a29",
commit = "73b63ba801f14d1bde7807994cc8c15db226ceec",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue encountered when packaging large binaries:
sugarmanz/rules_jvm_external@73b63ba

remote = "https://github.com/sugarmanz/rules_jvm_external.git",
)

Expand Down Expand Up @@ -179,6 +183,11 @@ maven.install(
"com.github.AlexTrotsenko:j2v8-debugger:0.2.3",
"com.facebook.stetho:stetho:1.5.1",

# Hermes
"com.facebook.fbjni:fbjni-java-only:0.6.0",
"com.facebook.fbjni:fbjni:0.6.0",
"com.facebook.soloader:soloader:0.11.0",

# Test utils
"org.junit.jupiter:junit-jupiter-api:5.6.0",

Expand Down
53 changes: 47 additions & 6 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
load("//:build_constants.bzl", "build_constants")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_aar")
load("//:build_constants.bzl", "build_constants")

build_constants()

android_sdk_repository(
name = "androidsdk",
api_level = 33
api_level = 33,
)

maven_aar(
Expand All @@ -23,11 +23,52 @@ bind(
http_file(
name = "android_test_orchestrator_apk",
sha256 = "b7a2e7d0184b03e12c7357f3914d539da40b52a11e90815edff1022c655f459b",
url = "https://dl.google.com/android/maven2/androidx/test/orchestrator/1.4.2/orchestrator-1.4.2.apk"
url = "https://dl.google.com/android/maven2/androidx/test/orchestrator/1.4.2/orchestrator-1.4.2.apk",
)

http_file(
name = "android_test_services_apk",
sha256 = "c6bc74268b29bdabad8da962e00e2f6fd613c24b42c69e81b258397b4819f156",
url = "https://dl.google.com/android/maven2/androidx/test/services/test-services/1.4.2/test-services-1.4.2.apk"
)
url = "https://dl.google.com/android/maven2/androidx/test/services/test-services/1.4.2/test-services-1.4.2.apk",
)

# Hermes
git_repository(
name = "hermes",
build_file = "//third_party/hermes:BUILD",
commit = "c16bd411cdb20d424f843ea8623c00fa3d493a6c",
patches = ["//patches:hermes.loosen_host_function_params.patch"],
remote = "https://github.com/facebook/hermes",
)

git_repository(
name = "fbjni",
build_file = "//third_party/fbjni:BUILD",
commit = "1cf763714e99d45c23dfb316d702ebfa8290af64",
patches = ["//patches:fbjni.install_headers.patch"],
remote = "https://github.com/facebookincubator/fbjni",
)

RN_VERSION = "0.74.1"

# Pull prefab Android Hermes built against React Native JSI
http_archive(
name = "rn_hermes_android",
build_file = "//third_party/rn:hermes_android.BUILD",
url = "https://repo1.maven.org/maven2/com/facebook/react/hermes-android/{}/hermes-android-{}-release.aar".format(RN_VERSION, RN_VERSION),
)

# Access to React Native JSI override
git_repository(
name = "react_native",
build_file = "//third_party/rn:react_native.BUILD",
patches = ["//patches:react_native.loosen_host_function_params.patch"],
remote = "https://github.com/facebook/react-native",
tag = "v{}".format(RN_VERSION),
)

http_archive(
name = "fbjni_artifact",
build_file = "//third_party/fbjni:artifact.BUILD",
url = "https://repo1.maven.org/maven2/com/facebook/fbjni/fbjni/0.6.0/fbjni-0.6.0.aar",
)
9 changes: 4 additions & 5 deletions android/demo/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@rules_android//android:rules.bzl", "android_binary", "android_library")
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_import")
load("@rules_kotlin//kotlin:android.bzl", "kt_android_library")
load(":deps.bzl", "main_deps", "test_deps")
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_import")
load("@rules_player//kotlin:defs.bzl", "lint")
load(":deps.bzl", "main_deps", "test_deps")

kt_android_library(
name = "demo_lib",
Expand All @@ -15,15 +15,14 @@ kt_android_library(

android_binary(
name = "demo",
custom_package = "com.intuit.playerui.android.reference.demo",
assets = glob(["src/main/assets/mocks/**"]),
assets_dir = "src/main/assets",
dex_shards = 3,
custom_package = "com.intuit.playerui.android.reference.demo",
dex_shards = 4,
manifest = ":src/main/AndroidManifest.xml",
multidex = "native",
deps = [
":demo_lib",
"@maven//:org_jetbrains_kotlin_kotlin_reflect",
],
)

Expand Down
11 changes: 6 additions & 5 deletions android/demo/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ maven_main = [
"@maven//:androidx_navigation_navigation_runtime",
"@maven//:androidx_navigation_navigation_ui_ktx",
"@maven//:androidx_navigation_navigation_fragment_ktx",

"@maven//:com_afollestad_material_dialogs_core",
"@maven//:com_google_android_material_material",
#"@maven//:com_squareup_leakcanary_leakcanary_android",
"@android_j2v8//aar",
"@maven//:com_facebook_stetho_stetho"
# For when hermes-android _isn't_ included
"@maven//:com_facebook_soloader_soloader",
# For when j2v8-android _is_ included (not sure why transitive dep isn't included)
"@maven//:com_github_AlexTrotsenko_j2v8_debugger",
]

maven_test = [
"@maven//:androidx_test_espresso_espresso_intents",
"@maven//:androidx_test_ext_junit_ktx"
"@maven//:androidx_test_ext_junit_ktx",
]

main_deps = maven_main + [
Expand All @@ -24,5 +25,5 @@ main_deps = maven_main + [
]

test_deps = maven_test + [
"//jvm/utils"
"//jvm/utils",
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.rules.activityScenarioRule
import com.facebook.soloader.SoLoader
import com.intuit.playerui.android.reference.demo.test.base.waitForViewInRoot
import com.intuit.playerui.android.reference.demo.ui.splash.SplashActivity
import com.intuit.playerui.utils.makeFlow
Expand All @@ -33,6 +34,7 @@ class SplashActivityTest {
}

private val intent by lazy {
SoLoader.init(ApplicationProvider.getApplicationContext(), false)
Intent(ApplicationProvider.getApplicationContext(), SplashActivity::class.java).apply {
action = "ACTION_VIEW"
data = Uri.parse("player://domain.com/demo?json=$json")
Expand Down
Loading