expo-modules-core 0.11.4 → 0.11.5
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
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.11.5 — 2022-09-01
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Removed the hard dependency to Hermes or JSC in *libexpo-modules-core.so* on Android and fixed the broken support for react-native-v8. ([#18899](https://github.com/expo/expo/pull/18899) by [@kudo](https://github.com/kudo))
|
|
18
|
+
|
|
13
19
|
## 0.11.4 — 2022-08-18
|
|
14
20
|
|
|
15
21
|
### 🐛 Bug fixes
|
package/android/CMakeLists.txt
CHANGED
|
@@ -5,6 +5,7 @@ set(CMAKE_ANDROID_STL_TYPE c++_shared)
|
|
|
5
5
|
set(CMAKE_CXX_STANDARD 17)
|
|
6
6
|
set(PACKAGE_NAME "expo-modules-core")
|
|
7
7
|
set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
|
|
8
|
+
set(ignoreMe "${HERMES_HEADER_DIR}")
|
|
8
9
|
|
|
9
10
|
if (${NATIVE_DEBUG})
|
|
10
11
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
|
|
@@ -16,12 +17,23 @@ file(GLOB sources_android "${SRC_DIR}/main/cpp/*.cpp")
|
|
|
16
17
|
|
|
17
18
|
# shared
|
|
18
19
|
|
|
20
|
+
macro(createVarAsBoolToInt name value)
|
|
21
|
+
if(${value})
|
|
22
|
+
set(${name} "1")
|
|
23
|
+
else()
|
|
24
|
+
set(${name} "0")
|
|
25
|
+
endif()
|
|
26
|
+
endmacro()
|
|
27
|
+
|
|
19
28
|
add_library(
|
|
20
29
|
${PACKAGE_NAME}
|
|
21
30
|
SHARED
|
|
22
31
|
${sources_android}
|
|
23
32
|
)
|
|
24
33
|
|
|
34
|
+
createVarAsBoolToInt("USE_HERMES_INT" ${USE_HERMES})
|
|
35
|
+
createVarAsBoolToInt("UNIT_TEST_INT" ${UNIT_TEST})
|
|
36
|
+
|
|
25
37
|
# Extracted AAR: ${BUILD_DIR}/react-native-0*/jni/${ANDROID_ABI}
|
|
26
38
|
file(GLOB LIBRN_DIR "${REACT_NATIVE_SO_DIR}/${ANDROID_ABI}")
|
|
27
39
|
if (NOT LIBRN_DIR)
|
|
@@ -31,7 +43,33 @@ if (NOT LIBRN_DIR)
|
|
|
31
43
|
endif ()
|
|
32
44
|
|
|
33
45
|
file(GLOB libfbjni_include_DIRS "${BUILD_DIR}/fbjni-*-headers.jar/")
|
|
34
|
-
|
|
46
|
+
|
|
47
|
+
# tests
|
|
48
|
+
|
|
49
|
+
if(${UNIT_TEST})
|
|
50
|
+
if(${USE_HERMES})
|
|
51
|
+
file(GLOB HERMES_SO_DIR "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}")
|
|
52
|
+
find_library(
|
|
53
|
+
JSEXECUTOR_LIB
|
|
54
|
+
hermes
|
|
55
|
+
PATHS ${HERMES_SO_DIR}
|
|
56
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
57
|
+
)
|
|
58
|
+
set(JSEXECUTOR_INCLUDE "${HERMES_HEADER_DIR}")
|
|
59
|
+
else()
|
|
60
|
+
find_library(
|
|
61
|
+
JSEXECUTOR_LIB
|
|
62
|
+
jscexecutor
|
|
63
|
+
PATHS ${LIBRN_DIR}
|
|
64
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
65
|
+
)
|
|
66
|
+
set(JSEXECUTOR_INCLUDE "")
|
|
67
|
+
endif()
|
|
68
|
+
else()
|
|
69
|
+
set(JSEXECUTOR_LIB "")
|
|
70
|
+
set(JSEXECUTOR_INCLUDE "")
|
|
71
|
+
endif()
|
|
72
|
+
|
|
35
73
|
|
|
36
74
|
# includes
|
|
37
75
|
|
|
@@ -47,11 +85,11 @@ target_include_directories(
|
|
|
47
85
|
"${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core"
|
|
48
86
|
"${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
|
|
49
87
|
"${REACT_NATIVE_DIR}/ReactCommon/jsi"
|
|
50
|
-
"${HERMES_HEADER_DIR}"
|
|
51
88
|
"${BUILD_DIR}/third-party-ndk/boost/boost_${BOOST_VERSION}"
|
|
52
89
|
"${BUILD_DIR}/third-party-ndk/double-conversion"
|
|
53
90
|
"${BUILD_DIR}/third-party-ndk/folly"
|
|
54
91
|
${libfbjni_include_DIRS}
|
|
92
|
+
"${JSEXECUTOR_INCLUDE}"
|
|
55
93
|
)
|
|
56
94
|
|
|
57
95
|
# find libraries
|
|
@@ -102,20 +140,6 @@ find_library(
|
|
|
102
140
|
NO_CMAKE_FIND_ROOT_PATH
|
|
103
141
|
)
|
|
104
142
|
|
|
105
|
-
find_library(
|
|
106
|
-
HERMES_LIB
|
|
107
|
-
hermes
|
|
108
|
-
PATHS ${HERMES_SO_DIR}
|
|
109
|
-
NO_CMAKE_FIND_ROOT_PATH
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
find_library(
|
|
113
|
-
JSEXECUTOR_LIB
|
|
114
|
-
jscexecutor
|
|
115
|
-
PATHS ${LIBRN_DIR}
|
|
116
|
-
NO_CMAKE_FIND_ROOT_PATH
|
|
117
|
-
)
|
|
118
|
-
|
|
119
143
|
#reactnativejni
|
|
120
144
|
|
|
121
145
|
# linking
|
|
@@ -127,7 +151,8 @@ target_compile_options(
|
|
|
127
151
|
-DFOLLY_HAVE_MEMRCHR=1
|
|
128
152
|
-DFOLLY_USE_LIBCPP=1
|
|
129
153
|
-DFOLLY_MOBILE=1
|
|
130
|
-
-
|
|
154
|
+
-DUSE_HERMES=${USE_HERMES_INT}
|
|
155
|
+
-DUNIT_TEST=${UNIT_TEST_INT}
|
|
131
156
|
-O2
|
|
132
157
|
-frtti
|
|
133
158
|
-fexceptions
|
|
@@ -135,29 +160,14 @@ target_compile_options(
|
|
|
135
160
|
-fstack-protector-all
|
|
136
161
|
)
|
|
137
162
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
)
|
|
150
|
-
else ()
|
|
151
|
-
target_link_libraries(
|
|
152
|
-
${PACKAGE_NAME}
|
|
153
|
-
${LOG_LIB}
|
|
154
|
-
${FBJNI_LIB}
|
|
155
|
-
${JSI_LIB}
|
|
156
|
-
${JSEXECUTOR_LIB}
|
|
157
|
-
${REACT_NATIVE_JNI_LIB}
|
|
158
|
-
${FOLLY_LIB}
|
|
159
|
-
${REACT_NATIVE_MODULES_CORE}
|
|
160
|
-
android
|
|
161
|
-
)
|
|
162
|
-
endif ()
|
|
163
|
-
|
|
163
|
+
target_link_libraries(
|
|
164
|
+
${PACKAGE_NAME}
|
|
165
|
+
${LOG_LIB}
|
|
166
|
+
${FBJNI_LIB}
|
|
167
|
+
${JSI_LIB}
|
|
168
|
+
${JSEXECUTOR_LIB}
|
|
169
|
+
${REACT_NATIVE_JNI_LIB}
|
|
170
|
+
${FOLLY_LIB}
|
|
171
|
+
${REACT_NATIVE_MODULES_CORE}
|
|
172
|
+
android
|
|
173
|
+
)
|
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.11.
|
|
9
|
+
version = '0.11.5'
|
|
10
10
|
|
|
11
11
|
buildscript {
|
|
12
12
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -39,11 +39,11 @@ buildscript {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
def isAndroidTest
|
|
42
|
+
def isAndroidTest = {
|
|
43
43
|
Gradle gradle = getGradle()
|
|
44
44
|
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
|
|
45
45
|
return tskReqStr.contains("AndroidTest")
|
|
46
|
-
}
|
|
46
|
+
}.call()
|
|
47
47
|
|
|
48
48
|
def downloadsDir = new File("$buildDir/downloads")
|
|
49
49
|
def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
|
|
@@ -78,21 +78,24 @@ def currentHermesVersion = file("${REACT_NATIVE_DIR}/sdks/.hermesversion").exist
|
|
|
78
78
|
def hasHermesProject = findProject(":ReactAndroid:hermes-engine") != null
|
|
79
79
|
def prebuiltHermesCacheHit = hasHermesProject && currentHermesVersion == prebuiltHermesVersion
|
|
80
80
|
|
|
81
|
-
def
|
|
81
|
+
def USE_HERMES = false
|
|
82
82
|
def HERMES_HEADER_DIR = null
|
|
83
83
|
def HERMES_AAR = null
|
|
84
84
|
if (findProject(":app")) {
|
|
85
85
|
def appProjectExt = project(":app").ext
|
|
86
86
|
if (appProjectExt.has("react")) {
|
|
87
|
-
|
|
87
|
+
USE_HERMES = project(":app").ext.react.enableHermes
|
|
88
88
|
} else {
|
|
89
|
-
|
|
89
|
+
USE_HERMES = (findProperty('expo.jsEngine') ?: "jsc") == "hermes"
|
|
90
90
|
}
|
|
91
91
|
} else {
|
|
92
|
-
|
|
92
|
+
USE_HERMES = (findProperty('expo.jsEngine') ?: "jsc") == "hermes"
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
// Currently the needs for hermes/jsc are only for androidTest, so we turn on this flag only when `isAndroidTest` is true
|
|
96
|
+
USE_HERMES = USE_HERMES && isAndroidTest
|
|
97
|
+
|
|
98
|
+
if (USE_HERMES) {
|
|
96
99
|
if (prebuiltHermesCacheHit) {
|
|
97
100
|
HERMES_HEADER_DIR = file("${thirdPartyNdkDir}/hermes/prefab/modules/libhermes/include")
|
|
98
101
|
HERMES_AAR = file("${prebuiltHermesDir}/hermes-engine-debug.aar")
|
|
@@ -158,7 +161,7 @@ android {
|
|
|
158
161
|
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
159
162
|
consumerProguardFiles 'proguard-rules.pro'
|
|
160
163
|
versionCode 1
|
|
161
|
-
versionName "0.11.
|
|
164
|
+
versionName "0.11.5"
|
|
162
165
|
|
|
163
166
|
testInstrumentationRunner "expo.modules.TestRunner"
|
|
164
167
|
|
|
@@ -169,8 +172,9 @@ android {
|
|
|
169
172
|
"-DREACT_NATIVE_SO_DIR=${REACT_NATIVE_SO_DIR}",
|
|
170
173
|
"-DREACT_NATIVE_TARGET_VERSION=${REACT_NATIVE_TARGET_VERSION}",
|
|
171
174
|
"-DBOOST_VERSION=${BOOST_VERSION}",
|
|
172
|
-
"-
|
|
173
|
-
"-DHERMES_HEADER_DIR=${HERMES_HEADER_DIR}"
|
|
175
|
+
"-DUSE_HERMES=${USE_HERMES}",
|
|
176
|
+
"-DHERMES_HEADER_DIR=${HERMES_HEADER_DIR}",
|
|
177
|
+
"-DUNIT_TEST=${isAndroidTest}"
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
}
|
|
@@ -203,7 +207,7 @@ android {
|
|
|
203
207
|
|
|
204
208
|
// In android (instrumental) tests, we want to package all so files to enable our JSI functionality.
|
|
205
209
|
// Otherwise, those files should be excluded, because will be loaded by the application.
|
|
206
|
-
if (isAndroidTest
|
|
210
|
+
if (isAndroidTest) {
|
|
207
211
|
excludes = [
|
|
208
212
|
"META-INF/MANIFEST.MF",
|
|
209
213
|
"META-INF/com.android.tools/proguard/coroutines.pro",
|
|
@@ -277,7 +281,7 @@ dependencies {
|
|
|
277
281
|
androidTestImplementation "com.google.truth:truth:1.1.2"
|
|
278
282
|
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
|
|
279
283
|
|
|
280
|
-
if (
|
|
284
|
+
if (USE_HERMES) {
|
|
281
285
|
def hermesProject = findProject(":ReactAndroid:hermes-engine")
|
|
282
286
|
androidTestImplementation (hermesProject ?: files(HERMES_AAR))
|
|
283
287
|
} else {
|
|
@@ -438,7 +442,7 @@ task prepareFolly(dependsOn: [downloadFolly], type: Copy) {
|
|
|
438
442
|
// END FOLLy
|
|
439
443
|
|
|
440
444
|
task prepareHermes(dependsOn: createNativeDepsDirectories) {
|
|
441
|
-
if (!
|
|
445
|
+
if (!USE_HERMES) {
|
|
442
446
|
return
|
|
443
447
|
}
|
|
444
448
|
|
|
@@ -453,13 +457,16 @@ task prepareHermes(dependsOn: createNativeDepsDirectories) {
|
|
|
453
457
|
}
|
|
454
458
|
}
|
|
455
459
|
|
|
456
|
-
task prepareThirdPartyNdkHeaders(dependsOn: [prepareBoost, prepareDoubleConversion, prepareFolly
|
|
460
|
+
task prepareThirdPartyNdkHeaders(dependsOn: [prepareBoost, prepareDoubleConversion, prepareFolly]) {}
|
|
457
461
|
|
|
458
462
|
afterEvaluate {
|
|
459
463
|
extractAARHeaders.dependsOn(prepareThirdPartyNdkHeaders)
|
|
460
464
|
extractJNIFiles.dependsOn(prepareThirdPartyNdkHeaders)
|
|
461
|
-
if (
|
|
462
|
-
|
|
465
|
+
if (USE_HERMES) {
|
|
466
|
+
prepareThirdPartyNdkHeaders.dependsOn(prepareHermes)
|
|
467
|
+
if (hasHermesProject && !prebuiltHermesCacheHit) {
|
|
468
|
+
prepareHermes.dependsOn(":ReactAndroid:hermes-engine:assembleDebug")
|
|
469
|
+
}
|
|
463
470
|
}
|
|
464
471
|
}
|
|
465
472
|
|
|
@@ -58,6 +58,9 @@ void JSIInteropModuleRegistry::installJSI(
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
void JSIInteropModuleRegistry::installJSIForTests() {
|
|
61
|
+
#if !UNIT_TEST
|
|
62
|
+
throw std::logic_error("The function is only avaiable when UNIT_TEST is defined.");
|
|
63
|
+
#else
|
|
61
64
|
runtimeHolder = std::make_shared<JavaScriptRuntime>();
|
|
62
65
|
jsi::Runtime &jsiRuntime = *runtimeHolder->get();
|
|
63
66
|
|
|
@@ -71,6 +74,7 @@ void JSIInteropModuleRegistry::installJSIForTests() {
|
|
|
71
74
|
"ExpoModules",
|
|
72
75
|
std::move(expoModulesObject)
|
|
73
76
|
);
|
|
77
|
+
#endif // !UNIT_TEST
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
jni::local_ref<JavaScriptModuleObject::javaobject>
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
#include "JavaScriptObject.h"
|
|
6
6
|
#include "Exceptions.h"
|
|
7
7
|
|
|
8
|
-
#if
|
|
8
|
+
#if UNIT_TEST
|
|
9
|
+
|
|
10
|
+
#if USE_HERMES
|
|
9
11
|
|
|
10
12
|
#include <hermes/hermes.h>
|
|
11
13
|
|
|
@@ -17,6 +19,8 @@
|
|
|
17
19
|
|
|
18
20
|
#endif
|
|
19
21
|
|
|
22
|
+
#endif // UNIT_TEST
|
|
23
|
+
|
|
20
24
|
namespace jsi = facebook::jsi;
|
|
21
25
|
|
|
22
26
|
namespace expo {
|
|
@@ -32,7 +36,10 @@ void SyncCallInvoker::invokeSync(std::function<void()> &&func) {
|
|
|
32
36
|
JavaScriptRuntime::JavaScriptRuntime()
|
|
33
37
|
: jsInvoker(std::make_shared<SyncCallInvoker>()),
|
|
34
38
|
nativeInvoker(std::make_shared<SyncCallInvoker>()) {
|
|
35
|
-
#if
|
|
39
|
+
#if !UNIT_TEST
|
|
40
|
+
throw std::logic_error("The JavaScriptRuntime constructor is only avaiable when UNIT_TEST is defined.");
|
|
41
|
+
#else
|
|
42
|
+
#if USE_HERMES
|
|
36
43
|
auto config = ::hermes::vm::RuntimeConfig::Builder()
|
|
37
44
|
.withEnableSampleProfiling(false);
|
|
38
45
|
runtime = facebook::hermes::makeHermesRuntime(config.build());
|
|
@@ -67,6 +74,7 @@ JavaScriptRuntime::JavaScriptRuntime()
|
|
|
67
74
|
jsi::PropNameID::forUtf8(*runtime, "global"),
|
|
68
75
|
runtime->global()
|
|
69
76
|
);
|
|
77
|
+
#endif // !UNIT_TEST
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
JavaScriptRuntime::JavaScriptRuntime(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-core",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "The core of Expo Modules architecture",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@testing-library/react-hooks": "^7.0.1",
|
|
43
43
|
"expo-module-scripts": "^2.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "9508df4babe9f5418a79c1fc1628c48936c206de"
|
|
46
46
|
}
|