expo-modules-core 0.11.3 → 0.11.4

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,13 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.11.4 — 2022-08-18
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix issue with Android builds when gradle clean and build were called concurrently. ([#18518](https://github.com/expo/expo/pull/18518) by [EdwardDrapkin](https://github.com/EdwardDrapkin))
18
+ - Fixed `FabricUIManager` errors when turning on new architecture mode on Android. ([#18472](https://github.com/expo/expo/pull/18472) by [@kudo](https://github.com/kudo))
19
+
13
20
  ## 0.11.3 — 2022-07-18
14
21
 
15
22
  ### 💡 Others
@@ -47,7 +47,7 @@ target_include_directories(
47
47
  "${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core"
48
48
  "${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
49
49
  "${REACT_NATIVE_DIR}/ReactCommon/jsi"
50
- "${HERMES_DIR}/android/include"
50
+ "${HERMES_HEADER_DIR}"
51
51
  "${BUILD_DIR}/third-party-ndk/boost/boost_${BOOST_VERSION}"
52
52
  "${BUILD_DIR}/third-party-ndk/double-conversion"
53
53
  "${BUILD_DIR}/third-party-ndk/folly"
@@ -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.3'
9
+ version = '0.11.4'
10
10
 
11
11
  buildscript {
12
12
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -71,8 +71,15 @@ def reactNativeArchitectures() {
71
71
  return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
72
72
  }
73
73
 
74
+ // HERMES
75
+ def prebuiltHermesDir = findProperty("expo.prebuiltHermesDir") ?: file("${REACT_NATIVE_DIR}/ReactAndroid/prebuiltHermes")
76
+ def prebuiltHermesVersion = file("${prebuiltHermesDir}/.hermesversion").exists() ? file("${prebuiltHermesDir}/.hermesversion").text : null
77
+ def currentHermesVersion = file("${REACT_NATIVE_DIR}/sdks/.hermesversion").exists() ? file("${REACT_NATIVE_DIR}/sdks/.hermesversion").text : null
78
+ def hasHermesProject = findProject(":ReactAndroid:hermes-engine") != null
79
+ def prebuiltHermesCacheHit = hasHermesProject && currentHermesVersion == prebuiltHermesVersion
80
+
74
81
  def FOR_HERMES = false
75
- def HERMES_ENGINE_DIR = null
82
+ def HERMES_HEADER_DIR = null
76
83
  def HERMES_AAR = null
77
84
  if (findProject(":app")) {
78
85
  def appProjectExt = project(":app").ext
@@ -86,23 +93,30 @@ if (findProject(":app")) {
86
93
  }
87
94
 
88
95
  if (FOR_HERMES) {
89
- // The `hermes-engine` package doesn't contain the correct version of the Hermes.
90
- // The AAR we need to import is located in the React Native package.
91
- // However, the version from RN doesn't include header files.
92
- // To get those, we must fall back to the `hermes-engine` package.
93
- HERMES_ENGINE_DIR = new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).parent
94
- if (REACT_NATIVE_BUILD_FROM_SOURCE) {
95
- // TODO(@lukmccall): Use Hermes from the `ReactAndroid:hermes-engine`
96
- HERMES_AAR = file("$HERMES_ENGINE_DIR/android/hermes-debug.aar")
96
+ if (prebuiltHermesCacheHit) {
97
+ HERMES_HEADER_DIR = file("${thirdPartyNdkDir}/hermes/prefab/modules/libhermes/include")
98
+ HERMES_AAR = file("${prebuiltHermesDir}/hermes-engine-debug.aar")
99
+ } else if (hasHermesProject) {
100
+ HERMES_HEADER_DIR = file("${thirdPartyNdkDir}/hermes/prefab/modules/libhermes/include")
101
+ HERMES_AAR = file("${REACT_NATIVE_DIR}/ReactAndroid/hermes-engine/build/outputs/aar/hermes-engine-debug.aar")
97
102
  } else {
103
+ // The `hermes-engine` package doesn't contain the correct version of the Hermes.
104
+ // The AAR we need to import is located in the React Native package.
105
+ // However, the version from RN doesn't include header files.
106
+ // To get those, we must fall back to the `hermes-engine` package.
107
+ def hermesEngineDir = new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).parent
108
+
98
109
  def prebuiltAAR = fileTree(REACT_NATIVE_DIR).matching { include "**/hermes-engine/**/hermes-engine-*-debug.aar" }
99
110
  if (prebuiltAAR.any()) {
100
111
  HERMES_AAR = prebuiltAAR.singleFile
101
112
  } else {
102
- HERMES_AAR = file("$HERMES_ENGINE_DIR/android/hermes-debug.aar")
113
+ HERMES_AAR = file("${hermesEngineDir}/android/hermes-debug.aar")
103
114
  }
115
+ HERMES_HEADER_DIR = file("${hermesEngineDir}/android/include")
104
116
  }
105
117
  }
118
+ // END HERMES
119
+
106
120
 
107
121
  // Creating sources with comments
108
122
  task androidSourcesJar(type: Jar) {
@@ -144,7 +158,7 @@ android {
144
158
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
145
159
  consumerProguardFiles 'proguard-rules.pro'
146
160
  versionCode 1
147
- versionName "0.11.3"
161
+ versionName "0.11.4"
148
162
 
149
163
  testInstrumentationRunner "expo.modules.TestRunner"
150
164
 
@@ -156,7 +170,7 @@ android {
156
170
  "-DREACT_NATIVE_TARGET_VERSION=${REACT_NATIVE_TARGET_VERSION}",
157
171
  "-DBOOST_VERSION=${BOOST_VERSION}",
158
172
  "-DFOR_HERMES=${FOR_HERMES}",
159
- "-DHERMES_DIR=${HERMES_ENGINE_DIR}"
173
+ "-DHERMES_HEADER_DIR=${HERMES_HEADER_DIR}"
160
174
  }
161
175
  }
162
176
  }
@@ -264,7 +278,8 @@ dependencies {
264
278
  androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
265
279
 
266
280
  if (FOR_HERMES) {
267
- androidTestImplementation files(HERMES_AAR)
281
+ def hermesProject = findProject(":ReactAndroid:hermes-engine")
282
+ androidTestImplementation (hermesProject ?: files(HERMES_AAR))
268
283
  } else {
269
284
  androidTestImplementation "org.webkit:android-jsc:+"
270
285
  }
@@ -422,17 +437,19 @@ task prepareFolly(dependsOn: [downloadFolly], type: Copy) {
422
437
  }
423
438
  // END FOLLy
424
439
 
425
- task prepareHermes() {
440
+ task prepareHermes(dependsOn: createNativeDepsDirectories) {
426
441
  if (!FOR_HERMES) {
427
442
  return
428
443
  }
429
444
 
430
- def soFiles = zipTree(HERMES_AAR).matching({ it.include "**/*.so" })
445
+ doLast {
446
+ def files = zipTree(HERMES_AAR).matching({ it.include "**/*.so", "prefab/modules/libhermes/include/**/*" })
431
447
 
432
- copy {
433
- from soFiles
434
- from "$REACT_NATIVE_DIR/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
435
- into "$thirdPartyNdkDir/hermes"
448
+ copy {
449
+ from files
450
+ from "$REACT_NATIVE_DIR/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
451
+ into "$thirdPartyNdkDir/hermes"
452
+ }
436
453
  }
437
454
  }
438
455
 
@@ -441,10 +458,13 @@ task prepareThirdPartyNdkHeaders(dependsOn: [prepareBoost, prepareDoubleConversi
441
458
  afterEvaluate {
442
459
  extractAARHeaders.dependsOn(prepareThirdPartyNdkHeaders)
443
460
  extractJNIFiles.dependsOn(prepareThirdPartyNdkHeaders)
461
+ if (hasHermesProject && !prebuiltHermesCacheHit) {
462
+ prepareHermes.dependsOn(":ReactAndroid:hermes-engine:assembleDebug")
463
+ }
444
464
  }
445
465
 
446
466
  tasks.whenTaskAdded { task ->
447
- if (!task.name.contains("Clean") && (task.name.contains('externalNativeBuild') || task.name.startsWith('configureCMake'))) {
467
+ if (!task.name.contains("Clean") && (task.name.contains('externalNativeBuild') || task.name.startsWith('configureCMake') || task.name.startsWith('buildCMake'))) {
448
468
  def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
449
469
  task.dependsOn(extractAARHeaders)
450
470
  task.dependsOn(extractJNIFiles)
@@ -54,7 +54,7 @@ public class ModuleRegistryAdapter implements ReactPackage {
54
54
 
55
55
  List<NativeModule> nativeModules = getNativeModulesFromModuleRegistry(reactContext, moduleRegistry);
56
56
  if (mWrapperDelegateHolders != null) {
57
- KotlinInteropModuleRegistry kotlinInteropModuleRegistry = mModulesProxy.getKotlinInteropModuleRegistry();
57
+ KotlinInteropModuleRegistry kotlinInteropModuleRegistry = getOrCreateNativeModulesProxy(reactContext).getKotlinInteropModuleRegistry();
58
58
  kotlinInteropModuleRegistry.updateModuleHoldersInViewManagers(mWrapperDelegateHolders);
59
59
  }
60
60
 
@@ -64,8 +64,7 @@ public class ModuleRegistryAdapter implements ReactPackage {
64
64
  protected List<NativeModule> getNativeModulesFromModuleRegistry(ReactApplicationContext reactContext, ModuleRegistry moduleRegistry) {
65
65
  List<NativeModule> nativeModulesList = new ArrayList<>(2);
66
66
 
67
- mModulesProxy = createNativeModulesProxy(reactContext, moduleRegistry);
68
- nativeModulesList.add(mModulesProxy);
67
+ nativeModulesList.add(getOrCreateNativeModulesProxy(reactContext));
69
68
 
70
69
  // Add listener that will notify expo.modules.core.ModuleRegistry when all modules are ready
71
70
  nativeModulesList.add(new ModuleRegistryReadyNotifier(moduleRegistry));
@@ -94,8 +93,7 @@ public class ModuleRegistryAdapter implements ReactPackage {
94
93
  }
95
94
  }
96
95
 
97
- // We assume that `createNativeModules` was called first.
98
- NativeModulesProxy modulesProxy = Objects.requireNonNull(mModulesProxy);
96
+ NativeModulesProxy modulesProxy = Objects.requireNonNull(getOrCreateNativeModulesProxy(reactContext));
99
97
  KotlinInteropModuleRegistry kotlinInteropModuleRegistry = modulesProxy.getKotlinInteropModuleRegistry();
100
98
  List<ViewManager<?, ?>> kViewManager = kotlinInteropModuleRegistry.exportViewManagers();
101
99
  // Saves all holders that needs to be in sync with module registry
@@ -105,11 +103,15 @@ public class ModuleRegistryAdapter implements ReactPackage {
105
103
  return viewManagerList;
106
104
  }
107
105
 
108
- private NativeModulesProxy createNativeModulesProxy(ReactApplicationContext reactContext, ModuleRegistry moduleRegistry) {
109
- if (mModulesProvider != null) {
110
- return new NativeModulesProxy(reactContext, moduleRegistry, mModulesProvider);
111
- } else {
112
- return new NativeModulesProxy(reactContext, moduleRegistry);
106
+ private NativeModulesProxy getOrCreateNativeModulesProxy(ReactApplicationContext reactContext) {
107
+ if (mModulesProxy == null) {
108
+ ModuleRegistry moduleRegistry = mModuleRegistryProvider.get(reactContext);
109
+ if (mModulesProvider != null) {
110
+ mModulesProxy = new NativeModulesProxy(reactContext, moduleRegistry, mModulesProvider);
111
+ } else {
112
+ mModulesProxy = new NativeModulesProxy(reactContext, moduleRegistry);
113
+ }
113
114
  }
115
+ return mModulesProxy;
114
116
  }
115
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
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": "5d900179d047d9f4d89c0b9953b7121a1f1df8a2"
45
+ "gitHead": "3c7309583130b8cc6e2a54e69bda41ca9c709826"
46
46
  }