expo-modules-core 1.0.4 → 1.1.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 +26 -6
- package/ExpoModulesCore.podspec +38 -4
- package/android/CMakeLists.txt +21 -71
- package/android/ExpoModulesCorePlugin.gradle +200 -0
- package/android/build.gradle +42 -205
- package/android/legacy/CMakeLists.txt +194 -0
- package/android/{src → legacy}/fabric/Android-prebuilt.cmake +2 -0
- package/android/legacy/fabric/CMakeLists.txt +40 -0
- package/android/proguard-rules.pro +13 -0
- package/android/src/fabric/CMakeLists.txt +23 -16
- package/android/src/main/java/expo/modules/kotlin/AppContext.kt +7 -0
- package/android/src/main/java/expo/modules/kotlin/exception/CommonExceptions.kt +5 -0
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +44 -0
- package/android/src/main/java/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +9 -1
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +46 -0
- package/build/EventEmitter.d.ts +2 -2
- package/build/EventEmitter.d.ts.map +1 -1
- package/build/NativeModulesProxy.types.d.ts +1 -1
- package/build/NativeModulesProxy.types.d.ts.map +1 -1
- package/build/NativeViewManagerAdapter.native.d.ts +1 -1
- package/build/NativeViewManagerAdapter.native.d.ts.map +1 -1
- package/build/NativeViewManagerAdapter.native.js +3 -3
- package/build/NativeViewManagerAdapter.native.js.map +1 -1
- package/build/PermissionsHook.d.ts +4 -4
- package/build/PermissionsHook.d.ts.map +1 -1
- package/build/PermissionsInterface.d.ts +1 -1
- package/build/PermissionsInterface.d.ts.map +1 -1
- package/build/Platform.d.ts +2 -2
- package/build/Platform.d.ts.map +1 -1
- package/build/TypedArrays.types.d.ts +9 -0
- package/build/TypedArrays.types.d.ts.map +1 -0
- package/build/TypedArrays.types.js +2 -0
- package/build/TypedArrays.types.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/requireNativeModule.d.ts +1 -1
- package/build/requireNativeModule.d.ts.map +1 -1
- package/common/cpp/fabric/ExpoViewProps.cpp +2 -0
- package/ios/AppDelegates/EXAppDelegateWrapper.h +22 -0
- package/ios/AppDelegates/EXAppDelegateWrapper.mm +100 -0
- package/ios/JSI/EXJavaScriptRuntime.mm +5 -5
- package/ios/ReactDelegates/EXReactCompatibleHelpers.h +1 -1
- package/ios/ReactDelegates/EXReactCompatibleHelpers.m +8 -2
- package/ios/ReactDelegates/EXReactDelegateWrapper.h +5 -0
- package/ios/ReactDelegates/EXReactDelegateWrapper.m +14 -1
- package/ios/ReactDelegates/ExpoReactDelegate.swift +7 -2
- package/ios/Swift/AppContext.swift +9 -0
- package/ios/Swift/Arguments/Enumerable.swift +2 -16
- package/ios/Swift/Classes/ClassComponentElement.swift +1 -1
- package/ios/Swift/Convertibles/Either.swift +5 -14
- package/ios/Swift/DynamicTypes/DynamicEnumType.swift +1 -1
- package/ios/Swift/DynamicTypes/DynamicSharedObjectType.swift +4 -0
- package/ios/Swift/DynamicTypes/DynamicType.swift +1 -1
- package/ios/Swift/Functions/AnyFunction.swift +18 -0
- package/ios/Swift/JavaScriptUtils.swift +25 -8
- package/ios/Swift/Objects/ObjectDefinition.swift +4 -4
- package/ios/Swift/Objects/ObjectDefinitionComponents.swift +7 -0
- package/ios/Swift/Objects/PropertyComponent.swift +138 -48
- package/ios/Swift/SharedObjects/SharedObject.swift +5 -0
- package/ios/Tests/ClassComponentSpec.swift +15 -0
- package/ios/Tests/EitherSpec.swift +28 -0
- package/ios/Tests/FunctionSpec.swift +31 -0
- package/ios/Tests/PropertyComponentSpec.swift +131 -33
- package/package.json +2 -2
- package/src/NativeViewManagerAdapter.native.tsx +4 -4
- package/src/TypedArrays.types.ts +11 -0
- package/src/index.ts +1 -0
- package/ios/AppDelegates/EXAppDelegateWrapper.m +0 -45
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 = '1.0
|
|
9
|
+
version = '1.1.0'
|
|
10
10
|
|
|
11
11
|
buildscript {
|
|
12
12
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -35,7 +35,7 @@ buildscript {
|
|
|
35
35
|
|
|
36
36
|
dependencies {
|
|
37
37
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
38
|
-
classpath
|
|
38
|
+
classpath("de.undercouch:gradle-download-task:5.3.0")
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -59,19 +59,13 @@ def REACT_NATIVE_DIR = REACT_NATIVE_BUILD_FROM_SOURCE
|
|
|
59
59
|
: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent
|
|
60
60
|
def REACT_NATIVE_SO_DIR = REACT_NATIVE_BUILD_FROM_SOURCE
|
|
61
61
|
? Paths.get(findProject(":ReactAndroid").getProjectDir().toString(), "build", "intermediates", "library_*", "*", "jni")
|
|
62
|
-
: "${buildDir}/react
|
|
62
|
+
: "${buildDir}/react/jni"
|
|
63
63
|
|
|
64
64
|
def reactProperties = new Properties()
|
|
65
65
|
file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
66
66
|
|
|
67
|
-
def FOLLY_VERSION = reactProperties.getProperty("FOLLY_VERSION")
|
|
68
67
|
def BOOST_VERSION = reactProperties.getProperty("BOOST_VERSION")
|
|
69
|
-
def
|
|
70
|
-
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
|
|
71
|
-
if (REACT_NATIVE_VERSION.startsWith("0.0.0-")) {
|
|
72
|
-
// react-native nightly build published as `0.0.0-20221002-2027-2319f75c8` form, but its semantic is latest
|
|
73
|
-
REACT_NATIVE_VERSION = "9999.9999.9999"
|
|
74
|
-
}
|
|
68
|
+
def REACT_NATIVE_VERSION = System.getenv("REACT_NATIVE_OVERRIDE_VERSION") ?: reactProperties.getProperty("VERSION_NAME")
|
|
75
69
|
def REACT_NATIVE_TARGET_VERSION = REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
|
|
76
70
|
|
|
77
71
|
def reactNativeThirdParty = new File("$REACT_NATIVE_DIR/ReactAndroid/src/main/jni/third-party")
|
|
@@ -130,7 +124,6 @@ if (USE_HERMES) {
|
|
|
130
124
|
}
|
|
131
125
|
// END HERMES
|
|
132
126
|
|
|
133
|
-
|
|
134
127
|
def isNewArchitectureEnabled = findProperty("newArchEnabled") == "true"
|
|
135
128
|
|
|
136
129
|
// Creating sources with comments
|
|
@@ -191,7 +184,7 @@ android {
|
|
|
191
184
|
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
192
185
|
consumerProguardFiles 'proguard-rules.pro'
|
|
193
186
|
versionCode 1
|
|
194
|
-
versionName "1.0
|
|
187
|
+
versionName "1.1.0"
|
|
195
188
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
|
|
196
189
|
|
|
197
190
|
testInstrumentationRunner "expo.modules.TestRunner"
|
|
@@ -217,7 +210,11 @@ android {
|
|
|
217
210
|
|
|
218
211
|
externalNativeBuild {
|
|
219
212
|
cmake {
|
|
220
|
-
|
|
213
|
+
if (REACT_NATIVE_TARGET_VERSION >= 71) {
|
|
214
|
+
path "CMakeLists.txt"
|
|
215
|
+
} else {
|
|
216
|
+
path "legacy/CMakeLists.txt"
|
|
217
|
+
}
|
|
221
218
|
}
|
|
222
219
|
}
|
|
223
220
|
|
|
@@ -260,11 +257,6 @@ android {
|
|
|
260
257
|
}
|
|
261
258
|
}
|
|
262
259
|
|
|
263
|
-
configurations {
|
|
264
|
-
extractHeaders
|
|
265
|
-
extractJNI
|
|
266
|
-
}
|
|
267
|
-
|
|
268
260
|
lintOptions {
|
|
269
261
|
abortOnError false
|
|
270
262
|
}
|
|
@@ -309,8 +301,6 @@ dependencies {
|
|
|
309
301
|
implementation 'com.facebook.react:react-native:+'
|
|
310
302
|
|
|
311
303
|
compileOnly 'com.facebook.fbjni:fbjni:0.2.2'
|
|
312
|
-
extractHeaders 'com.facebook.fbjni:fbjni:0.2.2:headers'
|
|
313
|
-
extractJNI 'com.facebook.fbjni:fbjni:0.2.2'
|
|
314
304
|
|
|
315
305
|
testImplementation 'androidx.test:core:1.4.0'
|
|
316
306
|
testImplementation 'junit:junit:4.13.1'
|
|
@@ -344,148 +334,12 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
|
|
344
334
|
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
|
|
345
335
|
}
|
|
346
336
|
|
|
347
|
-
|
|
348
|
-
task createNativeDepsDirectories() {
|
|
337
|
+
def createNativeDepsDirectories = project.tasks.findByName('createNativeDepsDirectories') ?: project.tasks.register('createNativeDepsDirectories') {
|
|
349
338
|
downloadsDir.mkdirs()
|
|
350
339
|
thirdPartyNdkDir.mkdirs()
|
|
351
340
|
}
|
|
352
|
-
// END UTILS
|
|
353
|
-
|
|
354
|
-
// JNI
|
|
355
|
-
def extractReactNativeAAR = { buildType ->
|
|
356
|
-
def suffix = buildType == 'Debug' ? '-debug' : '-release'
|
|
357
|
-
def rnAARs = fileTree(REACT_NATIVE_DIR).matching { include "**/react-native/**/*${suffix}.aar" }
|
|
358
|
-
if (rnAARs.isEmpty()) {
|
|
359
|
-
rnAARs = fileTree(REACT_NATIVE_DIR).matching { include "**/react-native/**/*.aar" }
|
|
360
|
-
}
|
|
361
|
-
if (rnAARs.any()) {
|
|
362
|
-
// node_modules/react-native has a .aar, extract headers
|
|
363
|
-
if (rnAARs.size() > 1) {
|
|
364
|
-
logger.error("More than one React Native AAR file has been found:")
|
|
365
|
-
rnAARs.each {println(it) }
|
|
366
|
-
throw new GradleException("Multiple React Native AARs found:\n${rnAARs.join("\n")}" +
|
|
367
|
-
"\nRemove the old ones and try again")
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
def rnAAR = rnAARs.singleFile
|
|
371
|
-
def file = rnAAR.absoluteFile
|
|
372
|
-
def packageName = file.name.tokenize('-')[0]
|
|
373
|
-
copy {
|
|
374
|
-
from zipTree(file)
|
|
375
|
-
into "$buildDir/$file.name"
|
|
376
|
-
include "jni/**/*"
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
task extractReactNativeAARRelease {
|
|
381
|
-
doLast {
|
|
382
|
-
extractReactNativeAAR('Release')
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
task extractReactNativeAARDebug {
|
|
387
|
-
doLast {
|
|
388
|
-
extractReactNativeAAR('Debug')
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
task extractAARHeaders {
|
|
394
|
-
doLast {
|
|
395
|
-
configurations.extractHeaders.files.each {
|
|
396
|
-
def file = it.absoluteFile
|
|
397
|
-
copy {
|
|
398
|
-
from zipTree(file)
|
|
399
|
-
into "$buildDir/$file.name"
|
|
400
|
-
include "**/*.h"
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
task extractJNIFiles {
|
|
407
|
-
doLast {
|
|
408
|
-
configurations.extractJNI.files.each {
|
|
409
|
-
def file = it.absoluteFile
|
|
410
|
-
copy {
|
|
411
|
-
from zipTree(file)
|
|
412
|
-
into "$buildDir/$file.name"
|
|
413
|
-
include "jni/**/*"
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
// END JNI
|
|
419
|
-
|
|
420
|
-
// BOOST
|
|
421
|
-
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
422
|
-
def srcUrl = REACT_NATIVE_TARGET_VERSION >= 69
|
|
423
|
-
? "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz"
|
|
424
|
-
: "https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz"
|
|
425
|
-
src(srcUrl)
|
|
426
|
-
onlyIfNewer(true)
|
|
427
|
-
overwrite(false)
|
|
428
|
-
dest(new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz"))
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
task prepareBoost(dependsOn: [downloadBoost], type: Copy) {
|
|
432
|
-
from(tarTree(resources.gzip(downloadBoost.dest)))
|
|
433
|
-
from("$reactNativeThirdParty/boost/Android.mk")
|
|
434
|
-
include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp")
|
|
435
|
-
includeEmptyDirs = false
|
|
436
|
-
into("$thirdPartyNdkDir/boost")
|
|
437
|
-
doLast {
|
|
438
|
-
file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_${BOOST_VERSION}")
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
// END BOOST
|
|
442
|
-
|
|
443
|
-
// DOUBLE CONVERSION
|
|
444
|
-
task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
445
|
-
src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
|
|
446
|
-
onlyIfNewer(true)
|
|
447
|
-
overwrite(false)
|
|
448
|
-
dest(new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz"))
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
task prepareDoubleConversion(dependsOn: [downloadDoubleConversion], type: Copy) {
|
|
452
|
-
from(tarTree(downloadDoubleConversion.dest))
|
|
453
|
-
from("$reactNativeThirdParty/double-conversion/Android.mk")
|
|
454
|
-
include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "Android.mk")
|
|
455
|
-
filesMatching("*/src/**/*", { fname -> fname.path = "double-conversion/${fname.name}" })
|
|
456
|
-
includeEmptyDirs = false
|
|
457
|
-
into("$thirdPartyNdkDir/double-conversion")
|
|
458
|
-
}
|
|
459
|
-
// END DOUBLE CONVERSION
|
|
460
|
-
|
|
461
|
-
// FOLLY
|
|
462
|
-
task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
463
|
-
src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
|
|
464
|
-
onlyIfNewer(true)
|
|
465
|
-
overwrite(false)
|
|
466
|
-
dest(new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz"))
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
task prepareFolly(dependsOn: [downloadFolly], type: Copy) {
|
|
470
|
-
from(tarTree(downloadFolly.dest))
|
|
471
|
-
from("$reactNativeThirdParty/folly/Android.mk")
|
|
472
|
-
include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
|
|
473
|
-
eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
|
|
474
|
-
// Fixes problem with Folly failing to build on certain systems. See
|
|
475
|
-
// https://github.com/software-mansion/react-native-reanimated/issues/1024
|
|
476
|
-
def follyReplaceContent = '''
|
|
477
|
-
ssize_t r;
|
|
478
|
-
do {
|
|
479
|
-
r = open(name, flags, mode);
|
|
480
|
-
} while (r == -1 && errno == EINTR);
|
|
481
|
-
return r;
|
|
482
|
-
'''
|
|
483
|
-
filter { line -> line.replaceAll("return int\\(wrapNoInt\\(open, name, flags, mode\\)\\);", follyReplaceContent) }
|
|
484
|
-
includeEmptyDirs = false
|
|
485
|
-
into("$thirdPartyNdkDir/folly")
|
|
486
|
-
}
|
|
487
|
-
// END FOLLY
|
|
488
341
|
|
|
342
|
+
// TODO: Remove all these hermes code when we update our repo to react-native 0.71 by using prefab
|
|
489
343
|
task downloadHermes(type: Download) {
|
|
490
344
|
def hermesVersion = currentHermesVersion ?: "main"
|
|
491
345
|
src("https://github.com/facebook/hermes/tarball/${hermesVersion}")
|
|
@@ -507,10 +361,11 @@ task unzipHermes(dependsOn: downloadHermes, type: Copy) {
|
|
|
507
361
|
into(hermesDir)
|
|
508
362
|
}
|
|
509
363
|
|
|
510
|
-
task prepareHermes(
|
|
364
|
+
task prepareHermes() {
|
|
511
365
|
if (!USE_HERMES) {
|
|
512
366
|
return
|
|
513
367
|
}
|
|
368
|
+
dependsOn(createNativeDepsDirectories)
|
|
514
369
|
if (NEED_DOWNLOAD_HERMES) {
|
|
515
370
|
dependsOn(unzipHermes)
|
|
516
371
|
}
|
|
@@ -526,61 +381,43 @@ task prepareHermes(dependsOn: createNativeDepsDirectories) {
|
|
|
526
381
|
}
|
|
527
382
|
}
|
|
528
383
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
def
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
384
|
+
def downloadBoost = tasks.create('downloadBoost', Download) {
|
|
385
|
+
dependsOn(createNativeDepsDirectories)
|
|
386
|
+
def srcUrl = REACT_NATIVE_TARGET_VERSION >= 69
|
|
387
|
+
? "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz"
|
|
388
|
+
: "https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz"
|
|
389
|
+
src(srcUrl)
|
|
390
|
+
onlyIfNewer(true)
|
|
391
|
+
overwrite(false)
|
|
392
|
+
dest(new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz"))
|
|
535
393
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
394
|
+
|
|
395
|
+
def prepareBoost = tasks.register('prepareBoost', Copy) {
|
|
396
|
+
dependsOn(downloadBoost)
|
|
397
|
+
from(tarTree(resources.gzip(downloadBoost.dest)))
|
|
398
|
+
from("$reactNativeThirdParty/boost/Android.mk")
|
|
399
|
+
include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp")
|
|
400
|
+
includeEmptyDirs = false
|
|
401
|
+
into("$thirdPartyNdkDir/boost")
|
|
402
|
+
doLast {
|
|
403
|
+
new File("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_${BOOST_VERSION}")
|
|
404
|
+
}
|
|
540
405
|
}
|
|
541
406
|
|
|
542
407
|
afterEvaluate {
|
|
543
|
-
|
|
544
|
-
extractJNIFiles.dependsOn(prepareThirdPartyNdkHeaders)
|
|
408
|
+
preBuild.dependsOn(prepareBoost)
|
|
545
409
|
if (USE_HERMES) {
|
|
546
|
-
|
|
410
|
+
preBuild.dependsOn(prepareHermes)
|
|
547
411
|
if (hasHermesProject && !prebuiltHermesCacheHit) {
|
|
548
412
|
prepareHermes.dependsOn(":ReactAndroid:hermes-engine:assembleDebug")
|
|
549
413
|
}
|
|
550
414
|
}
|
|
551
|
-
|
|
552
|
-
if (isNewArchitectureEnabled) {
|
|
553
|
-
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
|
|
554
|
-
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
|
|
555
|
-
|
|
556
|
-
// Due to a bug inside AGP, we have to explicitly set a dependency
|
|
557
|
-
// between configureCMake* tasks and the preBuild tasks.
|
|
558
|
-
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
|
|
559
|
-
configureCMakeDebug.dependsOn(preDebugBuild)
|
|
560
|
-
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
|
|
561
|
-
reactNativeArchitectures().each { architecture ->
|
|
562
|
-
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
|
|
563
|
-
dependsOn("preDebugBuild")
|
|
564
|
-
}
|
|
565
|
-
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
|
|
566
|
-
dependsOn("preReleaseBuild")
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
415
|
}
|
|
571
416
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
task.dependsOn(":ReactAndroid:copy${buildType}JniLibsProjectOnly")
|
|
579
|
-
} else {
|
|
580
|
-
task.dependsOn("extractReactNativeAAR${buildType}")
|
|
581
|
-
}
|
|
582
|
-
} else if (task.name.startsWith('generateJsonModel') && REACT_NATIVE_BUILD_FROM_SOURCE) {
|
|
583
|
-
def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
|
|
584
|
-
task.dependsOn(":ReactAndroid:copy${buildType}JniLibsProjectOnly")
|
|
585
|
-
}
|
|
417
|
+
if (REACT_NATIVE_TARGET_VERSION < 71) {
|
|
418
|
+
project.ext.extraLegacyReactNativeLibs = [
|
|
419
|
+
'prepareDoubleConversion',
|
|
420
|
+
'prepareFolly',
|
|
421
|
+
]
|
|
422
|
+
applyLegacyReactNativeLibsExtractionPlugin()
|
|
586
423
|
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Remove this legacy folder when we drop SDK 47
|
|
2
|
+
cmake_minimum_required(VERSION 3.4.1)
|
|
3
|
+
|
|
4
|
+
project(expo-modules-core)
|
|
5
|
+
|
|
6
|
+
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
7
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
8
|
+
set(PACKAGE_NAME "expo-modules-core")
|
|
9
|
+
set(BUILD_DIR ${CMAKE_SOURCE_DIR}/../build)
|
|
10
|
+
set(ignoreMe "${PROJECT_BUILD_DIR} ${REACT_ANDROID_BUILD_DIR} ${REACT_ANDROID_DIR} ${HERMES_HEADER_DIR}")
|
|
11
|
+
|
|
12
|
+
if (${NATIVE_DEBUG})
|
|
13
|
+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
|
|
14
|
+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
|
|
15
|
+
endif ()
|
|
16
|
+
|
|
17
|
+
set(SRC_DIR ${CMAKE_SOURCE_DIR}/../src)
|
|
18
|
+
set(COMMON_DIR ${CMAKE_SOURCE_DIR}/../../common/cpp)
|
|
19
|
+
file(GLOB sources_android "${SRC_DIR}/main/cpp/*.cpp")
|
|
20
|
+
file(GLOB sources_android_types "${SRC_DIR}/main/cpp/types/*.cpp")
|
|
21
|
+
file(GLOB sources_android_javaclasses "${SRC_DIR}/main/cpp/javaclasses/*.cpp")
|
|
22
|
+
file(GLOB common_sources "${COMMON_DIR}/*.cpp")
|
|
23
|
+
|
|
24
|
+
# shared
|
|
25
|
+
|
|
26
|
+
macro(createVarAsBoolToInt name value)
|
|
27
|
+
if(${value})
|
|
28
|
+
set(${name} "1")
|
|
29
|
+
else()
|
|
30
|
+
set(${name} "0")
|
|
31
|
+
endif()
|
|
32
|
+
endmacro()
|
|
33
|
+
|
|
34
|
+
add_library(CommonSettings INTERFACE)
|
|
35
|
+
|
|
36
|
+
add_library(
|
|
37
|
+
${PACKAGE_NAME}
|
|
38
|
+
SHARED
|
|
39
|
+
${common_sources}
|
|
40
|
+
${sources_android}
|
|
41
|
+
${sources_android_types}
|
|
42
|
+
${sources_android_javaclasses}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
if(IS_NEW_ARCHITECTURE_ENABLED)
|
|
46
|
+
add_subdirectory("fabric")
|
|
47
|
+
set(NEW_ARCHITECTURE_DEPENDENCIES "fabric")
|
|
48
|
+
set(NEW_ARCHITECTURE_COMPILE_OPTIONS -DIS_NEW_ARCHITECTURE_ENABLED=1 -DRN_FABRIC_ENABLED=1)
|
|
49
|
+
else()
|
|
50
|
+
set(NEW_ARCHITECTURE_DEPENDENCIES "")
|
|
51
|
+
set(NEW_ARCHITECTURE_COMPILE_OPTIONS "")
|
|
52
|
+
endif()
|
|
53
|
+
|
|
54
|
+
createVarAsBoolToInt("USE_HERMES_INT" ${USE_HERMES})
|
|
55
|
+
createVarAsBoolToInt("UNIT_TEST_INT" ${UNIT_TEST})
|
|
56
|
+
|
|
57
|
+
target_compile_options(CommonSettings INTERFACE
|
|
58
|
+
-O2
|
|
59
|
+
-frtti
|
|
60
|
+
-fexceptions
|
|
61
|
+
-Wall
|
|
62
|
+
-fstack-protector-all
|
|
63
|
+
-DUSE_HERMES=${USE_HERMES_INT}
|
|
64
|
+
-DUNIT_TEST=${UNIT_TEST_INT}
|
|
65
|
+
${NEW_ARCHITECTURE_COMPILE_OPTIONS}
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Extracted AAR: ${BUILD_DIR}/react-native-0*/jni/${ANDROID_ABI}
|
|
69
|
+
file(GLOB LIBRN_DIR "${REACT_NATIVE_SO_DIR}/${ANDROID_ABI}")
|
|
70
|
+
if (NOT LIBRN_DIR)
|
|
71
|
+
# If /${ANDROID_ABI} dir not found, then ${REACT_NATIVE_SO_DIR} is probably:
|
|
72
|
+
# ReactAndroid/build/react-ndk/exported
|
|
73
|
+
file(GLOB LIBRN_DIR "${REACT_NATIVE_SO_DIR}")
|
|
74
|
+
endif ()
|
|
75
|
+
|
|
76
|
+
# tests
|
|
77
|
+
|
|
78
|
+
if(${UNIT_TEST})
|
|
79
|
+
if(${USE_HERMES})
|
|
80
|
+
file(GLOB HERMES_SO_DIR "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}")
|
|
81
|
+
find_library(
|
|
82
|
+
JSEXECUTOR_LIB
|
|
83
|
+
hermes
|
|
84
|
+
PATHS ${HERMES_SO_DIR}
|
|
85
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
86
|
+
)
|
|
87
|
+
set(JSEXECUTOR_INCLUDE ${HERMES_HEADER_DIR} ${HERMES_HEADER_DIR}/API ${HERMES_HEADER_DIR}/public)
|
|
88
|
+
else()
|
|
89
|
+
find_library(
|
|
90
|
+
JSEXECUTOR_LIB
|
|
91
|
+
jscexecutor
|
|
92
|
+
PATHS ${LIBRN_DIR}
|
|
93
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
94
|
+
)
|
|
95
|
+
set(JSEXECUTOR_INCLUDE "")
|
|
96
|
+
endif()
|
|
97
|
+
else()
|
|
98
|
+
set(JSEXECUTOR_LIB "")
|
|
99
|
+
set(JSEXECUTOR_INCLUDE "")
|
|
100
|
+
endif()
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# includes
|
|
104
|
+
|
|
105
|
+
target_include_directories(
|
|
106
|
+
${PACKAGE_NAME}
|
|
107
|
+
PRIVATE
|
|
108
|
+
"${REACT_NATIVE_DIR}/React"
|
|
109
|
+
"${REACT_NATIVE_DIR}/React/Base"
|
|
110
|
+
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni"
|
|
111
|
+
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react"
|
|
112
|
+
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule"
|
|
113
|
+
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
|
|
114
|
+
"${REACT_NATIVE_DIR}/ReactCommon"
|
|
115
|
+
"${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core"
|
|
116
|
+
"${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
|
|
117
|
+
"${REACT_NATIVE_DIR}/ReactCommon/jsi"
|
|
118
|
+
"${BUILD_DIR}/third-party-ndk/boost/boost_${BOOST_VERSION}"
|
|
119
|
+
"${BUILD_DIR}/third-party-ndk/double-conversion"
|
|
120
|
+
"${BUILD_DIR}/third-party-ndk/folly"
|
|
121
|
+
"${COMMON_DIR}"
|
|
122
|
+
"${JSEXECUTOR_INCLUDE}"
|
|
123
|
+
"${SRC_DIR}/fabric"
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# find libraries
|
|
127
|
+
|
|
128
|
+
find_library(LOG_LIB log)
|
|
129
|
+
|
|
130
|
+
if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
|
|
131
|
+
find_library(
|
|
132
|
+
FOLLY_LIB
|
|
133
|
+
folly_json
|
|
134
|
+
PATHS ${LIBRN_DIR}
|
|
135
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
136
|
+
)
|
|
137
|
+
else()
|
|
138
|
+
find_library(
|
|
139
|
+
FOLLY_LIB
|
|
140
|
+
folly_runtime
|
|
141
|
+
PATHS ${LIBRN_DIR}
|
|
142
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
143
|
+
)
|
|
144
|
+
endif()
|
|
145
|
+
|
|
146
|
+
find_package(fbjni REQUIRED CONFIG)
|
|
147
|
+
|
|
148
|
+
find_library(
|
|
149
|
+
JSI_LIB
|
|
150
|
+
jsi
|
|
151
|
+
PATHS ${LIBRN_DIR}
|
|
152
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
find_library(
|
|
156
|
+
REACT_NATIVE_JNI_LIB
|
|
157
|
+
reactnativejni
|
|
158
|
+
PATHS ${LIBRN_DIR}
|
|
159
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
find_library(
|
|
163
|
+
REACT_NATIVE_MODULES_CORE
|
|
164
|
+
react_nativemodule_core
|
|
165
|
+
PATHS ${LIBRN_DIR}
|
|
166
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
#reactnativejni
|
|
170
|
+
|
|
171
|
+
# linking
|
|
172
|
+
|
|
173
|
+
target_compile_options(
|
|
174
|
+
${PACKAGE_NAME}
|
|
175
|
+
PRIVATE -DFOLLY_NO_CONFIG=1
|
|
176
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
177
|
+
-DFOLLY_HAVE_MEMRCHR=1
|
|
178
|
+
-DFOLLY_USE_LIBCPP=1
|
|
179
|
+
-DFOLLY_MOBILE=1
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
target_link_libraries(
|
|
183
|
+
${PACKAGE_NAME}
|
|
184
|
+
CommonSettings
|
|
185
|
+
${LOG_LIB}
|
|
186
|
+
fbjni::fbjni
|
|
187
|
+
${JSI_LIB}
|
|
188
|
+
${JSEXECUTOR_LIB}
|
|
189
|
+
${REACT_NATIVE_JNI_LIB}
|
|
190
|
+
${FOLLY_LIB}
|
|
191
|
+
${REACT_NATIVE_MODULES_CORE}
|
|
192
|
+
android
|
|
193
|
+
${NEW_ARCHITECTURE_DEPENDENCIES}
|
|
194
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
include(Android-prebuilt.cmake)
|
|
4
|
+
|
|
5
|
+
set(FABRIC_SRC_DIR ${CMAKE_SOURCE_DIR}/../src/fabric)
|
|
6
|
+
set(COMMON_FABRIC_DIR ${COMMON_DIR}/fabric)
|
|
7
|
+
file(GLOB SOURCES "${FABRIC_SRC_DIR}/*.cpp")
|
|
8
|
+
file(GLOB COMMON_FABRIC_SOURCES "${COMMON_FABRIC_DIR}/*.cpp")
|
|
9
|
+
|
|
10
|
+
add_library(fabric STATIC
|
|
11
|
+
${COMMON_FABRIC_SOURCES}
|
|
12
|
+
${SOURCES}
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
target_compile_options(fabric PRIVATE
|
|
16
|
+
"-std=c++17"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
target_include_directories(fabric PRIVATE
|
|
20
|
+
"${REACT_NATIVE_DIR}/ReactCommon"
|
|
21
|
+
"${COMMON_FABRIC_DIR}"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
target_link_libraries(fabric
|
|
25
|
+
CommonSettings
|
|
26
|
+
fabricjni
|
|
27
|
+
fbjni
|
|
28
|
+
folly_runtime
|
|
29
|
+
glog
|
|
30
|
+
jsi
|
|
31
|
+
react_debug
|
|
32
|
+
react_render_componentregistry
|
|
33
|
+
react_render_core
|
|
34
|
+
react_render_debug
|
|
35
|
+
react_render_graphics
|
|
36
|
+
react_render_mapbuffer
|
|
37
|
+
rrc_view
|
|
38
|
+
runtimeexecutor
|
|
39
|
+
yoga
|
|
40
|
+
)
|
|
@@ -18,3 +18,16 @@
|
|
|
18
18
|
-keepclassmembers enum * implements expo.modules.kotlin.types.Enumerable {
|
|
19
19
|
*;
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
-keepclassmembers class * implements expo.modules.kotlin.views.ExpoView {
|
|
23
|
+
public <init>(android.content.Context);
|
|
24
|
+
public <init>(android.content.Context, expo.modules.kotlin.AppContext);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
-keepclassmembers class * {
|
|
28
|
+
expo.modules.kotlin.viewevent.ViewEventCallback *;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
-keepclassmembers class * {
|
|
32
|
+
expo.modules.kotlin.viewevent.ViewEventDelegate *;
|
|
33
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
-
include(Android-prebuilt.cmake)
|
|
4
|
-
|
|
5
3
|
set(COMMON_FABRIC_DIR ${COMMON_DIR}/fabric)
|
|
6
4
|
file(GLOB SOURCES "*.cpp")
|
|
7
5
|
file(GLOB COMMON_FABRIC_SOURCES "${COMMON_FABRIC_DIR}/*.cpp")
|
|
@@ -13,6 +11,11 @@ add_library(fabric STATIC
|
|
|
13
11
|
|
|
14
12
|
target_compile_options(fabric PRIVATE
|
|
15
13
|
"-std=c++17"
|
|
14
|
+
-DFOLLY_NO_CONFIG=1
|
|
15
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
16
|
+
-DFOLLY_HAVE_MEMRCHR=1
|
|
17
|
+
-DFOLLY_USE_LIBCPP=1
|
|
18
|
+
-DFOLLY_MOBILE=1
|
|
16
19
|
)
|
|
17
20
|
|
|
18
21
|
target_include_directories(fabric PRIVATE
|
|
@@ -20,20 +23,24 @@ target_include_directories(fabric PRIVATE
|
|
|
20
23
|
"${COMMON_FABRIC_DIR}"
|
|
21
24
|
)
|
|
22
25
|
|
|
26
|
+
find_package(ReactAndroid REQUIRED CONFIG)
|
|
27
|
+
|
|
28
|
+
find_package(fbjni REQUIRED CONFIG)
|
|
29
|
+
|
|
23
30
|
target_link_libraries(fabric
|
|
24
31
|
CommonSettings
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
folly_runtime
|
|
28
|
-
glog
|
|
29
|
-
jsi
|
|
30
|
-
react_debug
|
|
31
|
-
react_render_componentregistry
|
|
32
|
-
react_render_core
|
|
33
|
-
react_render_debug
|
|
34
|
-
react_render_graphics
|
|
35
|
-
react_render_mapbuffer
|
|
36
|
-
rrc_view
|
|
37
|
-
runtimeexecutor
|
|
38
|
-
yoga
|
|
32
|
+
fbjni::fbjni
|
|
33
|
+
ReactAndroid::fabricjni
|
|
34
|
+
ReactAndroid::folly_runtime
|
|
35
|
+
ReactAndroid::glog
|
|
36
|
+
ReactAndroid::jsi
|
|
37
|
+
ReactAndroid::react_debug
|
|
38
|
+
ReactAndroid::react_render_componentregistry
|
|
39
|
+
ReactAndroid::react_render_core
|
|
40
|
+
ReactAndroid::react_render_debug
|
|
41
|
+
ReactAndroid::react_render_graphics
|
|
42
|
+
ReactAndroid::react_render_mapbuffer
|
|
43
|
+
ReactAndroid::rrc_view
|
|
44
|
+
ReactAndroid::runtimeexecutor
|
|
45
|
+
ReactAndroid::yoga
|
|
39
46
|
)
|
|
@@ -320,6 +320,13 @@ class AppContext(
|
|
|
320
320
|
return UIManagerHelper.getUIManagerForReactTag(reactContext, viewTag)?.resolveView(viewTag) as? T
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Runs a code block on the JavaScript thread.
|
|
325
|
+
*/
|
|
326
|
+
fun executeOnJavaScriptThread(runnable: Runnable) {
|
|
327
|
+
reactContextHolder.get()?.runOnJSQueueThread(runnable)
|
|
328
|
+
}
|
|
329
|
+
|
|
323
330
|
// region CurrentActivityProvider
|
|
324
331
|
|
|
325
332
|
override val currentActivity: Activity?
|
|
@@ -38,4 +38,9 @@ class Exceptions {
|
|
|
38
38
|
* An exception to throw when Android permissions haven't been granted.
|
|
39
39
|
*/
|
|
40
40
|
class MissingPermissions(vararg permissions: String) : CodedException(message = "Missing permissions: ${permissions.joinToString(separator = ", ")}")
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* An exception to throw when the current Android activity is not longer available.
|
|
44
|
+
*/
|
|
45
|
+
class MissingActivity : CodedException(message = "The current activity is no longer available")
|
|
41
46
|
}
|