| #
e0f520f5 |
| 19-Oct-2022 |
Kudo Chien <[email protected]> |
[packages] Fix expo-modules-core androidTest (#19559)
# Why
follow up with #19411 to make expo-modules-core androidTest correctly
# How
those commented test cases break because we try to ca
[packages] Fix expo-modules-core androidTest (#19559)
# Why
follow up with #19411 to make expo-modules-core androidTest correctly
# How
those commented test cases break because we try to catch exceptions across shared library boundaries. there are a couple root causes actually:
## incompatible ndk versions
before ndk r23, the unwind library is libgcc, and after r23, the implementation is llvm libunwind. these two unwind implementation is incompatible. [email protected] and prebuilt react-native libs are all built from ndk r21. if we run the androidTest on m1 machine, we will use ndk r24 to build libraries. that's why we cannot catch fbjni exceptions in this situation. the pr tries to re-implement fbjni method calls and throw exceptions inline. that would make jni exceptions catchable.
other than that, when targeting prebuilt react-native, we should also use the same ndk r21 to build expo-modules-core. even we are on m1 machines.
## jscexecutor missing `_Unwind_Resume` symbol
the case happens when ndk r21 + jsc only, and this is also our ci android instrumented test environment. as [the ndk document](https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#unwinding) mentioned, for ndk r21, we should take care linking order. [this react-native fork patch](https://github.com/expo/react-native/commit/3986a385502df3eb207ca05f0b558171a600166c) addressed the issue.
if we test jsc on bare-expo, these test cases will still crash. i don't want to fix it or proposing the fix to upstream in the meantime. the latest react-native with AGP 7.3, the side-by-side ndk is already r23. since these are actually error cases, it's just not crash with correct stacktrace (not from expo-modules-core, but jscexecutor)
## c++_static runtime in expo-modules-core androidTest
always uses c++_shared runtime: the c++_static runtime doesn't well support the throw exceptions between shared library boundaries. we used c++_static because we want to fix the `et android-native-unit-tests -t instrumented` failures where the `./gradlew :expo-modules-core:connectedAndroidTest :expo-eas-client:connectedAndroidTest` will have duplicated fbjni.so build errors. this pr also reorganizes `et android-native-unit-tests` to build expo-modules-core androidTest exclusively.
# Test Plan
android instrumented ci passed
show more ...
|
| #
5e538c67 |
| 26-Sep-2022 |
Łukasz Kosmaty <[email protected]> |
[modules][Android] Simplify unpacking of method results (#19226)
# Why
Simplifies unpacking of method results.
Before, we used a similar approach to the RN when receiving results from Kotlin fun
[modules][Android] Simplify unpacking of method results (#19226)
# Why
Simplifies unpacking of method results.
Before, we used a similar approach to the RN when receiving results from Kotlin functions in Cpp. The result was obtained as a WritableArray, and then it was unpaced. That solution isn't ideal in the long term because we always return a single value.
# How
That change for the sync function was pretty straightforward. Right now, the Kotlin function body returns an arbitrary object which is later unpaced and converted to the jsi value.
Unfortunately, to simplify the flow of async functions, I've to introduce my implementation of the callback and the promise.
# Test Plan
- tests ✅
- bare-expo and NCL ✅
show more ...
|
| #
b7d1787d |
| 12-Aug-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet API] Cache PropNameID and js objects (#18579)
# Why
Adds a cache for prop name IDs and js objects like `Promise` or `CodedError`.
# How
- Added a cache registry
- Added missing tr
[sweet API] Cache PropNameID and js objects (#18579)
# Why
Adds a cache for prop name IDs and js objects like `Promise` or `CodedError`.
# How
- Added a cache registry
- Added missing try catch in the async function
# Test Plan
- unit tests ✅
show more ...
|
| #
22d99763 |
| 12-Jul-2022 |
Łukasz Kosmaty <[email protected]> |
[core][Android] Fix crashes in async functions (#18206)
# Why
Closes ENG-5686.
A follow-up to the https://github.com/expo/expo/pull/18200.
# How
`local_ref` may not be valid when we capt
[core][Android] Fix crashes in async functions (#18206)
# Why
Closes ENG-5686.
A follow-up to the https://github.com/expo/expo/pull/18200.
# How
`local_ref` may not be valid when we capture them in the lambdas. Therefore, I migrate them to `global_ref`.
Why won't copying references work here?
That solution also is open to the same problem. JNI is constructed in a way where everything is bound to the current stack frame. So when the program leaves a frame where something was allocated, is allowed to clear that. By coping references, we do not ensure that the underlying object will outlive the current scope.
# Test Plan
- NCL ✅
- unit tests ✅
show more ...
|
| #
47a022e6 |
| 29-Jun-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet][Kotlin] Add properties (#18015)
# Why
Adds support for properties.
A follow-up to the https://github.com/expo/expo/pull/17988.
# How
The code behind this future is very similar to
[sweet][Kotlin] Add properties (#18015)
# Why
Adds support for properties.
A follow-up to the https://github.com/expo/expo/pull/17988.
# How
The code behind this future is very similar to the current implementation of the sync functions. I've reused the whole calling solution from jsi functions.
# Test Plan
- unit tests ✅
show more ...
|
| #
9ebf31e6 |
| 27-Jun-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet API][Kotlin] Move preliminary args conversion to Cpp (#17944)
# Why
Moves preliminary args conversion to Cpp.
Needs to work:
- https://github.com/expo/expo/pull/17938
- https://github.c
[sweet API][Kotlin] Move preliminary args conversion to Cpp (#17944)
# Why
Moves preliminary args conversion to Cpp.
Needs to work:
- https://github.com/expo/expo/pull/17938
- https://github.com/expo/expo/pull/17940
- https://github.com/expo/expo/pull/17942
- https://github.com/expo/expo/pull/17943
# How
- Created the `CachedReferencesRegistry` that stores references to often used Java classes. In the future, we may want to store also jsi object there too.
- Reduced the usage of `folly`.
- Added unit tests.
# Benefits
- You can obtain `JavaScriptValue` and `JavaScriptObject` as a function argument
# Test Plan
- unit tests (that covers sync and async functions call too) ✅
show more ...
|
| #
a9275395 |
| 24-May-2022 |
Łukasz Kosmaty <[email protected]> |
[core][Sweet API] Fix `JNIAsyncFunctionBody` invoke method
|
| #
64f5c95f |
| 17-May-2022 |
Łukasz Kosmaty <[email protected]> |
[module-core][Kotlin] Add basic support for sync function (#16977)
# Why
Closes ENG-4608.
Adds basic support for sync function.
# How
- Created ExpoModulesHostObject that installs into the
[module-core][Kotlin] Add basic support for sync function (#16977)
# Why
Closes ENG-4608.
Adds basic support for sync function.
# How
- Created ExpoModulesHostObject that installs into the runtime as `global.ExpoModules`. A host object is an abstract object where we can define our property getter, allowing us to create JS object for each module lazily.
- Added `isAsync` property to sweet functions and `runSynchronously()` modifier - that will be changed in the future.
- Created `JavaScriptModuleObject` that represents a module in the JS world. It has a map of methods with a cached body.
- All the communication goes via two kotlin methods - `getJavaScriptModuleObject` (which returns a hybrid representation of the module) and `callMethodSync` (which is calling correct implementation). Right now, I'm not using lambdas to pass Kotlin functions into CPP, because I don't see any reason why should I.
# Test Plan
- tested with bare-expo ✅
show more ...
|