Skip to content

Commit

Permalink
Hermes support Android 15 (#509)
Browse files Browse the repository at this point in the history
* fbjni + libc++

* hermes + jsi

* hermes_jni

* remove extra opts, only need linkopts

* move libjsi to hermes location
  • Loading branch information
brocollie08 authored Sep 23, 2024
1 parent 12b4867 commit 315fff2
Show file tree
Hide file tree
Showing 34 changed files with 128 additions and 22 deletions.
8 changes: 4 additions & 4 deletions jvm/hermes/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ merge_jni_into_android_library(
name = "hermes-android",
android_library = ":hermes-android-lib",
cc_libs = [
"@fbjni_artifact//:libc++_shared",
"@fbjni_artifact//:libfbjni",
"//jvm/hermes/libs:libjsi",
"//jvm/hermes/libs:libc++_shared",
"//jvm/hermes/libs:libfbjni",
"//third_party/rn:libjsi",
"//jvm/hermes/src/main/jni:hermes_jni_lib",
"@rn_hermes_android//:libhermes",
"//third_party/rn:libhermes",
],
cc_name = "hermes_jni",
tags = ["maven_coordinates=%s:%s:aar:%s" % (DEFAULT_GROUP, "hermes-android", VERSION)],
Expand Down
23 changes: 17 additions & 6 deletions jvm/hermes/libs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@ cc_import(
system_provided = True,
)

# This is the only one we aren't pulling from AARs or building from source (for RN)
alias(
name = "libjsi",
name = "libfbjni",
actual = select({
"//:arm64-v8a": "//jvm/hermes/libs/arm64-v8a:libjsi",
"//:armeabi-v7a": "//jvm/hermes/libs/armeabi-v7a:libjsi",
"//:x86": "//jvm/hermes/libs/x86:libjsi",
"//:x86_64": "//jvm/hermes/libs/x86_64:libjsi",
"//:arm64-v8a": "//jvm/hermes/libs/arm64-v8a:libfbjni",
"//:armeabi-v7a": "//jvm/hermes/libs/armeabi-v7a:libfbjni",
"//:x86": "//jvm/hermes/libs/x86:libfbjni",
"//:x86_64": "//jvm/hermes/libs/x86_64:libfbjni",
"//conditions:default": "empty",
}),
visibility = ["//visibility:public"],
)

alias(
name = "libc++_shared",
actual = select({
"//:arm64-v8a": "//jvm/hermes/libs/arm64-v8a:libc++_shared",
"//:armeabi-v7a": "//jvm/hermes/libs/armeabi-v7a:libc++_shared",
"//:x86": "//jvm/hermes/libs/x86:libc++_shared",
"//:x86_64": "//jvm/hermes/libs/x86_64:libc++_shared",
"//conditions:default": "empty",
}),
visibility = ["//visibility:public"],
Expand Down
10 changes: 8 additions & 2 deletions jvm/hermes/libs/arm64-v8a/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
cc_import(
name = "libjsi",
shared_library = ":libjsi.so",
name = "libfbjni",
shared_library = ":libfbjni.so",
visibility = ["//visibility:public"],
)

cc_import(
name = "libc++_shared",
shared_library = ":libc++_shared.so",
visibility = ["//visibility:public"],
)
Binary file added jvm/hermes/libs/arm64-v8a/libc++_shared.so
Binary file not shown.
Binary file added jvm/hermes/libs/arm64-v8a/libfbjni.so
Binary file not shown.
Binary file removed jvm/hermes/libs/arm64-v8a/libjsi.so
Binary file not shown.
10 changes: 8 additions & 2 deletions jvm/hermes/libs/armeabi-v7a/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
cc_import(
name = "libjsi",
shared_library = ":libjsi.so",
name = "libfbjni",
shared_library = ":libfbjni.so",
visibility = ["//visibility:public"],
)

cc_import(
name = "libc++_shared",
shared_library = ":libc++_shared.so",
visibility = ["//visibility:public"],
)
Binary file added jvm/hermes/libs/armeabi-v7a/libc++_shared.so
Binary file not shown.
Binary file added jvm/hermes/libs/armeabi-v7a/libfbjni.so
Binary file not shown.
Binary file removed jvm/hermes/libs/armeabi-v7a/libjsi.so
Binary file not shown.
10 changes: 8 additions & 2 deletions jvm/hermes/libs/x86/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
cc_import(
name = "libjsi",
shared_library = ":libjsi.so",
name = "libfbjni",
shared_library = ":libfbjni.so",
visibility = ["//visibility:public"],
)

cc_import(
name = "libc++_shared",
shared_library = ":libc++_shared.so",
visibility = ["//visibility:public"],
)
Binary file added jvm/hermes/libs/x86/libc++_shared.so
Binary file not shown.
Binary file added jvm/hermes/libs/x86/libfbjni.so
Binary file not shown.
Binary file removed jvm/hermes/libs/x86/libjsi.so
Binary file not shown.
10 changes: 8 additions & 2 deletions jvm/hermes/libs/x86_64/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
cc_import(
name = "libjsi",
shared_library = ":libjsi.so",
name = "libfbjni",
shared_library = ":libfbjni.so",
visibility = ["//visibility:public"],
)

cc_import(
name = "libc++_shared",
shared_library = ":libc++_shared.so",
visibility = ["//visibility:public"],
)
Binary file added jvm/hermes/libs/x86_64/libc++_shared.so
Binary file not shown.
Binary file added jvm/hermes/libs/x86_64/libfbjni.so
Binary file not shown.
Binary file removed jvm/hermes/libs/x86_64/libjsi.so
Binary file not shown.
5 changes: 4 additions & 1 deletion jvm/hermes/src/main/jni/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ cc_library(
],
copts = CMAKE_BUILD_TYPE_COPTS + select({
# TODO: Using React Natives JSI doesn't contain microtask - come back to this if we build it ourselves
":should_include_jni": ["-DJSI_MICROTASK"],
":should_include_jni": [
"-DJSI_MICROTASK"
],
"//conditions:default": [],
}),
linkopts = ["-Wl,-z,max-page-size=16384"],
visibility = ["//visibility:public"],
deps = select({
# Host build
Expand Down
4 changes: 2 additions & 2 deletions third_party/fbjni/artifact.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cc_import(
)

alias(
name = "libfbjni",
name = "libfbjni_pulled",
actual = select({
"@player//:arm64-v8a": ":arm64-v8a_libfbjni",
"@player//:armeabi-v7a": ":armeabi-v7a_libfbjni",
Expand All @@ -56,7 +56,7 @@ alias(
)

alias(
name = "libc++_shared",
name = "libc++_shared_pulled",
actual = select({
"@player//:arm64-v8a": ":arm64-v8a_libc++_shared",
"@player//:armeabi-v7a": ":armeabi-v7a_libc++_shared",
Expand Down
24 changes: 24 additions & 0 deletions third_party/rn/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,27 @@ exports_files([
"react_native.BUILD",
"hermes_android.BUILD",
])

alias(
name = "libhermes",
actual = select({
"//:arm64-v8a": "//third_party/rn/arm64-v8a:libhermes",
"//:armeabi-v7a": "//third_party/rn/armeabi-v7a:libhermes",
"//:x86": "//third_party/rn/x86:libhermes",
"//:x86_64": "//third_party/rn/x86_64:libhermes",
"//conditions:default": "empty",
}),
visibility = ["//visibility:public"],
)

alias(
name = "libjsi",
actual = select({
"//:arm64-v8a": "//third_party/rn/arm64-v8a:libjsi",
"//:armeabi-v7a": "//third_party/rn/armeabi-v7a:libjsi",
"//:x86": "//third_party/rn/x86:libjsi",
"//:x86_64": "//third_party/rn/x86_64:libjsi",
"//conditions:default": "empty",
}),
visibility = ["//visibility:public"],
)
11 changes: 11 additions & 0 deletions third_party/rn/arm64-v8a/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cc_import(
name = "libhermes",
shared_library = ":libhermes.so",
visibility = ["//visibility:public"],
)

cc_import(
name = "libjsi",
shared_library = ":libjsi.so",
visibility = ["//visibility:public"],
)
Binary file added third_party/rn/arm64-v8a/libhermes.so
Binary file not shown.
Binary file added third_party/rn/arm64-v8a/libjsi.so
Binary file not shown.
11 changes: 11 additions & 0 deletions third_party/rn/armeabi-v7a/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cc_import(
name = "libhermes",
shared_library = ":libhermes.so",
visibility = ["//visibility:public"],
)

cc_import(
name = "libjsi",
shared_library = ":libjsi.so",
visibility = ["//visibility:public"],
)
Binary file added third_party/rn/armeabi-v7a/libhermes.so
Binary file not shown.
Binary file added third_party/rn/armeabi-v7a/libjsi.so
Binary file not shown.
2 changes: 1 addition & 1 deletion third_party/rn/hermes_android.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cc_import(
)

alias(
name = "libhermes",
name = "libhermes_pulled",
actual = select({
"@player//:arm64-v8a": ":arm64-v8a_libhermes",
"@player//:armeabi-v7a": ":armeabi-v7a_libhermes",
Expand Down
11 changes: 11 additions & 0 deletions third_party/rn/x86/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cc_import(
name = "libhermes",
shared_library = ":libhermes.so",
visibility = ["//visibility:public"],
)

cc_import(
name = "libjsi",
shared_library = ":libjsi.so",
visibility = ["//visibility:public"],
)
Binary file added third_party/rn/x86/libhermes.so
Binary file not shown.
Binary file added third_party/rn/x86/libjsi.so
Binary file not shown.
11 changes: 11 additions & 0 deletions third_party/rn/x86_64/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cc_import(
name = "libhermes",
shared_library = ":libhermes.so",
visibility = ["//visibility:public"],
)

cc_import(
name = "libjsi",
shared_library = ":libjsi.so",
visibility = ["//visibility:public"],
)
Binary file added third_party/rn/x86_64/libhermes.so
Binary file not shown.
Binary file added third_party/rn/x86_64/libjsi.so
Binary file not shown.

0 comments on commit 315fff2

Please sign in to comment.