Skip to content

Commit

Permalink
fix android builds: update hermes commit hash (#7781)
Browse files Browse the repository at this point in the history
## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

**Patch file update breaks GH diff. Line 92 is the only change made.**

```diff
-def hermesVersion = "ae2ac688c3faf868d2360a10a7791226ed5702fb"
+def hermesVersion = "52725e889185e53277e629f1f7043aa2913c97a9"
```

android build fails with xcode 15 command line tools.

```
node_modules/react-native/sdks/hermes/lib/Support/Semaphore.cpp:35:3: error: use of undeclared identifier 'assert'
  assert(semPtr_ != nullptr && "sem_open should have succeeded");
  ^
1 error generated.
make[3]: *** [lib/Support/CMakeFiles/hermesSupport.dir/Semaphore.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [lib/Support/CMakeFiles/hermesSupport.dir/all] Error 2
make[1]: *** [tools/hermesc/CMakeFiles/hermesc.dir/rule] Error 2
make: *** [hermesc] Error 2
```

`#include <cassert>` is needed to bring assert implementation

See changes on our hermes fork

MetaMask/hermes@52725e8


## **Related issues**

Fixes: #

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained what problem this PR is solving and how it
is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
jpcloureiro authored Nov 14, 2023
1 parent bffa164 commit 133978f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions patches/react-native+0.71.14.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ index 1379ffd..340f48d 100644
--- a/node_modules/react-native/Libraries/Core/InitializeCore.js
+++ b/node_modules/react-native/Libraries/Core/InitializeCore.js
@@ -24,26 +24,51 @@

'use strict';

+const Platform = require('../Utilities/Platform');
+
+if (Platform.OS === 'ios' && !global?.HermesInternal) {
Expand All @@ -27,7 +27,7 @@ index 1379ffd..340f48d 100644
+}
+
const start = Date.now();

require('./setUpGlobals');
+// require('./setUpDOM'); Introduced in RN v0.72, ensure included when upgrading patch
require('./setUpPerformance');
Expand All @@ -50,18 +50,18 @@ index 1379ffd..340f48d 100644
+ require('./setUpDeveloperTools'); // console.log calls visible in Metro from here
require('../LogBox/LogBox').install();
}

-require('../ReactNative/AppRegistry');
+require('../ReactNative/AppRegistry'); // reflect-metadata imported after here causes: https://github.com/LavaMoat/docs/issues/26

const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger');
// We could just call GlobalPerformanceLogger.markPoint at the top of the file,
diff --git a/node_modules/react-native/ReactAndroid/build.gradle b/node_modules/react-native/ReactAndroid/build.gradle
index 155cb59..053550c 100644
--- a/node_modules/react-native/ReactAndroid/build.gradle
+++ b/node_modules/react-native/ReactAndroid/build.gradle
@@ -420,12 +420,9 @@ android {

// Used to override the NDK path/version on internal CI or by allowing
// users to customize the NDK path/version from their root project (e.g. for M1 support)
- if (rootProject.hasProperty("ndkPath")) {
Expand All @@ -73,7 +73,7 @@ index 155cb59..053550c 100644
+
+ // Added patch to apply ndk Path from MetaMask app gradle.build this is required for M1 Bitrise builds to work
+ ndkPath = project.getProperties().get("ndkPath")

defaultConfig {
minSdkVersion(21)
diff --git a/node_modules/react-native/ReactAndroid/hermes-engine/build.gradle b/node_modules/react-native/ReactAndroid/hermes-engine/build.gradle
Expand All @@ -83,31 +83,31 @@ index c714f87..dca2750 100644
@@ -43,11 +43,11 @@ def overrideHermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") != nul
def hermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") ?: new File(reactNativeRootDir, "sdks/hermes")
def hermesBuildDir = new File("$buildDir/hermes")

-def hermesVersion = "main"
-def hermesVersionFile = new File(reactNativeRootDir, "sdks/.hermesversion")
-if (hermesVersionFile.exists()) {
- hermesVersion = hermesVersionFile.text
-}
+def hermesVersion = "ae2ac688c3faf868d2360a10a7791226ed5702fb"
+def hermesVersion = "52725e889185e53277e629f1f7043aa2913c97a9"
+// def hermesVersionFile = new File(reactNativeRootDir, "sdks/.hermesversion")
+// if (hermesVersionFile.exists()) {
+// hermesVersion = hermesVersionFile.text
+// }
def ndkBuildJobs = Runtime.runtime.availableProcessors().toString()
def prefabHeadersDir = new File("$buildDir/prefab-headers")

@@ -59,7 +59,7 @@ def skipPrefabPublishing = System.getenv("REACT_NATIVE_HERMES_SKIP_PREFAB") != n
def jsiDir = new File(reactNativeRootDir, "ReactCommon/jsi")

task downloadHermes(type: Download) {
- src("https://github.com/facebook/hermes/tarball/${hermesVersion}")
+ src("https://github.com/MetaMask/hermes/tarball/${hermesVersion}")
onlyIfNewer(true)
overwrite(false)
dest(new File(downloadsDir, "hermes.tar.gz"))
@@ -120,12 +120,9 @@ android {

// Used to override the NDK path/version on internal CI or by allowing
// users to customize the NDK path/version from their root project (e.g. for M1 support)
- if (rootProject.hasProperty("ndkPath")) {
Expand All @@ -119,7 +119,7 @@ index c714f87..dca2750 100644
+
+ // Added patch to apply ndk Path from MetaMask app gradle.build this is required for M1 Bitrise builds to work
+ ndkPath = project.getProperties().get("ndkPath")

defaultConfig {
minSdkVersion 21
diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
Expand All @@ -137,7 +137,7 @@ index 290bd23..20d85e0 100644
@@ -94,6 +95,16 @@ public class ReactEditText extends AppCompatEditText
/** A count of events sent to JS or C++. */
protected int mNativeEventCount;

+ /**
+ * Taken from EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING We can't use that
+ * value directly as it was only added on Oreo, but we can apply the value
Expand All @@ -149,7 +149,7 @@ index 290bd23..20d85e0 100644
+ /** Samsung Device Check */
+ private static final Boolean IS_SAMSUNG_DEVICE = Build.MANUFACTURER.equals(SAMSUNG_MANUFACTURER_NAME);
private static final int UNSET = -1;

private @Nullable ArrayList<TextWatcher> mListeners;
@@ -253,16 +264,24 @@ public class ReactEditText extends AppCompatEditText
@Override
Expand Down

0 comments on commit 133978f

Please sign in to comment.