@depup/react-native-worklets 0.11.3-depup.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/.worklets/dummy.md +1 -0
- package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp +64 -0
- package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.h +38 -0
- package/Common/cpp/worklets/Compat/Holders.h +25 -0
- package/Common/cpp/worklets/Compat/StableApi.cpp +145 -0
- package/Common/cpp/worklets/Compat/StableApi.h +128 -0
- package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp +729 -0
- package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.h +126 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +81 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +76 -0
- package/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +95 -0
- package/Common/cpp/worklets/Registries/EventHandlerRegistry.h +44 -0
- package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +10 -0
- package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +43 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueue.h +14 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.cpp +69 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.h +48 -0
- package/Common/cpp/worklets/RunLoop/EventLoop.cpp +103 -0
- package/Common/cpp/worklets/RunLoop/EventLoop.h +52 -0
- package/Common/cpp/worklets/SharedItems/MemoryManager.cpp +60 -0
- package/Common/cpp/worklets/SharedItems/MemoryManager.h +29 -0
- package/Common/cpp/worklets/SharedItems/Serializable.cpp +373 -0
- package/Common/cpp/worklets/SharedItems/Serializable.h +413 -0
- package/Common/cpp/worklets/SharedItems/SerializableFactory.cpp +172 -0
- package/Common/cpp/worklets/SharedItems/SerializableFactory.h +85 -0
- package/Common/cpp/worklets/SharedItems/SerializableRemoteFunction.cpp +71 -0
- package/Common/cpp/worklets/SharedItems/SerializableRemoteFunction.h +75 -0
- package/Common/cpp/worklets/SharedItems/Shareable.cpp +84 -0
- package/Common/cpp/worklets/SharedItems/Shareable.h +43 -0
- package/Common/cpp/worklets/SharedItems/Synchronizable.cpp +59 -0
- package/Common/cpp/worklets/SharedItems/Synchronizable.h +57 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableAccess.cpp +78 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableAccess.h +45 -0
- package/Common/cpp/worklets/SharedItems/UnpackerLoader.h +78 -0
- package/Common/cpp/worklets/Tools/FeatureFlags.cpp +18 -0
- package/Common/cpp/worklets/Tools/FeatureFlags.h +44 -0
- package/Common/cpp/worklets/Tools/JSISerializer.cpp +312 -0
- package/Common/cpp/worklets/Tools/JSISerializer.h +42 -0
- package/Common/cpp/worklets/Tools/JSLogger.cpp +92 -0
- package/Common/cpp/worklets/Tools/JSLogger.h +48 -0
- package/Common/cpp/worklets/Tools/JSScheduler.cpp +21 -0
- package/Common/cpp/worklets/Tools/JSScheduler.h +35 -0
- package/Common/cpp/worklets/Tools/PlatformLogger.h +16 -0
- package/Common/cpp/worklets/Tools/RNRuntimeStatus.h +27 -0
- package/Common/cpp/worklets/Tools/ScriptBuffer.h +56 -0
- package/Common/cpp/worklets/Tools/SingleInstanceChecker.h +75 -0
- package/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -0
- package/Common/cpp/worklets/Tools/UIScheduler.cpp +19 -0
- package/Common/cpp/worklets/Tools/UIScheduler.h +22 -0
- package/Common/cpp/worklets/Tools/VersionUtils.cpp +61 -0
- package/Common/cpp/worklets/Tools/VersionUtils.h +24 -0
- package/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +34 -0
- package/Common/cpp/worklets/Tools/WorkletEventHandler.h +44 -0
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.cpp +30 -0
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +222 -0
- package/Common/cpp/worklets/Tools/WorkletsSystraceSection.h +116 -0
- package/Common/cpp/worklets/Tools/WorkletsVersion.cpp +46 -0
- package/Common/cpp/worklets/Tools/WorkletsVersion.h +18 -0
- package/Common/cpp/worklets/WorkletRuntime/BundleModeConfig.h +17 -0
- package/Common/cpp/worklets/WorkletRuntime/HermesProfiling.cpp +45 -0
- package/Common/cpp/worklets/WorkletRuntime/HermesProfiling.h +12 -0
- package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +68 -0
- package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +24 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeBindings.h +59 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeData.h +38 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeHolder.h +19 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.cpp +122 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.h +75 -0
- package/Common/cpp/worklets/WorkletRuntime/ScriptLoader.h +116 -0
- package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.cpp +14 -0
- package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.h +15 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.cpp +58 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.h +100 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +327 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +256 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +320 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +36 -0
- package/LICENSE +20 -0
- package/README.md +43 -0
- package/RNWorklets.podspec +94 -0
- package/android/CMakeLists.txt +108 -0
- package/android/build.gradle.kts +369 -0
- package/android/fix-prefab.gradle.kts +56 -0
- package/android/generate-stub-pch.gradle.kts +84 -0
- package/android/gradle.properties +25 -0
- package/android/proguard-rules.pro +3 -0
- package/android/settings.gradle.kts +21 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/WorkletsPCH.h +26 -0
- package/android/src/main/cpp/worklets/android/AndroidUIScheduler.cpp +66 -0
- package/android/src/main/cpp/worklets/android/AndroidUIScheduler.h +38 -0
- package/android/src/main/cpp/worklets/android/AnimationFrameCallback.h +30 -0
- package/android/src/main/cpp/worklets/android/JScriptBufferWrapper.cpp +66 -0
- package/android/src/main/cpp/worklets/android/JScriptBufferWrapper.h +48 -0
- package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.cpp +51 -0
- package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.h +43 -0
- package/android/src/main/cpp/worklets/android/PlatformLogger.cpp +31 -0
- package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +203 -0
- package/android/src/main/cpp/worklets/android/WorkletsModule.h +75 -0
- package/android/src/main/cpp/worklets/android/WorkletsOnLoad.cpp +19 -0
- package/android/src/main/java/com/swmansion/worklets/AndroidUIScheduler.kt +56 -0
- package/android/src/main/java/com/swmansion/worklets/ScriptBufferWrapper.kt +103 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsPackage.kt +42 -0
- package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameCallback.kt +14 -0
- package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameQueue.kt +112 -0
- package/android/src/networking/com/swmansion/worklets/WorkletRuntimeWrapper.kt +27 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsHeaderUtil.kt +30 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsModule.kt +187 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsNetworkEventUtil.kt +272 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsNetworking.kt +1124 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsOkHttpCallUtil.kt +40 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressListener.kt +13 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressRequestBody.kt +98 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressResponseBody.kt +60 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressiveStringDecoder.kt +87 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsRequestBodyUtil.kt +181 -0
- package/android/src/no-networking/com/swmansion/worklets/WorkletsModule.kt +143 -0
- package/apple/worklets/apple/AnimationFrameQueue.h +15 -0
- package/apple/worklets/apple/AnimationFrameQueue.mm +145 -0
- package/apple/worklets/apple/AssertJavaScriptQueue.h +14 -0
- package/apple/worklets/apple/AssertTurboModuleManagerQueue.h +12 -0
- package/apple/worklets/apple/IOSUIScheduler.h +14 -0
- package/apple/worklets/apple/IOSUIScheduler.mm +29 -0
- package/apple/worklets/apple/Networking/WorkletsNetworking.h +25 -0
- package/apple/worklets/apple/Networking/WorkletsNetworking.mm +707 -0
- package/apple/worklets/apple/PlatformLogger.mm +31 -0
- package/apple/worklets/apple/SlowAnimations.h +8 -0
- package/apple/worklets/apple/SlowAnimations.mm +45 -0
- package/apple/worklets/apple/WorkletsDisplayLink.h +21 -0
- package/apple/worklets/apple/WorkletsModule.h +28 -0
- package/apple/worklets/apple/WorkletsModule.mm +177 -0
- package/bundleMode/index.d.ts +6 -0
- package/bundleMode/index.js +182 -0
- package/bundleMode/shims/reactNativeShim.js +21 -0
- package/bundleMode/shims/turboModuleRegistryShim.js +47 -0
- package/changes.json +58 -0
- package/compatibility.json +29 -0
- package/jest/pluginTestUtils.ts +16 -0
- package/jest/resolver.js +18 -0
- package/lib/module/WorkletsModule/NativeWorklets.js +4 -0
- package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -0
- package/lib/module/WorkletsModule/NativeWorklets.native.js +199 -0
- package/lib/module/WorkletsModule/NativeWorklets.native.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js +4 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js.map +1 -0
- package/lib/module/bundleMode/metroOverrides.native.js +26 -0
- package/lib/module/bundleMode/metroOverrides.native.js.map +1 -0
- package/lib/module/bundleMode/network.native.js +44 -0
- package/lib/module/bundleMode/network.native.js.map +1 -0
- package/lib/module/debug/bundleMode.js +6 -0
- package/lib/module/debug/bundleMode.js.map +1 -0
- package/lib/module/debug/bundleMode.native.js +11 -0
- package/lib/module/debug/bundleMode.native.js.map +1 -0
- package/lib/module/debug/checkCppVersion.js +29 -0
- package/lib/module/debug/checkCppVersion.js.map +1 -0
- package/lib/module/debug/errors.native.js +67 -0
- package/lib/module/debug/errors.native.js.map +1 -0
- package/lib/module/debug/jsVersion.js +9 -0
- package/lib/module/debug/jsVersion.js.map +1 -0
- package/lib/module/debug/logger.js +15 -0
- package/lib/module/debug/logger.js.map +1 -0
- package/lib/module/debug/slowAnimations.js +7 -0
- package/lib/module/debug/slowAnimations.js.map +1 -0
- package/lib/module/debug/slowAnimations.native.js +17 -0
- package/lib/module/debug/slowAnimations.native.js.map +1 -0
- package/lib/module/deprecated.js +27 -0
- package/lib/module/deprecated.js.map +1 -0
- package/lib/module/featureFlags/featureFlags.js +12 -0
- package/lib/module/featureFlags/featureFlags.js.map +1 -0
- package/lib/module/featureFlags/featureFlags.native.js +51 -0
- package/lib/module/featureFlags/featureFlags.native.js.map +1 -0
- package/lib/module/featureFlags/staticFlags.json +6 -0
- package/lib/module/featureFlags/types.js +16 -0
- package/lib/module/featureFlags/types.js.map +1 -0
- package/lib/module/guardImplementation.native.js +17 -0
- package/lib/module/guardImplementation.native.js.map +1 -0
- package/lib/module/index.js +26 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initializers/initializers.js +24 -0
- package/lib/module/initializers/initializers.js.map +1 -0
- package/lib/module/initializers/initializers.native.js +195 -0
- package/lib/module/initializers/initializers.native.js.map +1 -0
- package/lib/module/memory/bundleUnpacker.native.js +38 -0
- package/lib/module/memory/bundleUnpacker.native.js.map +1 -0
- package/lib/module/memory/customSerializableUnpacker.native.js +20 -0
- package/lib/module/memory/customSerializableUnpacker.native.js.map +1 -0
- package/lib/module/memory/isShareable.js +8 -0
- package/lib/module/memory/isShareable.js.map +1 -0
- package/lib/module/memory/isSynchronizable.js +8 -0
- package/lib/module/memory/isSynchronizable.js.map +1 -0
- package/lib/module/memory/remoteFunctionUnpacker.native.js +18 -0
- package/lib/module/memory/remoteFunctionUnpacker.native.js.map +1 -0
- package/lib/module/memory/serializable.js +18 -0
- package/lib/module/memory/serializable.js.map +1 -0
- package/lib/module/memory/serializable.native.js +619 -0
- package/lib/module/memory/serializable.native.js.map +1 -0
- package/lib/module/memory/serializableMappingCache.js +11 -0
- package/lib/module/memory/serializableMappingCache.js.map +1 -0
- package/lib/module/memory/serializableMappingCache.native.js +29 -0
- package/lib/module/memory/serializableMappingCache.native.js.map +1 -0
- package/lib/module/memory/shareable.js +18 -0
- package/lib/module/memory/shareable.js.map +1 -0
- package/lib/module/memory/shareable.native.js +42 -0
- package/lib/module/memory/shareable.native.js.map +1 -0
- package/lib/module/memory/shareableGuestUnpacker.native.js +105 -0
- package/lib/module/memory/shareableGuestUnpacker.native.js.map +1 -0
- package/lib/module/memory/shareableHostUnpacker.native.js +20 -0
- package/lib/module/memory/shareableHostUnpacker.native.js.map +1 -0
- package/lib/module/memory/synchronizable.js +6 -0
- package/lib/module/memory/synchronizable.js.map +1 -0
- package/lib/module/memory/synchronizable.native.js +9 -0
- package/lib/module/memory/synchronizable.native.js.map +1 -0
- package/lib/module/memory/synchronizableUnpacker.native.js +47 -0
- package/lib/module/memory/synchronizableUnpacker.native.js.map +1 -0
- package/lib/module/memory/types.js +12 -0
- package/lib/module/memory/types.js.map +1 -0
- package/lib/module/memory/valueUnpacker.native.js +52 -0
- package/lib/module/memory/valueUnpacker.native.js.map +1 -0
- package/lib/module/mock.js +85 -0
- package/lib/module/mock.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/platformChecker.js +4 -0
- package/lib/module/platformChecker.js.map +1 -0
- package/lib/module/platformChecker.native.js +4 -0
- package/lib/module/platformChecker.native.js.map +1 -0
- package/lib/module/privateGlobals.d.js +7 -0
- package/lib/module/privateGlobals.d.js.map +1 -0
- package/lib/module/runLoop/common/setImmediatePolyfill.js +15 -0
- package/lib/module/runLoop/common/setImmediatePolyfill.js.map +1 -0
- package/lib/module/runLoop/common/setIntervalPolyfill.js +26 -0
- package/lib/module/runLoop/common/setIntervalPolyfill.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js +10 -0
- package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js +71 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js +32 -0
- package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/index.js +19 -0
- package/lib/module/runLoop/workletRuntime/index.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js +11 -0
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js +48 -0
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/setTimeout.js +28 -0
- package/lib/module/runLoop/workletRuntime/setTimeout.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/taskQueue.js +37 -0
- package/lib/module/runLoop/workletRuntime/taskQueue.js.map +1 -0
- package/lib/module/runtimeKind.js +92 -0
- package/lib/module/runtimeKind.js.map +1 -0
- package/lib/module/runtimes.js +36 -0
- package/lib/module/runtimes.js.map +1 -0
- package/lib/module/runtimes.native.js +379 -0
- package/lib/module/runtimes.native.js.map +1 -0
- package/lib/module/specs/NativeWorkletsModule.js +5 -0
- package/lib/module/specs/NativeWorkletsModule.js.map +1 -0
- package/lib/module/specs/index.js +10 -0
- package/lib/module/specs/index.js.map +1 -0
- package/lib/module/threads.js +60 -0
- package/lib/module/threads.js.map +1 -0
- package/lib/module/threads.native.js +295 -0
- package/lib/module/threads.native.js.map +1 -0
- package/lib/module/types.js +5 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/workletFunction.js +36 -0
- package/lib/module/workletFunction.js.map +1 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +3 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts +3 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +59 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -0
- package/lib/typescript/bundleMode/metroOverrides.native.d.ts +9 -0
- package/lib/typescript/bundleMode/metroOverrides.native.d.ts.map +1 -0
- package/lib/typescript/bundleMode/network.native.d.ts +7 -0
- package/lib/typescript/bundleMode/network.native.d.ts.map +1 -0
- package/lib/typescript/debug/bundleMode.d.ts +2 -0
- package/lib/typescript/debug/bundleMode.d.ts.map +1 -0
- package/lib/typescript/debug/bundleMode.native.d.ts +2 -0
- package/lib/typescript/debug/bundleMode.native.d.ts.map +1 -0
- package/lib/typescript/debug/checkCppVersion.d.ts +3 -0
- package/lib/typescript/debug/checkCppVersion.d.ts.map +1 -0
- package/lib/typescript/debug/errors.native.d.ts +13 -0
- package/lib/typescript/debug/errors.native.d.ts.map +1 -0
- package/lib/typescript/debug/jsVersion.d.ts +7 -0
- package/lib/typescript/debug/jsVersion.d.ts.map +1 -0
- package/lib/typescript/debug/logger.d.ts +5 -0
- package/lib/typescript/debug/logger.d.ts.map +1 -0
- package/lib/typescript/debug/slowAnimations.d.ts +2 -0
- package/lib/typescript/debug/slowAnimations.d.ts.map +1 -0
- package/lib/typescript/debug/slowAnimations.native.d.ts +11 -0
- package/lib/typescript/debug/slowAnimations.native.d.ts.map +1 -0
- package/lib/typescript/deprecated.d.ts +19 -0
- package/lib/typescript/deprecated.d.ts.map +1 -0
- package/lib/typescript/featureFlags/featureFlags.d.ts +5 -0
- package/lib/typescript/featureFlags/featureFlags.d.ts.map +1 -0
- package/lib/typescript/featureFlags/featureFlags.native.d.ts +6 -0
- package/lib/typescript/featureFlags/featureFlags.native.d.ts.map +1 -0
- package/lib/typescript/featureFlags/types.d.ts +23 -0
- package/lib/typescript/featureFlags/types.d.ts.map +1 -0
- package/lib/typescript/guardImplementation.native.d.ts +3 -0
- package/lib/typescript/guardImplementation.native.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +19 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/initializers/initializers.d.ts +2 -0
- package/lib/typescript/initializers/initializers.d.ts.map +1 -0
- package/lib/typescript/initializers/initializers.native.d.ts +19 -0
- package/lib/typescript/initializers/initializers.native.d.ts.map +1 -0
- package/lib/typescript/memory/bundleUnpacker.native.d.ts +7 -0
- package/lib/typescript/memory/bundleUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/customSerializableUnpacker.native.d.ts +3 -0
- package/lib/typescript/memory/customSerializableUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/isShareable.d.ts +3 -0
- package/lib/typescript/memory/isShareable.d.ts.map +1 -0
- package/lib/typescript/memory/isSynchronizable.d.ts +3 -0
- package/lib/typescript/memory/isSynchronizable.d.ts.map +1 -0
- package/lib/typescript/memory/remoteFunctionUnpacker.native.d.ts +3 -0
- package/lib/typescript/memory/remoteFunctionUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/serializable.d.ts +7 -0
- package/lib/typescript/memory/serializable.d.ts.map +1 -0
- package/lib/typescript/memory/serializable.native.d.ts +37 -0
- package/lib/typescript/memory/serializable.native.d.ts.map +1 -0
- package/lib/typescript/memory/serializableMappingCache.d.ts +6 -0
- package/lib/typescript/memory/serializableMappingCache.d.ts.map +1 -0
- package/lib/typescript/memory/serializableMappingCache.native.d.ts +13 -0
- package/lib/typescript/memory/serializableMappingCache.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareable.d.ts +15 -0
- package/lib/typescript/memory/shareable.d.ts.map +1 -0
- package/lib/typescript/memory/shareable.native.d.ts +15 -0
- package/lib/typescript/memory/shareable.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareableHostUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/shareableHostUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizable.d.ts +3 -0
- package/lib/typescript/memory/synchronizable.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizable.native.d.ts +3 -0
- package/lib/typescript/memory/synchronizable.native.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizableUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/synchronizableUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/types.d.ts +136 -0
- package/lib/typescript/memory/types.d.ts.map +1 -0
- package/lib/typescript/memory/valueUnpacker.native.d.ts +7 -0
- package/lib/typescript/memory/valueUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/mock.d.ts +2 -0
- package/lib/typescript/mock.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/platformChecker.d.ts +2 -0
- package/lib/typescript/platformChecker.d.ts.map +1 -0
- package/lib/typescript/platformChecker.native.d.ts +2 -0
- package/lib/typescript/platformChecker.native.d.ts.map +1 -0
- package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts +6 -0
- package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts +2 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/index.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/index.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts +10 -0
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts.map +1 -0
- package/lib/typescript/runtimeKind.d.ts +56 -0
- package/lib/typescript/runtimeKind.d.ts.map +1 -0
- package/lib/typescript/runtimes.d.ts +15 -0
- package/lib/typescript/runtimes.d.ts.map +1 -0
- package/lib/typescript/runtimes.native.d.ts +155 -0
- package/lib/typescript/runtimes.native.d.ts.map +1 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts +9 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -0
- package/lib/typescript/specs/index.d.ts +3 -0
- package/lib/typescript/specs/index.d.ts.map +1 -0
- package/lib/typescript/threads.d.ts +8 -0
- package/lib/typescript/threads.d.ts.map +1 -0
- package/lib/typescript/threads.native.d.ts +125 -0
- package/lib/typescript/threads.native.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +136 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/workletFunction.d.ts +26 -0
- package/lib/typescript/workletFunction.d.ts.map +1 -0
- package/package.json +220 -0
- package/plugin/index.d.ts +168 -0
- package/plugin/index.js +2188 -0
- package/scripts/validate-react-native-version.js +43 -0
- package/scripts/worklets_utils.rb +94 -0
- package/src/WorkletsModule/NativeWorklets.native.ts +461 -0
- package/src/WorkletsModule/NativeWorklets.ts +5 -0
- package/src/WorkletsModule/workletsModuleProxy.ts +247 -0
- package/src/bundleMode/metroOverrides.native.ts +33 -0
- package/src/bundleMode/network.native.ts +63 -0
- package/src/debug/bundleMode.native.ts +18 -0
- package/src/debug/bundleMode.ts +5 -0
- package/src/debug/checkCppVersion.ts +34 -0
- package/src/debug/errors.native.ts +74 -0
- package/src/debug/jsVersion.ts +8 -0
- package/src/debug/logger.ts +16 -0
- package/src/debug/slowAnimations.native.ts +15 -0
- package/src/debug/slowAnimations.ts +6 -0
- package/src/deprecated.ts +38 -0
- package/src/featureFlags/featureFlags.native.ts +70 -0
- package/src/featureFlags/featureFlags.ts +20 -0
- package/src/featureFlags/staticFlags.json +6 -0
- package/src/featureFlags/types.ts +32 -0
- package/src/guardImplementation.native.ts +26 -0
- package/src/index.ts +95 -0
- package/src/initializers/initializers.native.ts +218 -0
- package/src/initializers/initializers.ts +24 -0
- package/src/memory/bundleUnpacker.native.ts +59 -0
- package/src/memory/customSerializableUnpacker.native.ts +30 -0
- package/src/memory/isShareable.ts +16 -0
- package/src/memory/isSynchronizable.ts +14 -0
- package/src/memory/remoteFunctionUnpacker.native.ts +27 -0
- package/src/memory/serializable.native.ts +889 -0
- package/src/memory/serializable.ts +36 -0
- package/src/memory/serializableMappingCache.native.ts +37 -0
- package/src/memory/serializableMappingCache.ts +12 -0
- package/src/memory/shareable.native.ts +68 -0
- package/src/memory/shareable.ts +27 -0
- package/src/memory/shareableGuestUnpacker.native.ts +168 -0
- package/src/memory/shareableHostUnpacker.native.ts +31 -0
- package/src/memory/synchronizable.native.ts +17 -0
- package/src/memory/synchronizable.ts +9 -0
- package/src/memory/synchronizableUnpacker.native.ts +65 -0
- package/src/memory/types.ts +191 -0
- package/src/memory/valueUnpacker.native.ts +79 -0
- package/src/mock.ts +111 -0
- package/src/platformChecker.native.ts +3 -0
- package/src/platformChecker.ts +4 -0
- package/src/privateGlobals.d.ts +127 -0
- package/src/runLoop/common/setImmediatePolyfill.ts +20 -0
- package/src/runLoop/common/setIntervalPolyfill.ts +38 -0
- package/src/runLoop/uiRuntime/mockedRequestAnimationFrame.ts +11 -0
- package/src/runLoop/uiRuntime/requestAnimationFrame.ts +87 -0
- package/src/runLoop/uiRuntime/setTimeoutPolyfill.ts +40 -0
- package/src/runLoop/workletRuntime/index.ts +18 -0
- package/src/runLoop/workletRuntime/queueMicrotask.ts +13 -0
- package/src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts +61 -0
- package/src/runLoop/workletRuntime/setTimeout.ts +37 -0
- package/src/runLoop/workletRuntime/taskQueue.ts +44 -0
- package/src/runtimeKind.ts +85 -0
- package/src/runtimes.native.ts +572 -0
- package/src/runtimes.ts +107 -0
- package/src/specs/NativeWorkletsModule.ts +11 -0
- package/src/specs/index.ts +13 -0
- package/src/threads.native.ts +408 -0
- package/src/threads.ts +110 -0
- package/src/types.ts +164 -0
- package/src/workletFunction.ts +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @depup/react-native-worklets
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [react-native-worklets](https://www.npmjs.com/package/react-native-worklets)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/react-native-worklets
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [react-native-worklets](https://www.npmjs.com/package/react-native-worklets) @ 0.11.3 |
|
|
17
|
+
| Processed | 2026-07-26 |
|
|
18
|
+
| Smoke test | failed |
|
|
19
|
+
| Deps updated | 13 |
|
|
20
|
+
|
|
21
|
+
## Dependency Changes
|
|
22
|
+
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| @babel/generator | ^7.27.1 | ^8.0.0 |
|
|
26
|
+
| @babel/plugin-transform-arrow-functions | ^7.27.1 | ^8.0.1 |
|
|
27
|
+
| @babel/plugin-transform-class-properties | ^7.28.6 | ^8.0.1 |
|
|
28
|
+
| @babel/plugin-transform-classes | ^7.28.6 | ^8.0.1 |
|
|
29
|
+
| @babel/plugin-transform-nullish-coalescing-operator | ^7.28.6 | ^8.0.1 |
|
|
30
|
+
| @babel/plugin-transform-optional-chaining | ^7.28.6 | ^8.0.1 |
|
|
31
|
+
| @babel/plugin-transform-shorthand-properties | ^7.27.1 | ^8.0.1 |
|
|
32
|
+
| @babel/plugin-transform-template-literals | ^7.27.1 | ^8.0.1 |
|
|
33
|
+
| @babel/plugin-transform-unicode-regex | ^7.27.1 | ^8.0.1 |
|
|
34
|
+
| @babel/preset-typescript | ^7.28.5 | ^8.0.1 |
|
|
35
|
+
| @babel/traverse | ^7.27.1 | ^8.0.4 |
|
|
36
|
+
| @babel/types | ^7.27.1 | ^8.0.4 |
|
|
37
|
+
| semver | ^7.7.4 | ^7.8.5 |
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/react-native-worklets
|
|
42
|
+
|
|
43
|
+
License inherited from the original package.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require_relative './scripts/worklets_utils'
|
|
3
|
+
|
|
4
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
5
|
+
worklets_config = WorkletsUtils.find_config()
|
|
6
|
+
WorkletsUtils.assert_minimal_react_native_version(worklets_config)
|
|
7
|
+
|
|
8
|
+
ios_min_version = '13.4'
|
|
9
|
+
|
|
10
|
+
# Directory in which data for further processing for clangd will be stored.
|
|
11
|
+
compilation_metadata_dir = "CompilationDatabase"
|
|
12
|
+
# We want generate the metadata only within the monorepo of Reanimated.
|
|
13
|
+
compilation_metadata_generation_flag = worklets_config[:is_reanimated_example_app] ? "-gen-cdb-fragment-path #{compilation_metadata_dir}" : ''
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
feature_flags = worklets_config[:feature_flags_flag]
|
|
17
|
+
version_flag = "-DWORKLETS_VERSION=#{package['version']}"
|
|
18
|
+
worklets_profiling_flag = ENV['IS_WORKLETS_PROFILING'] ? '-DWORKLETS_PROFILING' : ''
|
|
19
|
+
fetch_preview_flag = worklets_config[:fetch_preview_flag]
|
|
20
|
+
hermes_v1_flag = ENV['RCT_HERMES_V1_ENABLED'] == '1' ? '-DHERMES_V1_ENABLED' : ''
|
|
21
|
+
|
|
22
|
+
# React Native doesn't expose these flags, but not having them
|
|
23
|
+
# can lead to runtime errors due to ABI mismatches.
|
|
24
|
+
# There's also
|
|
25
|
+
# HERMESVM_PROFILER_OPCODE
|
|
26
|
+
# HERMESVM_PROFILER_BB
|
|
27
|
+
# which shouldn't be defined in standard setups.
|
|
28
|
+
hermes_debug_hidden_flags = 'HERMES_ENABLE_DEBUGGER=1'
|
|
29
|
+
|
|
30
|
+
Pod::Spec.new do |s|
|
|
31
|
+
s.name = "RNWorklets"
|
|
32
|
+
s.version = package["version"]
|
|
33
|
+
s.summary = package["description"]
|
|
34
|
+
s.homepage = "https://github.com/software-mansion/react-native-reanimated"
|
|
35
|
+
s.license = package["license"]
|
|
36
|
+
s.authors = { "author" => "author@domain.com" }
|
|
37
|
+
s.platforms = { :ios => ios_min_version, :tvos => "9.0", :osx => "10.14", :visionos => "1.0" }
|
|
38
|
+
s.source = { :git => "https://github.com/software-mansion/react-native-reanimated.git", :tag => "#{s.version}" }
|
|
39
|
+
|
|
40
|
+
s.header_dir = "worklets"
|
|
41
|
+
|
|
42
|
+
s.subspec "common" do |ss|
|
|
43
|
+
ss.source_files = "Common/cpp/worklets/**/*.{cpp,h}"
|
|
44
|
+
ss.public_header_files = "Common/cpp/worklets/**/*.h"
|
|
45
|
+
ss.header_mappings_dir = "Common/cpp/worklets"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
s.subspec "apple" do |ss|
|
|
49
|
+
ss.source_files = "apple/worklets/**/*.{mm,h,m}"
|
|
50
|
+
ss.public_header_files = "apple/worklets/**/*.h"
|
|
51
|
+
ss.header_mappings_dir = "apple/worklets"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Use install_modules_dependencies helper to install the dependencies.
|
|
55
|
+
# See https://github.com/facebook/react-native/blob/c925872e72d2422be46670777bfa2111e13c9e4c/packages/react-native/scripts/cocoapods/new_architecture.rb#L71.
|
|
56
|
+
install_modules_dependencies(s)
|
|
57
|
+
|
|
58
|
+
s.dependency 'React-jsi'
|
|
59
|
+
s.dependency 'React-hermes'
|
|
60
|
+
s.pod_target_xcconfig = {
|
|
61
|
+
"USE_HEADERMAP" => "YES",
|
|
62
|
+
"DEFINES_MODULE" => "YES",
|
|
63
|
+
"HEADER_SEARCH_PATHS" => [
|
|
64
|
+
'"$(PODS_TARGET_SRCROOT)/ReactCommon"',
|
|
65
|
+
'"$(PODS_TARGET_SRCROOT)"',
|
|
66
|
+
'"$(PODS_ROOT)/RCT-Folly"',
|
|
67
|
+
'"$(PODS_ROOT)/boost"',
|
|
68
|
+
'"$(PODS_ROOT)/boost-for-react-native"',
|
|
69
|
+
'"$(PODS_ROOT)/DoubleConversion"',
|
|
70
|
+
'"$(PODS_ROOT)/Headers/Private/React-Core"',
|
|
71
|
+
'"$(PODS_ROOT)/Headers/Private/Yoga"',
|
|
72
|
+
'"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers/react/utils/platform/ios"',
|
|
73
|
+
].join(' '),
|
|
74
|
+
"FRAMEWORK_SEARCH_PATHS" => '"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes"',
|
|
75
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
76
|
+
"GCC_PREPROCESSOR_DEFINITIONS[config=*Debug*]" => "$(inherited) #{hermes_debug_hidden_flags}",
|
|
77
|
+
"GCC_PREPROCESSOR_DEFINITIONS[config=*Release*]" => "$(inherited)",
|
|
78
|
+
"OTHER_CFLAGS" => "$(inherited) #{feature_flags} #{version_flag} #{compilation_metadata_generation_flag} #{worklets_profiling_flag} #{fetch_preview_flag} #{hermes_v1_flag}",
|
|
79
|
+
}
|
|
80
|
+
s.xcconfig = {
|
|
81
|
+
"HEADER_SEARCH_PATHS" => [
|
|
82
|
+
'"$(PODS_ROOT)/boost"',
|
|
83
|
+
'"$(PODS_ROOT)/boost-for-react-native"',
|
|
84
|
+
'"$(PODS_ROOT)/glog"',
|
|
85
|
+
'"$(PODS_ROOT)/RCT-Folly"',
|
|
86
|
+
'"$(PODS_ROOT)/Headers/Public/React-hermes"',
|
|
87
|
+
'"$(PODS_ROOT)/Headers/Public/hermes-engine"',
|
|
88
|
+
# for static frameworks
|
|
89
|
+
"\"$(PODS_ROOT)/#{worklets_config[:react_native_common_dir]}\"",
|
|
90
|
+
"\"$(PODS_ROOT)/#{worklets_config[:react_native_common_dir]}/jsitooling\"",
|
|
91
|
+
].join(' '),
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
end
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
project(Worklets)
|
|
2
|
+
cmake_minimum_required(VERSION 3.16)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
5
|
+
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
# Consume shared libraries and headers from prefabs
|
|
9
|
+
find_package(fbjni REQUIRED CONFIG)
|
|
10
|
+
find_package(ReactAndroid REQUIRED CONFIG)
|
|
11
|
+
find_package(hermes-engine REQUIRED CONFIG)
|
|
12
|
+
|
|
13
|
+
# default CMAKE_CXX_FLAGS: "-g -DANDROID -fdata-sections -ffunction-sections
|
|
14
|
+
# -funwind-tables -fstack-protector-strong -no-canonical-prefixes
|
|
15
|
+
# -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-protector-all"
|
|
16
|
+
include("${REACT_NATIVE_DIR}/ReactAndroid/cmake-utils/folly-flags.cmake")
|
|
17
|
+
add_compile_options(${folly_FLAGS})
|
|
18
|
+
|
|
19
|
+
string(APPEND CMAKE_CXX_FLAGS " -DWORKLETS_VERSION=${WORKLETS_VERSION}\
|
|
20
|
+
-DWORKLETS_FEATURE_FLAGS=\"${WORKLETS_FEATURE_FLAGS}\"")
|
|
21
|
+
|
|
22
|
+
# HERMES_V1_ENABLED is centralized in react-native-flags.cmake for RN >= 84.
|
|
23
|
+
# Only define manually for older versions to avoid macro redefinition error.
|
|
24
|
+
if(ReactAndroid_VERSION_MINOR LESS 84)
|
|
25
|
+
string(APPEND CMAKE_CXX_FLAGS " -DHERMES_V1_ENABLED=${HERMES_V1_ENABLED}")
|
|
26
|
+
else()
|
|
27
|
+
# Reference the value so CMake records it as used, otherwise it warns:
|
|
28
|
+
# "Manually-specified variables were not used by the project:
|
|
29
|
+
# HERMES_V1_ENABLED"
|
|
30
|
+
set(HERMES_V1_ENABLED "${HERMES_V1_ENABLED}")
|
|
31
|
+
endif()
|
|
32
|
+
|
|
33
|
+
string(APPEND CMAKE_CXX_FLAGS " -fno-omit-frame-pointer -fstack-protector-all")
|
|
34
|
+
|
|
35
|
+
if(${WORKLETS_PROFILING})
|
|
36
|
+
string(APPEND CMAKE_CXX_FLAGS " -DWORKLETS_PROFILING")
|
|
37
|
+
endif()
|
|
38
|
+
if(${IS_REANIMATED_EXAMPLE_APP})
|
|
39
|
+
string(APPEND CMAKE_CXX_FLAGS " -DIS_REANIMATED_EXAMPLE_APP -Wpedantic")
|
|
40
|
+
endif()
|
|
41
|
+
if(${WORKLETS_FETCH_PREVIEW_ENABLED})
|
|
42
|
+
string(APPEND CMAKE_CXX_FLAGS " -DWORKLETS_FETCH_PREVIEW_ENABLED")
|
|
43
|
+
endif()
|
|
44
|
+
|
|
45
|
+
if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
|
46
|
+
string(APPEND CMAKE_CXX_FLAGS " -DNDEBUG")
|
|
47
|
+
endif()
|
|
48
|
+
|
|
49
|
+
set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build")
|
|
50
|
+
set(ANDROID_CPP_DIR "${CMAKE_SOURCE_DIR}/src/main/cpp")
|
|
51
|
+
set(COMMON_CPP_DIR "${CMAKE_SOURCE_DIR}/../Common/cpp")
|
|
52
|
+
|
|
53
|
+
file(GLOB_RECURSE WORKLETS_COMMON_CPP_SOURCES CONFIGURE_DEPENDS
|
|
54
|
+
"${COMMON_CPP_DIR}/worklets/*.cpp")
|
|
55
|
+
file(GLOB_RECURSE WORKLETS_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS
|
|
56
|
+
"${ANDROID_CPP_DIR}/worklets/*.cpp")
|
|
57
|
+
|
|
58
|
+
add_library(worklets SHARED ${WORKLETS_COMMON_CPP_SOURCES}
|
|
59
|
+
${WORKLETS_ANDROID_CPP_SOURCES})
|
|
60
|
+
|
|
61
|
+
target_precompile_headers(worklets PRIVATE "${ANDROID_CPP_DIR}/WorkletsPCH.h")
|
|
62
|
+
|
|
63
|
+
# Stop Clang from embedding a build timestamp in the .pch. Without this the PCH
|
|
64
|
+
# is non-reproducible across builds, so ccache can't reuse it and translation
|
|
65
|
+
# units reject a restored PCH as "modified since built".
|
|
66
|
+
target_compile_options(
|
|
67
|
+
worklets PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Xclang;-fno-pch-timestamp>")
|
|
68
|
+
|
|
69
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 80)
|
|
70
|
+
include(
|
|
71
|
+
"${REACT_NATIVE_DIR}/ReactCommon/cmake-utils/react-native-flags.cmake")
|
|
72
|
+
target_compile_reactnative_options(worklets PUBLIC)
|
|
73
|
+
else()
|
|
74
|
+
string(APPEND CMAKE_CXX_FLAGS
|
|
75
|
+
" -fexceptions -frtti -std=c++${CMAKE_CXX_STANDARD} -Wall -Werror")
|
|
76
|
+
endif()
|
|
77
|
+
|
|
78
|
+
# includes
|
|
79
|
+
target_include_directories(worklets PUBLIC "${COMMON_CPP_DIR}"
|
|
80
|
+
"${ANDROID_CPP_DIR}")
|
|
81
|
+
|
|
82
|
+
target_include_directories(
|
|
83
|
+
worklets
|
|
84
|
+
PRIVATE "${REACT_NATIVE_DIR}/ReactCommon"
|
|
85
|
+
"${REACT_NATIVE_DIR}/ReactCommon/yoga"
|
|
86
|
+
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule"
|
|
87
|
+
"${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core/ReactCommon"
|
|
88
|
+
"${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
|
|
89
|
+
"${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor"
|
|
90
|
+
"${REACT_NATIVE_DIR}/ReactCommon/jsiexecutor"
|
|
91
|
+
"${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx"
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# build shared lib
|
|
95
|
+
set_target_properties(worklets PROPERTIES LINKER_LANGUAGE CXX)
|
|
96
|
+
|
|
97
|
+
target_link_libraries(worklets android log ReactAndroid::reactnative
|
|
98
|
+
ReactAndroid::jsi fbjni::fbjni)
|
|
99
|
+
|
|
100
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 82)
|
|
101
|
+
target_link_libraries(worklets hermes-engine::hermesvm)
|
|
102
|
+
else()
|
|
103
|
+
target_link_libraries(worklets hermes-engine::libhermes)
|
|
104
|
+
endif()
|
|
105
|
+
|
|
106
|
+
if(${HERMES_ENABLE_DEBUGGER})
|
|
107
|
+
string(APPEND CMAKE_CXX_FLAGS " -DHERMES_ENABLE_DEBUGGER=1")
|
|
108
|
+
endif()
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
import org.apache.tools.ant.taskdefs.condition.Os
|
|
3
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
4
|
+
import java.util.Properties
|
|
5
|
+
import javax.inject.Inject
|
|
6
|
+
|
|
7
|
+
plugins {
|
|
8
|
+
id("com.android.library")
|
|
9
|
+
id("maven-publish")
|
|
10
|
+
id("com.diffplug.spotless") version "8.1.0"
|
|
11
|
+
id("org.jetbrains.kotlin.android")
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fun safeExtGet(prop: String, fallback: Any?): Any? =
|
|
15
|
+
if (rootProject.extensions.extraProperties.has(prop)) rootProject.extensions.extraProperties.get(prop) else fallback
|
|
16
|
+
|
|
17
|
+
fun safeAppExtGet(prop: String, fallback: Any?): Any? {
|
|
18
|
+
val appProject = rootProject.allprojects.find { it.plugins.hasPlugin("com.android.application") }
|
|
19
|
+
return if (appProject?.extensions?.extraProperties?.has(prop) == true)
|
|
20
|
+
appProject.extensions.extraProperties.get(prop)
|
|
21
|
+
else
|
|
22
|
+
fallback
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fun resolveReactNativeDirectory(): File {
|
|
26
|
+
val reactNativeLocationProperty = safeAppExtGet("REACT_NATIVE_NODE_MODULES_DIR", null)
|
|
27
|
+
if (reactNativeLocationProperty != null) {
|
|
28
|
+
return when (reactNativeLocationProperty) {
|
|
29
|
+
is File -> reactNativeLocationProperty
|
|
30
|
+
is String -> file(reactNativeLocationProperty)
|
|
31
|
+
else -> file(reactNativeLocationProperty.toString())
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Fallback to node resolver for custom directory structures like monorepos.
|
|
36
|
+
val reactNativePackage = file(
|
|
37
|
+
providers.exec {
|
|
38
|
+
workingDir(rootDir)
|
|
39
|
+
commandLine("node", "--print", "require.resolve('react-native/package.json')")
|
|
40
|
+
}.standardOutput.asText.get().trim()
|
|
41
|
+
)
|
|
42
|
+
if (reactNativePackage.exists()) {
|
|
43
|
+
return reactNativePackage.parentFile
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
throw GradleException(
|
|
47
|
+
"[Worklets] Unable to resolve react-native location in node_modules. You should set project extension property (in `app/build.gradle`) named `REACT_NATIVE_NODE_MODULES_DIR` with the path to react-native in node_modules."
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
fun getReactNativeVersion(): String {
|
|
52
|
+
val reactNativeRootDir = resolveReactNativeDirectory()
|
|
53
|
+
val reactProperties = Properties()
|
|
54
|
+
file("$reactNativeRootDir/ReactAndroid/gradle.properties").inputStream().use { reactProperties.load(it) }
|
|
55
|
+
return reactProperties.getProperty("VERSION_NAME")
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fun getReactNativeMinorVersion(): Int {
|
|
59
|
+
val reactNativeVersion = getReactNativeVersion()
|
|
60
|
+
return if (reactNativeVersion.startsWith("0.0.0-")) 1000 else reactNativeVersion.split(".")[1].toInt()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
fun getHermesV1Enabled(): Boolean {
|
|
64
|
+
// Even though `HERMES_V1_ENABLED` is now centralized
|
|
65
|
+
// in `react-native-flags.cmake` for React Native >= 0.84
|
|
66
|
+
// that CMake file depends on definitions provided
|
|
67
|
+
// in local `externalNativeBuild` configuration of the LIBRARY.
|
|
68
|
+
// I hope this is only a temporary workaround.
|
|
69
|
+
return if (getReactNativeMinorVersion() >= 84) {
|
|
70
|
+
safeAppExtGet("hermesV1Enabled", true)?.toString()?.toBoolean() ?: true
|
|
71
|
+
} else {
|
|
72
|
+
safeAppExtGet("hermesV1Enabled", false)?.toString()?.toBoolean() ?: false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
fun getWorkletsVersion(): String {
|
|
77
|
+
val inputFile = file("${projectDir.path}/../package.json")
|
|
78
|
+
val json = JsonSlurper().parseText(inputFile.readText()) as Map<*, *>
|
|
79
|
+
return json["version"]?.toString() ?: throw GradleException("[Worklets] Cannot find version in package.json")
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fun toPlatformFileString(path: String): String {
|
|
83
|
+
var result = path
|
|
84
|
+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
85
|
+
result = result.replace(File.separatorChar, '/')
|
|
86
|
+
}
|
|
87
|
+
return result
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
fun getStaticFeatureFlags(): Map<String, String> {
|
|
91
|
+
val featureFlags = HashMap<String, String>()
|
|
92
|
+
|
|
93
|
+
val staticFeatureFlagsFile = file("${projectDir.path}/../src/featureFlags/staticFlags.json")
|
|
94
|
+
if (!staticFeatureFlagsFile.exists()) {
|
|
95
|
+
throw GradleException("[Worklets] Feature flags file not found at ${staticFeatureFlagsFile.absolutePath}.")
|
|
96
|
+
}
|
|
97
|
+
(JsonSlurper().parseText(staticFeatureFlagsFile.readText()) as Map<*, *>).forEach { (key, value) ->
|
|
98
|
+
featureFlags[key.toString()] = value.toString()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
val packageJsonFile = file("${rootDir.path}/../package.json")
|
|
102
|
+
if (packageJsonFile.exists()) {
|
|
103
|
+
val packageJson = JsonSlurper().parseText(packageJsonFile.readText()) as Map<*, *>
|
|
104
|
+
(packageJson["worklets"] as? Map<*, *>)
|
|
105
|
+
?.get("staticFeatureFlags")
|
|
106
|
+
?.let { it as? Map<*, *> }
|
|
107
|
+
?.forEach { (key, value) -> featureFlags[key.toString()] = value.toString() }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return featureFlags
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
fun getStaticFeatureFlagsString(featureFlags: Map<String, String>): String =
|
|
114
|
+
featureFlags.entries.joinToString("") { (key, value) -> "[$key:$value]" }
|
|
115
|
+
|
|
116
|
+
fun isFlagEnabled(featureFlags: Map<String, String>, flagName: String): Boolean =
|
|
117
|
+
featureFlags.containsKey(flagName) && featureFlags[flagName] == "true"
|
|
118
|
+
|
|
119
|
+
if (project != rootProject) {
|
|
120
|
+
apply(plugin = "com.facebook.react")
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
val featureFlags = getStaticFeatureFlags()
|
|
124
|
+
|
|
125
|
+
val packageDir: File = project.projectDir.parentFile
|
|
126
|
+
val reactNativeRootDir: File = resolveReactNativeDirectory()
|
|
127
|
+
val REACT_NATIVE_VERSION: String = getReactNativeVersion()
|
|
128
|
+
val WORKLETS_VERSION: String = getWorkletsVersion()
|
|
129
|
+
val IS_REANIMATED_EXAMPLE_APP: Boolean = safeAppExtGet("isReanimatedExampleApp", false)?.toString()?.toBoolean() ?: false
|
|
130
|
+
val FETCH_PREVIEW_ENABLED: Boolean = isFlagEnabled(featureFlags, "FETCH_PREVIEW_ENABLED")
|
|
131
|
+
val WORKLETS_FEATURE_FLAGS: String = getStaticFeatureFlagsString(featureFlags)
|
|
132
|
+
val HERMES_V1_ENABLED: Boolean = getHermesV1Enabled()
|
|
133
|
+
val WORKLETS_PROFILING: Boolean = safeAppExtGet("enableWorkletsProfiling", false)?.toString()?.toBoolean() ?: false
|
|
134
|
+
|
|
135
|
+
// Set version for prefab
|
|
136
|
+
version = WORKLETS_VERSION
|
|
137
|
+
|
|
138
|
+
val workletsPrefabHeadersDir: File = project.file("${layout.buildDirectory.get().asFile.absolutePath}/prefab-headers/worklets")
|
|
139
|
+
|
|
140
|
+
fun reactNativeArchitectures(): List<String> {
|
|
141
|
+
val value = project.findProperty("reactNativeArchitectures") as String?
|
|
142
|
+
return value?.split(",")
|
|
143
|
+
?.map { it.trim() }
|
|
144
|
+
?.filter { it.isNotEmpty() }
|
|
145
|
+
?.ifEmpty { null }
|
|
146
|
+
?: listOf("armeabi-v7a", "x86", "x86_64", "arm64-v8a")
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (project == rootProject) {
|
|
150
|
+
spotless {
|
|
151
|
+
kotlin {
|
|
152
|
+
target("src/**/*.kt")
|
|
153
|
+
ktlint()
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
apply(from = "./fix-prefab.gradle.kts")
|
|
159
|
+
apply(from = "./generate-stub-pch.gradle.kts")
|
|
160
|
+
|
|
161
|
+
android {
|
|
162
|
+
compileSdk = safeExtGet("compileSdkVersion", 36) as Int
|
|
163
|
+
|
|
164
|
+
namespace = "com.swmansion.worklets"
|
|
165
|
+
|
|
166
|
+
val resolvedNdkPath = rootProject.findProperty("ndkPath") as? String
|
|
167
|
+
if (!resolvedNdkPath.isNullOrEmpty()) {
|
|
168
|
+
ndkPath = resolvedNdkPath
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
val resolvedNdkVersion = rootProject.findProperty("ndkVersion") as? String
|
|
172
|
+
if (!resolvedNdkVersion.isNullOrEmpty()) {
|
|
173
|
+
ndkVersion = resolvedNdkVersion
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
buildFeatures {
|
|
177
|
+
prefab = true
|
|
178
|
+
prefabPublishing = true
|
|
179
|
+
buildConfig = true
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
prefab {
|
|
183
|
+
create("worklets") {
|
|
184
|
+
headers = workletsPrefabHeadersDir.absolutePath
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
defaultConfig {
|
|
189
|
+
minSdk = safeExtGet("minSdkVersion", 24) as Int
|
|
190
|
+
testOptions.targetSdk = safeExtGet("targetSdkVersion", 36) as Int
|
|
191
|
+
lint.targetSdk = safeExtGet("targetSdkVersion", 36) as Int
|
|
192
|
+
|
|
193
|
+
buildConfigField("boolean", "WORKLETS_PROFILING", WORKLETS_PROFILING.toString())
|
|
194
|
+
buildConfigField("boolean", "IS_INTERNAL_BUILD", "false")
|
|
195
|
+
buildConfigField("int", "EXOPACKAGE_FLAGS", "0")
|
|
196
|
+
|
|
197
|
+
@Suppress("UnstableApiUsage")
|
|
198
|
+
externalNativeBuild {
|
|
199
|
+
cmake {
|
|
200
|
+
arguments(
|
|
201
|
+
"-DANDROID_STL=c++_shared",
|
|
202
|
+
"-DANDROID_TOOLCHAIN=clang",
|
|
203
|
+
"-DREACT_NATIVE_DIR=${toPlatformFileString(reactNativeRootDir.path)}",
|
|
204
|
+
"-DIS_REANIMATED_EXAMPLE_APP=$IS_REANIMATED_EXAMPLE_APP",
|
|
205
|
+
"-DWORKLETS_FETCH_PREVIEW_ENABLED=$FETCH_PREVIEW_ENABLED",
|
|
206
|
+
"-DWORKLETS_PROFILING=$WORKLETS_PROFILING",
|
|
207
|
+
"-DWORKLETS_VERSION=$WORKLETS_VERSION",
|
|
208
|
+
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
|
|
209
|
+
"-DWORKLETS_FEATURE_FLAGS=$WORKLETS_FEATURE_FLAGS",
|
|
210
|
+
"-DHERMES_V1_ENABLED=$HERMES_V1_ENABLED"
|
|
211
|
+
)
|
|
212
|
+
abiFilters.addAll(reactNativeArchitectures())
|
|
213
|
+
targets("worklets")
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
consumerProguardFiles("proguard-rules.pro")
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
externalNativeBuild {
|
|
221
|
+
cmake {
|
|
222
|
+
path = file("CMakeLists.txt")
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
buildTypes {
|
|
227
|
+
debug {
|
|
228
|
+
@Suppress("UnstableApiUsage")
|
|
229
|
+
externalNativeBuild {
|
|
230
|
+
cmake {
|
|
231
|
+
// React Native doesn't expose these flags, but not having them
|
|
232
|
+
// can lead to runtime errors due to ABI mismatches.
|
|
233
|
+
// There's also
|
|
234
|
+
// HERMESVM_PROFILER_OPCODE
|
|
235
|
+
// HERMESVM_PROFILER_BB
|
|
236
|
+
// which shouldn't be defined in standard setups.
|
|
237
|
+
arguments("-DHERMES_ENABLE_DEBUGGER=1")
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
lint {
|
|
244
|
+
abortOnError = false
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
packaging {
|
|
248
|
+
// For some reason gradle only complains about the duplicated version of librrc_root and libreact_render libraries
|
|
249
|
+
// while there are more libraries copied in intermediates folder of the lib build directory, we exclude
|
|
250
|
+
// only the ones that make the build fail (ideally we should only include libworklets but we
|
|
251
|
+
// are only allowed to specify exclude patterns)
|
|
252
|
+
resources {
|
|
253
|
+
excludes += setOf(
|
|
254
|
+
"META-INF",
|
|
255
|
+
"META-INF/**",
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
jniLibs {
|
|
259
|
+
excludes += setOf(
|
|
260
|
+
"**/libc++_shared.so",
|
|
261
|
+
"**/libfbjni.so",
|
|
262
|
+
"**/libjsi.so",
|
|
263
|
+
"**/libhermes.so",
|
|
264
|
+
"**/libhermesvm.so",
|
|
265
|
+
"**/libreactnative.so",
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
compileOptions {
|
|
271
|
+
sourceCompatibility = JavaVersion.VERSION_17
|
|
272
|
+
targetCompatibility = JavaVersion.VERSION_17
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
sourceSets {
|
|
276
|
+
getByName("main") {
|
|
277
|
+
java {
|
|
278
|
+
if (FETCH_PREVIEW_ENABLED) {
|
|
279
|
+
srcDir("src/networking")
|
|
280
|
+
} else {
|
|
281
|
+
srcDir("src/no-networking")
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (IS_REANIMATED_EXAMPLE_APP) {
|
|
288
|
+
apply(from = "../../../scripts/llvm-tools/android-hook.gradle.kts")
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (project != rootProject) {
|
|
293
|
+
kotlin {
|
|
294
|
+
compilerOptions {
|
|
295
|
+
jvmTarget = JvmTarget.fromTarget("17")
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
androidComponents {
|
|
301
|
+
onVariants(selector().withBuildType("debug")) {
|
|
302
|
+
it.packaging.jniLibs.keepDebugSymbols.add("**/**/*.so")
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
val validateReactNativeVersionResult = providers.exec {
|
|
307
|
+
workingDir(projectDir.path)
|
|
308
|
+
commandLine("node", "./../scripts/validate-react-native-version.js", REACT_NATIVE_VERSION)
|
|
309
|
+
isIgnoreExitValue = true
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
tasks.register("assertMinimalReactNativeVersionTask") {
|
|
313
|
+
val result = validateReactNativeVersionResult
|
|
314
|
+
doFirst {
|
|
315
|
+
if (result.result.get().exitValue != 0) {
|
|
316
|
+
throw GradleException(result.standardError.asText.get().trim())
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
tasks.named("preBuild") { dependsOn("assertMinimalReactNativeVersionTask") }
|
|
322
|
+
|
|
323
|
+
// Workaround for AGP 9 + Kotlin 2.x lint K2 UAST crash on .gradle.kts build scripts.
|
|
324
|
+
// See: https://issuetracker.google.com/issues/432144179
|
|
325
|
+
tasks.configureEach { if (name.startsWith("lintVital")) enabled = false }
|
|
326
|
+
|
|
327
|
+
tasks.register<Copy>("prepareWorkletsHeadersForPrefabs") {
|
|
328
|
+
from("$projectDir/src/main/cpp")
|
|
329
|
+
from("$projectDir/../Common/cpp")
|
|
330
|
+
include("worklets/**/*.h")
|
|
331
|
+
into(workletsPrefabHeadersDir.absolutePath)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface FSService {
|
|
335
|
+
@get:Inject
|
|
336
|
+
val fs: FileSystemOperations
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
tasks.register("cleanCMakeCache") {
|
|
340
|
+
val fsProvider = project.objects.newInstance<FSService>()
|
|
341
|
+
val cxxDir = file("${projectDir}/.cxx")
|
|
342
|
+
doFirst {
|
|
343
|
+
fsProvider.fs.delete {
|
|
344
|
+
delete(cxxDir)
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
repositories {
|
|
350
|
+
mavenCentral()
|
|
351
|
+
google()
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
dependencies {
|
|
355
|
+
"implementation"("com.facebook.yoga:proguard-annotations:1.19.0")
|
|
356
|
+
"implementation"("androidx.transition:transition:1.6.0")
|
|
357
|
+
"implementation"("androidx.core:core:1.15.0")
|
|
358
|
+
"implementation"("com.facebook.react:react-android") // version substituted by RNGP
|
|
359
|
+
"implementation"("androidx.core:core-ktx:1.17.0")
|
|
360
|
+
"implementation"("com.facebook.react:hermes-android") // version substituted by RNGP
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
tasks.named("preBuild") { dependsOn("prepareWorkletsHeadersForPrefabs") }
|
|
364
|
+
|
|
365
|
+
afterEvaluate {
|
|
366
|
+
tasks.named("clean") {
|
|
367
|
+
finalizedBy("cleanCMakeCache")
|
|
368
|
+
}
|
|
369
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
fun reactNativeArchitectures(): List<String> {
|
|
2
|
+
val value = project.findProperty("reactNativeArchitectures") as String?
|
|
3
|
+
return value?.split(",")
|
|
4
|
+
?.map { it.trim() }
|
|
5
|
+
?.filter { it.isNotEmpty() }
|
|
6
|
+
?.ifEmpty { null }
|
|
7
|
+
?: listOf("armeabi-v7a", "x86", "x86_64", "arm64-v8a")
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
tasks.configureEach {
|
|
11
|
+
// Make sure that we generate our prefab publication file only after having built the native library
|
|
12
|
+
// so that not a header publication file, but a full configuration publication will be generated, which
|
|
13
|
+
// will include the .so file
|
|
14
|
+
val prefabConfigurePattern = Regex("^prefab(.+)ConfigurePackage$")
|
|
15
|
+
val matchResult = prefabConfigurePattern.matchEntire(name)
|
|
16
|
+
if (matchResult != null) {
|
|
17
|
+
val variantName = matchResult.groupValues[1]
|
|
18
|
+
outputs.upToDateWhen { false }
|
|
19
|
+
dependsOn("externalNativeBuild$variantName")
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
afterEvaluate {
|
|
24
|
+
val abis = reactNativeArchitectures()
|
|
25
|
+
rootProject.allprojects.forEach { proj ->
|
|
26
|
+
if (proj === rootProject) {
|
|
27
|
+
return@forEach
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
val dependsOnThisLib = proj.configurations.any { config ->
|
|
31
|
+
config.dependencies.any { dep ->
|
|
32
|
+
dep.group == project.group && dep.name == project.name
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!dependsOnThisLib && proj != project) return@forEach
|
|
36
|
+
|
|
37
|
+
if (!proj.plugins.hasPlugin("com.android.application") && !proj.plugins.hasPlugin("com.android.library")) {
|
|
38
|
+
return@forEach
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to
|
|
42
|
+
// generate a libnameConfig.cmake file that will contain our native library (.so).
|
|
43
|
+
// See this condition: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ExternalNativeJsonGenerator.kt;l=207-219?q=createPrefabBuildSystemGlue
|
|
44
|
+
val cxxDir = File(proj.projectDir, ".cxx")
|
|
45
|
+
if (!cxxDir.exists()) return@forEach
|
|
46
|
+
cxxDir.listFiles { dir -> dir.isDirectory }?.forEach { variantDir ->
|
|
47
|
+
val randomDirs = variantDir.listFiles { dir -> dir.isDirectory }
|
|
48
|
+
abis.forEach { abi ->
|
|
49
|
+
randomDirs?.forEach { randomDir ->
|
|
50
|
+
val prefabFile = File(randomDir, "$abi/prefab_config.json")
|
|
51
|
+
if (prefabFile.exists()) prefabFile.setLastModified(System.currentTimeMillis())
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|