expo-modules-core 0.11.8 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -3
- package/ExpoModulesCore.podspec +67 -0
- package/android/CMakeLists.txt +39 -11
- package/android/build.gradle +120 -30
- package/android/proguard-rules.pro +7 -0
- package/android/src/fabric/Android-prebuilt.cmake +231 -0
- package/android/src/fabric/CMakeLists.txt +39 -0
- package/android/src/fabric/FabricComponentsRegistry.cpp +47 -0
- package/android/src/fabric/FabricComponentsRegistry.h +25 -0
- package/android/src/main/cpp/Exceptions.cpp +92 -0
- package/android/src/main/cpp/Exceptions.h +49 -0
- package/android/src/main/cpp/ExpoModulesHostObject.cpp +2 -1
- package/android/src/main/cpp/JNIFunctionBody.cpp +13 -7
- package/android/src/main/cpp/JNIFunctionBody.h +1 -1
- package/android/src/main/cpp/JNIInjector.cpp +15 -2
- package/android/src/main/cpp/JSIInteropModuleRegistry.cpp +23 -6
- package/android/src/main/cpp/JSIInteropModuleRegistry.h +3 -0
- package/android/src/main/cpp/JSReferencesCache.cpp +26 -0
- package/android/src/main/cpp/JSReferencesCache.h +63 -0
- package/android/src/main/cpp/JavaCallback.cpp +56 -0
- package/android/src/main/cpp/JavaCallback.h +48 -0
- package/android/src/main/cpp/JavaReferencesCache.cpp +100 -0
- package/android/src/main/cpp/{CachedReferencesRegistry.h → JavaReferencesCache.h} +10 -9
- package/android/src/main/cpp/JavaScriptModuleObject.cpp +9 -11
- package/android/src/main/cpp/JavaScriptModuleObject.h +5 -4
- package/android/src/main/cpp/JavaScriptObject.cpp +22 -20
- package/android/src/main/cpp/JavaScriptObject.h +17 -14
- package/android/src/main/cpp/JavaScriptRuntime.cpp +47 -3
- package/android/src/main/cpp/JavaScriptRuntime.h +6 -1
- package/android/src/main/cpp/JavaScriptTypedArray.cpp +91 -0
- package/android/src/main/cpp/JavaScriptTypedArray.h +70 -0
- package/android/src/main/cpp/JavaScriptValue.cpp +43 -21
- package/android/src/main/cpp/JavaScriptValue.h +14 -1
- package/android/src/main/cpp/MethodMetadata.cpp +220 -141
- package/android/src/main/cpp/MethodMetadata.h +20 -20
- package/android/src/main/cpp/WeakRuntimeHolder.cpp +17 -0
- package/android/src/main/cpp/WeakRuntimeHolder.h +36 -0
- package/android/src/main/cpp/javaclasses/Collections.h +63 -0
- package/android/src/main/cpp/types/AnyType.cpp +11 -0
- package/android/src/main/cpp/types/AnyType.h +27 -0
- package/android/src/main/cpp/types/CppType.h +26 -0
- package/android/src/main/cpp/types/ExpectedType.cpp +96 -0
- package/android/src/main/cpp/types/ExpectedType.h +49 -0
- package/android/src/main/cpp/types/FrontendConverter.cpp +409 -0
- package/android/src/main/cpp/types/FrontendConverter.h +313 -0
- package/android/src/main/cpp/types/FrontendConverterProvider.cpp +113 -0
- package/android/src/main/cpp/types/FrontendConverterProvider.h +47 -0
- package/android/src/main/java/expo/modules/adapters/react/FabricComponentsRegistry.kt +37 -0
- package/android/src/main/java/expo/modules/adapters/react/ModuleRegistryAdapter.java +11 -4
- package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +22 -10
- package/android/src/main/java/expo/modules/adapters/react/services/EventEmitterModule.java +11 -6
- package/android/src/main/java/expo/modules/adapters/react/services/UIManagerModuleWrapper.java +19 -6
- package/android/src/main/java/expo/modules/adapters/react/views/ViewManagerAdapterUtils.java +8 -1
- package/android/src/main/java/expo/modules/core/interfaces/services/UIManager.java +8 -0
- package/android/src/main/java/expo/modules/core/logging/LogHandler.kt +14 -0
- package/android/src/main/java/expo/modules/core/logging/LogType.kt +33 -0
- package/android/src/main/java/expo/modules/core/logging/Logger.kt +102 -0
- package/android/src/main/java/expo/modules/core/logging/LoggerOptions.kt +29 -0
- package/android/src/main/java/expo/modules/core/logging/OSLogHandler.kt +31 -0
- package/android/src/main/java/expo/modules/core/logging/PersistentFileLog.kt +143 -0
- package/android/src/main/java/expo/modules/core/logging/PersistentFileLogHandler.kt +24 -0
- package/android/src/main/java/expo/modules/core/logging/PersistentFileLogSerialDispatchQueue.kt +25 -0
- package/android/src/main/java/expo/modules/core/utilities/EmulatorUtilities.kt +33 -0
- package/android/src/main/java/expo/modules/interfaces/barcodescanner/BarCodeScannerResult.java +52 -0
- package/android/src/main/java/expo/modules/interfaces/filesystem/AppDirectoriesModuleInterface.kt +8 -0
- package/android/src/main/java/expo/modules/interfaces/sensors/services/LightSensorServiceInterface.java +6 -0
- package/android/src/main/java/expo/modules/kotlin/AppContext.kt +85 -36
- package/android/src/main/java/expo/modules/kotlin/CoreLogger.kt +6 -0
- package/android/src/main/java/expo/modules/kotlin/KPromiseWrapper.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +14 -5
- package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +12 -4
- package/android/src/main/java/expo/modules/kotlin/ModuleRegistry.kt +2 -0
- package/android/src/main/java/expo/modules/kotlin/Promise.kt +59 -0
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/apifeatures/Features.kt +6 -0
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/NativeModulesProxyModule.kt +27 -0
- package/android/src/main/java/expo/modules/kotlin/events/EventEmitter.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/events/KModuleEventEmitterWrapper.kt +24 -20
- package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +45 -12
- package/android/src/main/java/expo/modules/kotlin/exception/CommonExceptions.kt +41 -0
- package/android/src/main/java/expo/modules/kotlin/exception/ExceptionDecorator.kt +1 -0
- package/android/src/main/java/expo/modules/kotlin/functions/AnyFunction.kt +4 -3
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunction.kt +47 -11
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +38 -22
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionComponent.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionWithPromiseComponent.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/functions/BaseAsyncFunctionComponent.kt +25 -0
- package/android/src/main/java/expo/modules/kotlin/functions/SuspendFunctionComponent.kt +47 -33
- package/android/src/main/java/expo/modules/kotlin/functions/SyncFunctionComponent.kt +9 -5
- package/android/src/main/java/expo/modules/kotlin/jni/CppType.kt +20 -9
- package/android/src/main/java/expo/modules/kotlin/jni/ExpectedType.kt +108 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JNIFunctionBody.kt +2 -10
- package/android/src/main/java/expo/modules/kotlin/jni/JSIInteropModuleRegistry.kt +2 -1
- package/android/src/main/java/expo/modules/kotlin/jni/JavaCallback.kt +43 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptModuleObject.kt +4 -4
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptObject.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptTypedArray.kt +69 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptValue.kt +2 -0
- package/android/src/main/java/expo/modules/kotlin/jni/PromiseImpl.kt +98 -0
- package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +2 -0
- package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +28 -1
- package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionData.kt +8 -23
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +53 -34
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionData.kt +3 -11
- package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponent.kt +3 -4
- package/android/src/main/java/expo/modules/kotlin/providers/CurrentActivityProvider.kt +3 -4
- package/android/src/main/java/expo/modules/kotlin/records/RecordTypeConverter.kt +2 -1
- package/android/src/main/java/expo/modules/kotlin/typedarray/ConcreteTypedArrays.kt +154 -0
- package/android/src/main/java/expo/modules/kotlin/typedarray/GenericTypedArray.kt +8 -0
- package/android/src/main/java/expo/modules/kotlin/typedarray/TypedArray.kt +54 -0
- package/android/src/main/java/expo/modules/kotlin/typedarray/TypedArrayIterator.kt +9 -0
- package/android/src/main/java/expo/modules/kotlin/types/AnyType.kt +2 -1
- package/android/src/main/java/expo/modules/kotlin/types/AnyTypeConverter.kt +3 -11
- package/android/src/main/java/expo/modules/kotlin/types/ArrayTypeConverter.kt +22 -3
- package/android/src/main/java/expo/modules/kotlin/types/ColorTypeConverter.kt +233 -0
- package/android/src/main/java/expo/modules/kotlin/types/Either.kt +62 -0
- package/android/src/main/java/expo/modules/kotlin/types/EitherTypeConverter.kt +159 -0
- package/android/src/main/java/expo/modules/kotlin/types/EnumTypeConverter.kt +12 -2
- package/android/src/main/java/expo/modules/kotlin/types/Enumerable.kt +9 -0
- package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverter.kt +10 -0
- package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverterHelper.kt +38 -0
- package/android/src/main/java/expo/modules/kotlin/types/ListTypeConverter.kt +27 -7
- package/android/src/main/java/expo/modules/kotlin/types/MapTypeConverter.kt +21 -6
- package/android/src/main/java/expo/modules/kotlin/types/PairTypeConverter.kt +7 -1
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverter.kt +25 -4
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +126 -16
- package/android/src/main/java/expo/modules/kotlin/types/TypedArrayTypeConverter.kt +74 -0
- package/android/src/main/java/expo/modules/kotlin/types/io/FileTypeConverter.kt +23 -0
- package/android/src/main/java/expo/modules/kotlin/types/io/PathTypeConverter.kt +24 -0
- package/android/src/main/java/expo/modules/kotlin/types/net/URLTypConverter.kt +23 -0
- package/android/src/main/java/expo/modules/kotlin/types/net/UriTypeConverter.kt +40 -0
- package/android/src/main/java/expo/modules/kotlin/{callbacks/ViewCallback.kt → viewevent/ViewEvent.kt} +17 -5
- package/android/src/main/java/expo/modules/kotlin/viewevent/ViewEventDelegate.kt +46 -0
- package/android/src/main/java/expo/modules/kotlin/views/ConcreteViewProp.kt +7 -1
- package/android/src/main/java/expo/modules/kotlin/views/ExpoView.kt +13 -0
- package/android/src/main/java/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +116 -0
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinition.kt +7 -5
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerWrapperDelegate.kt +11 -10
- package/build/EventEmitter.d.ts +1 -0
- package/build/EventEmitter.d.ts.map +1 -1
- package/build/EventEmitter.js +9 -1
- package/build/EventEmitter.js.map +1 -1
- package/build/NativeModulesProxy.native.d.ts.map +1 -1
- package/build/NativeModulesProxy.native.js +9 -2
- package/build/NativeModulesProxy.native.js.map +1 -1
- package/build/PermissionsInterface.d.ts +2 -2
- package/build/PermissionsInterface.js.map +1 -1
- package/build/requireNativeModule.d.ts +10 -0
- package/build/requireNativeModule.d.ts.map +1 -1
- package/build/requireNativeModule.js +3 -1
- package/build/requireNativeModule.js.map +1 -1
- package/build/sweet/setUpErrorManager.fx.js +3 -0
- package/build/sweet/setUpErrorManager.fx.js.map +1 -1
- package/common/cpp/JSIUtils.cpp +20 -0
- package/common/cpp/JSIUtils.h +19 -0
- package/common/cpp/LazyObject.cpp +45 -0
- package/common/cpp/LazyObject.h +43 -0
- package/{ios/JSI → common/cpp}/TypedArray.cpp +4 -0
- package/{ios/JSI → common/cpp}/TypedArray.h +4 -0
- package/common/cpp/fabric/ExpoViewComponentDescriptor.cpp +19 -0
- package/common/cpp/fabric/ExpoViewComponentDescriptor.h +25 -0
- package/common/cpp/fabric/ExpoViewEventEmitter.cpp +13 -0
- package/common/cpp/fabric/ExpoViewEventEmitter.h +28 -0
- package/common/cpp/fabric/ExpoViewProps.cpp +16 -0
- package/common/cpp/fabric/ExpoViewProps.h +27 -0
- package/common/cpp/fabric/ExpoViewShadowNode.cpp +9 -0
- package/common/cpp/fabric/ExpoViewShadowNode.h +24 -0
- package/common/cpp/fabric/ExpoViewState.h +35 -0
- package/expo-module.config.json +4 -1
- package/ios/EXLegacyExpoViewProtocol.h +13 -0
- package/ios/ExpoModulesCore.h +4 -0
- package/ios/Fabric/ExpoFabricView.swift +185 -0
- package/ios/Fabric/ExpoFabricViewObjC.h +47 -0
- package/ios/Fabric/ExpoFabricViewObjC.mm +197 -0
- package/ios/JSI/EXJSIInstaller.mm +20 -8
- package/ios/JSI/EXJSIUtils.h +4 -0
- package/ios/JSI/EXJSIUtils.mm +21 -4
- package/ios/JSI/EXJavaScriptObject.h +5 -0
- package/ios/JSI/EXJavaScriptObject.mm +5 -0
- package/ios/JSI/EXJavaScriptRuntime.h +6 -0
- package/ios/JSI/EXJavaScriptRuntime.mm +22 -0
- package/ios/JSI/ExpoModulesHostObject.h +5 -0
- package/ios/JSI/ExpoModulesHostObject.mm +22 -3
- package/ios/NativeModulesProxy/EXNativeModulesProxy.mm +10 -4
- package/ios/NativeModulesProxy/NativeModulesProxyModule.swift +20 -0
- package/ios/Services/{EXReactNativeAdapter.m → EXReactNativeAdapter.mm} +15 -1
- package/ios/Services/EXReactNativeEventEmitter.m +2 -5
- package/ios/Swift/AppContext.swift +22 -11
- package/ios/Swift/Arguments/{ConvertibleArgument.swift → Convertible.swift} +4 -1
- package/ios/Swift/Arguments/Convertibles.swift +6 -35
- package/ios/Swift/Arguments/{EnumArgument.swift → Enumerable.swift} +7 -4
- package/ios/Swift/Classes/ClassComponentFactories.swift +10 -10
- package/ios/Swift/Conversions.swift +22 -3
- package/ios/Swift/Convertibles/Convertibles+Color.swift +195 -0
- package/ios/Swift/Convertibles/Either.swift +131 -0
- package/ios/Swift/DynamicTypes/AnyDynamicType.swift +1 -1
- package/ios/Swift/DynamicTypes/DynamicConvertibleType.swift +2 -2
- package/ios/Swift/DynamicTypes/DynamicEnumType.swift +2 -2
- package/ios/Swift/DynamicTypes/DynamicType.swift +2 -2
- package/ios/Swift/Events/Callback.swift +3 -3
- package/ios/Swift/Events/EventDispatcher.swift +85 -0
- package/ios/Swift/Exceptions/CodedError.swift +13 -8
- package/ios/Swift/Exceptions/CommonExceptions.swift +62 -0
- package/ios/Swift/Exceptions/Exception.swift +17 -4
- package/ios/Swift/Functions/AsyncFunctionComponent.swift +16 -11
- package/ios/Swift/Functions/SyncFunctionComponent.swift +14 -12
- package/ios/Swift/Logging/LogHandlers.swift +16 -1
- package/ios/Swift/Logging/Logger.swift +41 -6
- package/ios/Swift/Logging/PersistentFileLog.swift +152 -0
- package/ios/Swift/ModuleHolder.swift +2 -1
- package/ios/Swift/Modules/ModuleDefinition.swift +10 -1
- package/ios/Swift/Modules/ModuleDefinitionComponents.swift +6 -84
- package/ios/Swift/Objects/ObjectDefinitionComponents.swift +5 -230
- package/ios/Swift/Objects/PropertyComponent.swift +5 -2
- package/ios/Swift/Promise.swift +1 -1
- package/ios/Swift/Records/Record.swift +2 -2
- package/ios/Swift/Views/ComponentData.swift +5 -18
- package/ios/Swift/Views/ExpoView.swift +23 -2
- package/ios/Swift/Views/ViewDefinition.swift +71 -0
- package/ios/Swift/Views/ViewLifecycleMethod.swift +48 -0
- package/ios/Swift/Views/ViewManagerDefinition.swift +19 -2
- package/ios/Swift/Views/ViewManagerDefinitionComponents.swift +11 -23
- package/ios/Swift/Views/ViewModuleWrapper.swift +12 -5
- package/ios/Tests/ClassComponentSpec.swift +14 -14
- package/ios/Tests/ConvertiblesSpec.swift +11 -1
- package/ios/Tests/DynamicTypeSpec.swift +2 -2
- package/ios/Tests/EitherSpec.swift +91 -0
- package/ios/Tests/{EnumArgumentSpec.swift → EnumerableSpec.swift} +2 -2
- package/ios/Tests/ExpoModulesSpec.swift +6 -6
- package/ios/Tests/FunctionSpec.swift +16 -7
- package/ios/Tests/PersistentFileLogSpec.swift +75 -0
- package/ios/Tests/PropertyComponentSpec.swift +7 -7
- package/ios/Tests/TypedArraysSpec.swift +6 -6
- package/ios/Tests/ViewDefinitionSpec.swift +54 -0
- package/package.json +3 -3
- package/src/EventEmitter.ts +19 -1
- package/src/NativeModulesProxy.native.ts +10 -3
- package/src/PermissionsInterface.ts +2 -2
- package/src/requireNativeModule.ts +17 -1
- package/src/sweet/setUpErrorManager.fx.ts +4 -0
- package/src/ts-declarations/ExpoModules.d.ts +3 -0
- package/android/src/main/cpp/CachedReferencesRegistry.cpp +0 -67
- package/android/src/main/java/expo/modules/kotlin/callbacks/Callback.kt +0 -5
- package/android/src/main/java/expo/modules/kotlin/callbacks/ViewCallbackDelegate.kt +0 -27
- package/android/src/main/java/expo/modules/kotlin/types/BasicTypeConverters.kt +0 -108
- package/ios/ExpoModulesCore.podspec +0 -49
- package/ios/Swift/Events/Event.swift +0 -43
package/CHANGELOG.md
CHANGED
|
@@ -10,18 +10,85 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
## 0.
|
|
13
|
+
## 0.13.0 — 2022-10-25
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Convertible enums must inherit from `expo.modules.kotlin.types.Enumerable` on Android. ([#19551](https://github.com/expo/expo/pull/19551) by [@lukmccall](https://github.com/lukmccall))
|
|
18
|
+
- `AppContext.currentActivity` is not longer returning `AppCompatActivity`, but an instance of `android.app.Activity` class. ([#19573](https://github.com/expo/expo/pull/19573) by [@lukmccall](https://github.com/lukmccall))
|
|
19
|
+
|
|
20
|
+
### ⚠️ Notices
|
|
21
|
+
|
|
22
|
+
- Deprecated `ConvertibleArgument` in favor of `Convertible` and `EnumArgument` in favor of `Enumerable`. ([#19612](https://github.com/expo/expo/pull/19612) by [@tsapeta](https://github.com/tsapeta))
|
|
23
|
+
|
|
24
|
+
### 🎉 New features
|
|
25
|
+
|
|
26
|
+
- Implemented a mechanism for hooking into to the view lifecycle events (introduces new `OnViewDidUpdateProps` definition component). ([#19549](https://github.com/expo/expo/pull/19549) by [@tsapeta](https://github.com/tsapeta))
|
|
27
|
+
|
|
28
|
+
### 🐛 Bug fixes
|
|
29
|
+
|
|
30
|
+
- Fixed records aren't correctly converted to JS objects in the release builds on Android. ([#19551](https://github.com/expo/expo/pull/19551) by [@lukmccall](https://github.com/lukmccall))
|
|
31
|
+
- Reject promises with a `CodedError` instead of a plain object. ([#19605](https://github.com/expo/expo/pull/19605) by [@tsapeta](https://github.com/tsapeta))
|
|
32
|
+
|
|
33
|
+
### 💡 Others
|
|
34
|
+
|
|
35
|
+
- Simplified dispatching view events. ([#19537](https://github.com/expo/expo/pull/19537) by [@tsapeta](https://github.com/tsapeta))
|
|
36
|
+
|
|
37
|
+
## 0.12.0 — 2022-10-06
|
|
38
|
+
|
|
39
|
+
### 🛠 Breaking changes
|
|
40
|
+
|
|
41
|
+
- Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
|
|
42
|
+
|
|
43
|
+
### ⚠️ Notices
|
|
44
|
+
|
|
45
|
+
- Removed deprecated module definition components that started with a lowercase letter. ([#18851](https://github.com/expo/expo/pull/18851) by [@tsapeta](https://github.com/tsapeta))
|
|
46
|
+
- Added support for React Native 0.70.x. ([#19261](https://github.com/expo/expo/pull/19261) by [@kudo](https://github.com/kudo))
|
|
47
|
+
|
|
48
|
+
### 🎉 New features
|
|
49
|
+
|
|
50
|
+
- Added the interface for the light sensor support on Android. ([#18225](https://github.com/expo/expo/pull/18225) by [bearkillerPT](https://github.com/bearkillerPT))
|
|
51
|
+
- Add better JSI error handling on Android. ([#18259](https://github.com/expo/expo/pull/18259) by [@lukmccall](https://github.com/lukmccall))
|
|
52
|
+
- Experimental support for typed arrays on Android. ([#18379](https://github.com/expo/expo/pull/18379) by [@lukmccall](https://github.com/lukmccall))
|
|
53
|
+
- Using JSI instead of the bridge to call native methods also on legacy modules on iOS. ([#18438](https://github.com/expo/expo/pull/18438) by [@tsapeta](https://github.com/tsapeta))
|
|
54
|
+
- Experimental support for Fabric on iOS. ([#18500](https://github.com/expo/expo/pull/18500), [#18678](https://github.com/expo/expo/pull/18678) by [@tsapeta](https://github.com/tsapeta))
|
|
55
|
+
- Added view prop callbacks support for old-style views written in Objective-C. ([#18636](https://github.com/expo/expo/pull/18636) by [@tsapeta](https://github.com/tsapeta))
|
|
56
|
+
- Add Logger support for writing logs to a file; add Logger and associated classes to Android. ([#18513](https://github.com/expo/expo/pull/18513) by [@douglowder](https://github.com/douglowder))
|
|
57
|
+
- Experimental support for Fabric on Android. ([#18541](https://github.com/expo/expo/pull/18541) by [@kudo](https://github.com/kudo))
|
|
58
|
+
- Add option to generate a `coalescingKey` in callback on Android. ([#18774](https://github.com/expo/expo/pull/18774) by [@lukmccall](https://github.com/lukmccall))
|
|
59
|
+
- Automatically convert records to dicts when returned by the function. ([#18824](https://github.com/expo/expo/pull/18824) by [@tsapeta](https://github.com/tsapeta))
|
|
60
|
+
- Closures passed to definition components are now implicitly capturing `self` on iOS. ([#18831](https://github.com/expo/expo/pull/18831) by [@tsapeta](https://github.com/tsapeta))
|
|
61
|
+
- Support for CSS named colors in `UIColor` and `CGColor` convertibles on iOS. ([#18845](https://github.com/expo/expo/pull/18845) by [@tsapeta](https://github.com/tsapeta))
|
|
62
|
+
- Lazy load building the module's JavaScript object from the definition on iOS (already implemented on Android). ([#18863](https://github.com/expo/expo/pull/18863) by [@tsapeta](https://github.com/tsapeta))
|
|
63
|
+
- Inferring the view type in `Prop` setter closure. ([#19004](https://github.com/expo/expo/pull/19004) by [@tsapeta](https://github.com/tsapeta))
|
|
64
|
+
- [core] Added `REACT_NATIVE_DOWNLOADS_DIR` environment variable to specify custom third party libraries download location. ([#19015](https://github.com/expo/expo/pull/19015) by [@kudo](https://github.com/kudo))
|
|
65
|
+
- Add support for the `android.graphics.Color` class as the function parameter. ([#19054](https://github.com/expo/expo/pull/19054) by [@lukmccall](https://github.com/lukmccall))
|
|
66
|
+
- Add support for `android.net.Uri`, `java.io.File`, `java.net.URI` and `java.nio.file.Path` classes as function parameters. ([#19169](https://github.com/expo/expo/pull/19169) by [@lukmccall](https://github.com/lukmccall))
|
|
67
|
+
- Add the `RegisterActivityContracts` component to register all of activity result contracts on Android. ([#19180](https://github.com/expo/expo/pull/19180) by [@lukmccall](https://github.com/lukmccall))
|
|
68
|
+
- Improves JSI/JNI type conversion to support complex function arguments on Android. ([#19120](https://github.com/expo/expo/pull/19120) & [#19094](https://github.com/expo/expo/pull/19094) by [@lukmccall](https://github.com/lukmccall))
|
|
69
|
+
- Using JSI instead of the bridge to call native methods also on legacy modules on iOS. ([#19209](https://github.com/expo/expo/pull/19209) by [@lukmccall](https://github.com/lukmccall))
|
|
70
|
+
- Added `cacheDirectory` and `persistentFilesDirectory` to `AppContext` on Android to fix cache directories being incorrect in new Sweet API modules. It uses a new `AppDirectoriesModule` to get correct scoped directories from old module API. ([#19205](https://github.com/expo/expo/pull/19205) by [@aleqsio](https://github.com/aleqsio))
|
|
14
71
|
|
|
15
72
|
### 🐛 Bug fixes
|
|
16
73
|
|
|
17
|
-
- Fixed `
|
|
74
|
+
- Fixed the `2 files found with path 'lib/arm64-v8a/libfbjni.so'` error on Android. ([#18607](https://github.com/expo/expo/pull/18607) by [@lukmccall](https://github.com/lukmccall))
|
|
75
|
+
- Fixed event dispatching for Sweet API views when running in Fabric mode on Android. ([#18814](https://github.com/expo/expo/pull/18814) by [@kudo](https://github.com/kudo))
|
|
76
|
+
- Update gradle excludes to fix detox tests. ([#19254](https://github.com/expo/expo/pull/19254) by [@esamelson](https://github.com/esamelson))
|
|
77
|
+
- Fixed event listeners do not work when running with remote debugging mode on iOS. ([#19211](https://github.com/expo/expo/pull/19211) by [@kudo](https://github.com/kudo))
|
|
78
|
+
- Use shared C++ runtime to reduce library size on Android. ([#19372](https://github.com/expo/expo/pull/19372) by [@kudo](https://github.com/kudo))
|
|
18
79
|
- Fixed `JSCRuntime destroyed with a dangling API object` on Android. ([#19487](https://github.com/expo/expo/pull/19487) by [@lukmccall](https://github.com/lukmccall))
|
|
19
80
|
|
|
81
|
+
### 💡 Others
|
|
82
|
+
|
|
83
|
+
- Centralized Android emulator detection for native code and added checks to pick up additional emulator types in `EmulatorUtilities`. ([#16177](https://github.com/expo/expo/pull/16177)) by [@kbrandwijk](https://github.com/kbrandwijk), [@keith-kurak](https://github.com/keith-kurak))
|
|
84
|
+
- Created a separate high priority queue for all async function calls. ([#18734](https://github.com/expo/expo/pull/18734) by [@tsapeta](https://github.com/tsapeta))
|
|
85
|
+
- The host object for native modules is now installed as `global.expo.modules` instead of `global.ExpoModules`. ([#19273](https://github.com/expo/expo/pull/19273) & [#19281](https://github.com/expo/expo/pull/19281) by [@tsapeta](https://github.com/tsapeta), [@lukmccall](https://github.com/lukmccall))
|
|
86
|
+
|
|
20
87
|
## 0.11.7 — 2022-10-06
|
|
21
88
|
|
|
22
89
|
### 🐛 Bug fixes
|
|
23
90
|
|
|
24
|
-
- Fixed `ModuleRegistry`
|
|
91
|
+
- Fixed `ModuleRegistry` initialized twice when startup on Android. ([#19384](https://github.com/expo/expo/pull/19384) by [@kudo](https://github.com/kudo) and [@lukmccall](https://github.com/lukmccall))
|
|
25
92
|
- Ensure that AppDelegate callbacks are invoked. ([#19393](https://github.com/expo/expo/pull/19393) by [@ferologics](https://github.com/ferologics))
|
|
26
93
|
- Fixed Android crash when Activity is destroyed before `AppContext.onHostDestroy` call. ([#19406](https://github.com/expo/expo/pull/19406) by [@kudo](https://github.com/kudo))
|
|
27
94
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
5
|
+
fabric_compiler_flags = '-DRN_FABRIC_ENABLED'
|
|
6
|
+
folly_version = '2021.07.22.00'
|
|
7
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
8
|
+
|
|
9
|
+
Pod::Spec.new do |s|
|
|
10
|
+
s.name = 'ExpoModulesCore'
|
|
11
|
+
s.version = package['version']
|
|
12
|
+
s.summary = package['description']
|
|
13
|
+
s.description = package['description']
|
|
14
|
+
s.license = package['license']
|
|
15
|
+
s.author = package['author']
|
|
16
|
+
s.homepage = package['homepage']
|
|
17
|
+
s.platform = :ios, '13.0'
|
|
18
|
+
s.swift_version = '5.4'
|
|
19
|
+
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
20
|
+
s.static_framework = true
|
|
21
|
+
s.header_dir = 'ExpoModulesCore'
|
|
22
|
+
|
|
23
|
+
# Swift/Objective-C compatibility
|
|
24
|
+
s.pod_target_xcconfig = {
|
|
25
|
+
'USE_HEADERMAP' => 'YES',
|
|
26
|
+
'DEFINES_MODULE' => 'YES',
|
|
27
|
+
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
|
28
|
+
'SWIFT_COMPILATION_MODE' => 'wholemodule',
|
|
29
|
+
'HEADER_SEARCH_PATHS' => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers\"",
|
|
30
|
+
'OTHER_SWIFT_FLAGS' => "$(inherited) #{fabric_enabled ? fabric_compiler_flags : ''}"
|
|
31
|
+
}
|
|
32
|
+
s.user_target_xcconfig = {
|
|
33
|
+
"HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/ExpoModulesCore/Swift Compatibility Header\" \"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers\"",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
s.dependency 'React-Core'
|
|
37
|
+
s.dependency 'ReactCommon/turbomodule/core'
|
|
38
|
+
|
|
39
|
+
if fabric_enabled
|
|
40
|
+
s.compiler_flags = folly_compiler_flags + ' ' + fabric_compiler_flags
|
|
41
|
+
|
|
42
|
+
s.dependency 'React-RCTFabric'
|
|
43
|
+
s.dependency 'RCT-Folly', folly_version
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("ios/#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
|
|
47
|
+
s.source_files = 'ios/**/*.h', 'common/cpp/**/*.h'
|
|
48
|
+
s.vendored_frameworks = "ios/#{s.name}.xcframework"
|
|
49
|
+
else
|
|
50
|
+
s.source_files = 'ios/**/*.{h,m,mm,swift,cpp}', 'common/cpp/**/*.{h,cpp}'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
exclude_files = ['ios/Tests/']
|
|
54
|
+
if !fabric_enabled
|
|
55
|
+
exclude_files.append('ios/Fabric/')
|
|
56
|
+
exclude_files.append('common/cpp/fabric/')
|
|
57
|
+
end
|
|
58
|
+
s.exclude_files = exclude_files
|
|
59
|
+
|
|
60
|
+
s.private_header_files = ['ios/**/*+Private.h', 'ios/**/Swift.h']
|
|
61
|
+
|
|
62
|
+
s.test_spec 'Tests' do |test_spec|
|
|
63
|
+
test_spec.dependency 'ExpoModulesTestCore'
|
|
64
|
+
|
|
65
|
+
test_spec.source_files = 'ios/Tests/**/*.{m,swift}'
|
|
66
|
+
end
|
|
67
|
+
end
|
package/android/CMakeLists.txt
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.4.1)
|
|
2
2
|
|
|
3
|
+
project(expo-modules-core)
|
|
4
|
+
|
|
3
5
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
4
|
-
set(CMAKE_ANDROID_STL_TYPE c++_shared)
|
|
5
6
|
set(CMAKE_CXX_STANDARD 17)
|
|
6
7
|
set(PACKAGE_NAME "expo-modules-core")
|
|
7
8
|
set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
|
|
8
|
-
set(ignoreMe "${HERMES_HEADER_DIR}")
|
|
9
|
+
set(ignoreMe "${PROJECT_BUILD_DIR} ${REACT_ANDROID_BUILD_DIR} ${REACT_ANDROID_DIR} ${HERMES_HEADER_DIR}")
|
|
9
10
|
|
|
10
11
|
if (${NATIVE_DEBUG})
|
|
11
12
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
|
|
@@ -13,7 +14,11 @@ if (${NATIVE_DEBUG})
|
|
|
13
14
|
endif ()
|
|
14
15
|
|
|
15
16
|
set(SRC_DIR ${CMAKE_SOURCE_DIR}/src)
|
|
17
|
+
set(COMMON_DIR ${CMAKE_SOURCE_DIR}/../common/cpp)
|
|
16
18
|
file(GLOB sources_android "${SRC_DIR}/main/cpp/*.cpp")
|
|
19
|
+
file(GLOB sources_android_types "${SRC_DIR}/main/cpp/types/*.cpp")
|
|
20
|
+
file(GLOB sources_android_javaclasses "${SRC_DIR}/main/cpp/javaclasses/*.cpp")
|
|
21
|
+
file(GLOB common_sources "${COMMON_DIR}/*.cpp")
|
|
17
22
|
|
|
18
23
|
# shared
|
|
19
24
|
|
|
@@ -25,15 +30,40 @@ macro(createVarAsBoolToInt name value)
|
|
|
25
30
|
endif()
|
|
26
31
|
endmacro()
|
|
27
32
|
|
|
33
|
+
add_library(CommonSettings INTERFACE)
|
|
34
|
+
|
|
28
35
|
add_library(
|
|
29
36
|
${PACKAGE_NAME}
|
|
30
37
|
SHARED
|
|
38
|
+
${common_sources}
|
|
31
39
|
${sources_android}
|
|
40
|
+
${sources_android_types}
|
|
41
|
+
${sources_android_javaclasses}
|
|
32
42
|
)
|
|
33
43
|
|
|
44
|
+
if(IS_NEW_ARCHITECTURE_ENABLED)
|
|
45
|
+
add_subdirectory("${SRC_DIR}/fabric")
|
|
46
|
+
set(NEW_ARCHITECTURE_DEPENDENCIES "fabric")
|
|
47
|
+
set(NEW_ARCHITECTURE_COMPILE_OPTIONS -DIS_NEW_ARCHITECTURE_ENABLED=1 -DRN_FABRIC_ENABLED=1)
|
|
48
|
+
else()
|
|
49
|
+
set(NEW_ARCHITECTURE_DEPENDENCIES "")
|
|
50
|
+
set(NEW_ARCHITECTURE_COMPILE_OPTIONS "")
|
|
51
|
+
endif()
|
|
52
|
+
|
|
34
53
|
createVarAsBoolToInt("USE_HERMES_INT" ${USE_HERMES})
|
|
35
54
|
createVarAsBoolToInt("UNIT_TEST_INT" ${UNIT_TEST})
|
|
36
55
|
|
|
56
|
+
target_compile_options(CommonSettings INTERFACE
|
|
57
|
+
-O2
|
|
58
|
+
-frtti
|
|
59
|
+
-fexceptions
|
|
60
|
+
-Wall
|
|
61
|
+
-fstack-protector-all
|
|
62
|
+
-DUSE_HERMES=${USE_HERMES_INT}
|
|
63
|
+
-DUNIT_TEST=${UNIT_TEST_INT}
|
|
64
|
+
${NEW_ARCHITECTURE_COMPILE_OPTIONS}
|
|
65
|
+
)
|
|
66
|
+
|
|
37
67
|
# Extracted AAR: ${BUILD_DIR}/react-native-0*/jni/${ANDROID_ABI}
|
|
38
68
|
file(GLOB LIBRN_DIR "${REACT_NATIVE_SO_DIR}/${ANDROID_ABI}")
|
|
39
69
|
if (NOT LIBRN_DIR)
|
|
@@ -55,7 +85,7 @@ if(${UNIT_TEST})
|
|
|
55
85
|
PATHS ${HERMES_SO_DIR}
|
|
56
86
|
NO_CMAKE_FIND_ROOT_PATH
|
|
57
87
|
)
|
|
58
|
-
set(JSEXECUTOR_INCLUDE
|
|
88
|
+
set(JSEXECUTOR_INCLUDE ${HERMES_HEADER_DIR} ${HERMES_HEADER_DIR}/API ${HERMES_HEADER_DIR}/public)
|
|
59
89
|
else()
|
|
60
90
|
find_library(
|
|
61
91
|
JSEXECUTOR_LIB
|
|
@@ -80,6 +110,7 @@ target_include_directories(
|
|
|
80
110
|
"${REACT_NATIVE_DIR}/React/Base"
|
|
81
111
|
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni"
|
|
82
112
|
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react"
|
|
113
|
+
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule"
|
|
83
114
|
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
|
|
84
115
|
"${REACT_NATIVE_DIR}/ReactCommon"
|
|
85
116
|
"${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core"
|
|
@@ -88,8 +119,10 @@ target_include_directories(
|
|
|
88
119
|
"${BUILD_DIR}/third-party-ndk/boost/boost_${BOOST_VERSION}"
|
|
89
120
|
"${BUILD_DIR}/third-party-ndk/double-conversion"
|
|
90
121
|
"${BUILD_DIR}/third-party-ndk/folly"
|
|
91
|
-
${libfbjni_include_DIRS}
|
|
122
|
+
"${libfbjni_include_DIRS}"
|
|
123
|
+
"${COMMON_DIR}"
|
|
92
124
|
"${JSEXECUTOR_INCLUDE}"
|
|
125
|
+
"${SRC_DIR}/fabric"
|
|
93
126
|
)
|
|
94
127
|
|
|
95
128
|
# find libraries
|
|
@@ -151,17 +184,11 @@ target_compile_options(
|
|
|
151
184
|
-DFOLLY_HAVE_MEMRCHR=1
|
|
152
185
|
-DFOLLY_USE_LIBCPP=1
|
|
153
186
|
-DFOLLY_MOBILE=1
|
|
154
|
-
-DUSE_HERMES=${USE_HERMES_INT}
|
|
155
|
-
-DUNIT_TEST=${UNIT_TEST_INT}
|
|
156
|
-
-O2
|
|
157
|
-
-frtti
|
|
158
|
-
-fexceptions
|
|
159
|
-
-Wall
|
|
160
|
-
-fstack-protector-all
|
|
161
187
|
)
|
|
162
188
|
|
|
163
189
|
target_link_libraries(
|
|
164
190
|
${PACKAGE_NAME}
|
|
191
|
+
CommonSettings
|
|
165
192
|
${LOG_LIB}
|
|
166
193
|
${FBJNI_LIB}
|
|
167
194
|
${JSI_LIB}
|
|
@@ -170,4 +197,5 @@ target_link_libraries(
|
|
|
170
197
|
${FOLLY_LIB}
|
|
171
198
|
${REACT_NATIVE_MODULES_CORE}
|
|
172
199
|
android
|
|
200
|
+
${NEW_ARCHITECTURE_DEPENDENCIES}
|
|
173
201
|
)
|
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ apply plugin: 'maven-publish'
|
|
|
6
6
|
apply plugin: "de.undercouch.download"
|
|
7
7
|
|
|
8
8
|
group = 'host.exp.exponent'
|
|
9
|
-
version = '0.
|
|
9
|
+
version = '0.13.0'
|
|
10
10
|
|
|
11
11
|
buildscript {
|
|
12
12
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -39,13 +39,18 @@ buildscript {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
def
|
|
42
|
+
def isExpoModulesCoreTests = {
|
|
43
43
|
Gradle gradle = getGradle()
|
|
44
44
|
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
|
|
45
|
-
|
|
45
|
+
if (tskReqStr =~ /:expo-modules-core:connected\w*AndroidTest/) {
|
|
46
|
+
def androidTests = project.file("src/androidTest")
|
|
47
|
+
return androidTests.exists() && androidTests.isDirectory()
|
|
48
|
+
}
|
|
49
|
+
return false
|
|
46
50
|
}.call()
|
|
47
51
|
|
|
48
|
-
def
|
|
52
|
+
def customDownloadsDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
|
|
53
|
+
def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File("$buildDir/downloads")
|
|
49
54
|
def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
|
|
50
55
|
|
|
51
56
|
def REACT_NATIVE_BUILD_FROM_SOURCE = findProject(":ReactAndroid") != null
|
|
@@ -72,13 +77,18 @@ def reactNativeArchitectures() {
|
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
// HERMES
|
|
75
|
-
def prebuiltHermesDir = findProperty("expo.prebuiltHermesDir") ?: file("${
|
|
80
|
+
def prebuiltHermesDir = findProperty("expo.prebuiltHermesDir") ?: file("${rootDir}/prebuiltHermes")
|
|
76
81
|
def prebuiltHermesVersion = file("${prebuiltHermesDir}/.hermesversion").exists() ? file("${prebuiltHermesDir}/.hermesversion").text : null
|
|
77
82
|
def currentHermesVersion = file("${REACT_NATIVE_DIR}/sdks/.hermesversion").exists() ? file("${REACT_NATIVE_DIR}/sdks/.hermesversion").text : null
|
|
78
83
|
def hasHermesProject = findProject(":ReactAndroid:hermes-engine") != null
|
|
79
84
|
def prebuiltHermesCacheHit = hasHermesProject && currentHermesVersion == prebuiltHermesVersion
|
|
80
85
|
|
|
86
|
+
// By default we are going to download and unzip hermes inside the /sdks/hermes folder
|
|
87
|
+
// but you can provide an override for where the hermes source code is located.
|
|
88
|
+
def hermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") ?: file("${REACT_NATIVE_DIR}/sdks/hermes")
|
|
89
|
+
|
|
81
90
|
def USE_HERMES = false
|
|
91
|
+
def NEED_DOWNLOAD_HERMES = false
|
|
82
92
|
def HERMES_HEADER_DIR = null
|
|
83
93
|
def HERMES_AAR = null
|
|
84
94
|
if (findProject(":app")) {
|
|
@@ -92,8 +102,8 @@ if (findProject(":app")) {
|
|
|
92
102
|
USE_HERMES = (findProperty('expo.jsEngine') ?: "jsc") == "hermes"
|
|
93
103
|
}
|
|
94
104
|
|
|
95
|
-
// Currently the needs for hermes/jsc are only for androidTest, so we turn on this flag only when `
|
|
96
|
-
USE_HERMES = USE_HERMES &&
|
|
105
|
+
// Currently the needs for hermes/jsc are only for androidTest, so we turn on this flag only when `isExpoModulesCoreTests` is true
|
|
106
|
+
USE_HERMES = USE_HERMES && isExpoModulesCoreTests
|
|
97
107
|
|
|
98
108
|
if (USE_HERMES) {
|
|
99
109
|
if (prebuiltHermesCacheHit) {
|
|
@@ -103,24 +113,21 @@ if (USE_HERMES) {
|
|
|
103
113
|
HERMES_HEADER_DIR = file("${thirdPartyNdkDir}/hermes/prefab/modules/libhermes/include")
|
|
104
114
|
HERMES_AAR = file("${REACT_NATIVE_DIR}/ReactAndroid/hermes-engine/build/outputs/aar/hermes-engine-debug.aar")
|
|
105
115
|
} else {
|
|
106
|
-
// The `hermes-engine` package doesn't contain the correct version of the Hermes.
|
|
107
|
-
// The AAR we need to import is located in the React Native package.
|
|
108
|
-
// However, the version from RN doesn't include header files.
|
|
109
|
-
// To get those, we must fall back to the `hermes-engine` package.
|
|
110
|
-
def hermesEngineDir = new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).parent
|
|
111
|
-
|
|
112
116
|
def prebuiltAAR = fileTree(REACT_NATIVE_DIR).matching { include "**/hermes-engine/**/hermes-engine-*-debug.aar" }
|
|
113
117
|
if (prebuiltAAR.any()) {
|
|
114
118
|
HERMES_AAR = prebuiltAAR.singleFile
|
|
115
119
|
} else {
|
|
116
120
|
HERMES_AAR = file("${hermesEngineDir}/android/hermes-debug.aar")
|
|
117
121
|
}
|
|
118
|
-
HERMES_HEADER_DIR = file("${
|
|
122
|
+
HERMES_HEADER_DIR = file("${hermesDir}")
|
|
123
|
+
NEED_DOWNLOAD_HERMES = true
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
126
|
// END HERMES
|
|
122
127
|
|
|
123
128
|
|
|
129
|
+
def isNewArchitectureEnabled = findProperty("newArchEnabled") == "true"
|
|
130
|
+
|
|
124
131
|
// Creating sources with comments
|
|
125
132
|
task androidSourcesJar(type: Jar) {
|
|
126
133
|
classifier = 'sources'
|
|
@@ -147,6 +154,24 @@ afterEvaluate {
|
|
|
147
154
|
android {
|
|
148
155
|
compileSdkVersion safeExtGet("compileSdkVersion", 31)
|
|
149
156
|
|
|
157
|
+
if (REACT_NATIVE_BUILD_FROM_SOURCE) {
|
|
158
|
+
if (rootProject.hasProperty("ndkPath")) {
|
|
159
|
+
ndkPath rootProject.ext.ndkPath
|
|
160
|
+
}
|
|
161
|
+
if (rootProject.hasProperty("ndkVersion")) {
|
|
162
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
// This ndkVersion should align to prebuilt react-native building ndkVersion.
|
|
166
|
+
// Because the unwind library is different before NDK r23 and after,
|
|
167
|
+
// if we build this library with newer NDK, C++ exceptions are incompatible between these libraries.
|
|
168
|
+
// For example, C++ exceptions throwing from hermes are not catchable from this library.
|
|
169
|
+
// Ref: https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#unwinding
|
|
170
|
+
//
|
|
171
|
+
// TODO: Revisit this version when upgrade react-native 0.71 (Expo SDK 48)
|
|
172
|
+
ndkVersion = "21.4.7075529"
|
|
173
|
+
}
|
|
174
|
+
|
|
150
175
|
compileOptions {
|
|
151
176
|
sourceCompatibility JavaVersion.VERSION_11
|
|
152
177
|
targetCompatibility JavaVersion.VERSION_11
|
|
@@ -161,20 +186,26 @@ android {
|
|
|
161
186
|
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
162
187
|
consumerProguardFiles 'proguard-rules.pro'
|
|
163
188
|
versionCode 1
|
|
164
|
-
versionName "0.
|
|
189
|
+
versionName "0.13.0"
|
|
190
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
|
|
165
191
|
|
|
166
192
|
testInstrumentationRunner "expo.modules.TestRunner"
|
|
167
193
|
|
|
168
194
|
externalNativeBuild {
|
|
169
195
|
cmake {
|
|
170
196
|
abiFilters (*reactNativeArchitectures())
|
|
171
|
-
arguments "-
|
|
197
|
+
arguments "-DANDROID_STL=c++_shared",
|
|
198
|
+
"-DREACT_NATIVE_DIR=${REACT_NATIVE_DIR}",
|
|
172
199
|
"-DREACT_NATIVE_SO_DIR=${REACT_NATIVE_SO_DIR}",
|
|
173
200
|
"-DREACT_NATIVE_TARGET_VERSION=${REACT_NATIVE_TARGET_VERSION}",
|
|
174
201
|
"-DBOOST_VERSION=${BOOST_VERSION}",
|
|
175
202
|
"-DUSE_HERMES=${USE_HERMES}",
|
|
176
203
|
"-DHERMES_HEADER_DIR=${HERMES_HEADER_DIR}",
|
|
177
|
-
"-
|
|
204
|
+
"-DIS_NEW_ARCHITECTURE_ENABLED=${isNewArchitectureEnabled}",
|
|
205
|
+
"-DPROJECT_BUILD_DIR=$buildDir",
|
|
206
|
+
"-DREACT_ANDROID_DIR=${REACT_NATIVE_DIR}/ReactAndroid",
|
|
207
|
+
"-DREACT_ANDROID_BUILD_DIR=${REACT_NATIVE_DIR}/ReactAndroid/build",
|
|
208
|
+
"-DUNIT_TEST=${isExpoModulesCoreTests}"
|
|
178
209
|
}
|
|
179
210
|
}
|
|
180
211
|
}
|
|
@@ -194,28 +225,33 @@ android {
|
|
|
194
225
|
// Theses files are intermediated linking files to build modules-core and should not be in final package.
|
|
195
226
|
def sharedLibraries = [
|
|
196
227
|
"**/libc++_shared.so",
|
|
197
|
-
"**/
|
|
198
|
-
"**/libreact_nativemodule_core.so",
|
|
199
|
-
"**/libglog.so",
|
|
200
|
-
"**/libjscexecutor.so",
|
|
228
|
+
"**/libfabricjni.so",
|
|
201
229
|
"**/libfbjni.so",
|
|
202
230
|
"**/libfolly_json.so",
|
|
203
231
|
"**/libfolly_runtime.so",
|
|
232
|
+
"**/libglog.so",
|
|
204
233
|
"**/libhermes.so",
|
|
234
|
+
"**/libjscexecutor.so",
|
|
205
235
|
"**/libjsi.so",
|
|
236
|
+
"**/libreactnativejni.so",
|
|
237
|
+
"**/libreact_debug.so",
|
|
238
|
+
"**/libreact_nativemodule_core.so",
|
|
239
|
+
"**/libreact_render_debug.so",
|
|
240
|
+
"**/libreact_render_graphics.so",
|
|
241
|
+
"**/libreact_render_core.so",
|
|
242
|
+
"**/libreact_render_componentregistry.so",
|
|
243
|
+
"**/libreact_render_mapbuffer.so",
|
|
244
|
+
"**/librrc_view.so",
|
|
245
|
+
"**/libruntimeexecutor.so",
|
|
246
|
+
"**/libyoga.so",
|
|
206
247
|
]
|
|
207
248
|
|
|
208
249
|
// In android (instrumental) tests, we want to package all so files to enable our JSI functionality.
|
|
209
250
|
// Otherwise, those files should be excluded, because will be loaded by the application.
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
"META-INF/MANIFEST.MF",
|
|
213
|
-
"META-INF/com.android.tools/proguard/coroutines.pro",
|
|
214
|
-
"META-INF/proguard/coroutines.pro"
|
|
215
|
-
]
|
|
216
|
-
pickFirsts = sharedLibraries
|
|
251
|
+
if (isExpoModulesCoreTests) {
|
|
252
|
+
pickFirsts += sharedLibraries
|
|
217
253
|
} else {
|
|
218
|
-
excludes
|
|
254
|
+
excludes += sharedLibraries
|
|
219
255
|
}
|
|
220
256
|
}
|
|
221
257
|
|
|
@@ -439,12 +475,36 @@ task prepareFolly(dependsOn: [downloadFolly], type: Copy) {
|
|
|
439
475
|
includeEmptyDirs = false
|
|
440
476
|
into("$thirdPartyNdkDir/folly")
|
|
441
477
|
}
|
|
442
|
-
// END
|
|
478
|
+
// END FOLLY
|
|
479
|
+
|
|
480
|
+
task downloadHermes(type: Download) {
|
|
481
|
+
def hermesVersion = currentHermesVersion ?: "main"
|
|
482
|
+
src("https://github.com/facebook/hermes/tarball/${hermesVersion}")
|
|
483
|
+
onlyIfNewer(true)
|
|
484
|
+
overwrite(false)
|
|
485
|
+
dest(new File(downloadsDir, "hermes-${hermesVersion}.tar.gz"))
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
task unzipHermes(dependsOn: downloadHermes, type: Copy) {
|
|
489
|
+
from(tarTree(downloadHermes.dest)) {
|
|
490
|
+
eachFile { file ->
|
|
491
|
+
// We flatten the unzip as the tarball contains a `facebook-hermes-<SHA>`
|
|
492
|
+
// folder at the top level.
|
|
493
|
+
if (file.relativePath.segments.size() > 1) {
|
|
494
|
+
file.relativePath = new org.gradle.api.file.RelativePath(!file.isDirectory(), file.relativePath.segments.drop(1))
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
into(hermesDir)
|
|
499
|
+
}
|
|
443
500
|
|
|
444
501
|
task prepareHermes(dependsOn: createNativeDepsDirectories) {
|
|
445
502
|
if (!USE_HERMES) {
|
|
446
503
|
return
|
|
447
504
|
}
|
|
505
|
+
if (NEED_DOWNLOAD_HERMES) {
|
|
506
|
+
dependsOn(unzipHermes)
|
|
507
|
+
}
|
|
448
508
|
|
|
449
509
|
doLast {
|
|
450
510
|
def files = zipTree(HERMES_AAR).matching({ it.include "**/*.so", "prefab/modules/libhermes/include/**/*" })
|
|
@@ -459,6 +519,17 @@ task prepareHermes(dependsOn: createNativeDepsDirectories) {
|
|
|
459
519
|
|
|
460
520
|
task prepareThirdPartyNdkHeaders(dependsOn: [prepareBoost, prepareDoubleConversion, prepareFolly]) {}
|
|
461
521
|
|
|
522
|
+
def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
|
|
523
|
+
dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
|
|
524
|
+
from("$REACT_NATIVE_DIR/ReactAndroid/src/main/jni/prebuilt/lib")
|
|
525
|
+
into("$buildDir/react-ndk/exported")
|
|
526
|
+
}
|
|
527
|
+
def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
|
|
528
|
+
dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
|
|
529
|
+
from("$REACT_NATIVE_DIR/ReactAndroid/src/main/jni/prebuilt/lib")
|
|
530
|
+
into("$buildDir/react-ndk/exported")
|
|
531
|
+
}
|
|
532
|
+
|
|
462
533
|
afterEvaluate {
|
|
463
534
|
extractAARHeaders.dependsOn(prepareThirdPartyNdkHeaders)
|
|
464
535
|
extractJNIFiles.dependsOn(prepareThirdPartyNdkHeaders)
|
|
@@ -468,6 +539,25 @@ afterEvaluate {
|
|
|
468
539
|
prepareHermes.dependsOn(":ReactAndroid:hermes-engine:assembleDebug")
|
|
469
540
|
}
|
|
470
541
|
}
|
|
542
|
+
|
|
543
|
+
if (isNewArchitectureEnabled) {
|
|
544
|
+
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
|
|
545
|
+
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
|
|
546
|
+
|
|
547
|
+
// Due to a bug inside AGP, we have to explicitly set a dependency
|
|
548
|
+
// between configureCMake* tasks and the preBuild tasks.
|
|
549
|
+
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
|
|
550
|
+
configureCMakeDebug.dependsOn(preDebugBuild)
|
|
551
|
+
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
|
|
552
|
+
reactNativeArchitectures().each { architecture ->
|
|
553
|
+
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
|
|
554
|
+
dependsOn("preDebugBuild")
|
|
555
|
+
}
|
|
556
|
+
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
|
|
557
|
+
dependsOn("preReleaseBuild")
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
471
561
|
}
|
|
472
562
|
|
|
473
563
|
tasks.whenTaskAdded { task ->
|