@@ -2,6 +2,18 @@ import java.nio.file.Paths
22import groovy.json.JsonSlurper
33import org.gradle.internal.os.OperatingSystem
44
5+ if (! System . getenv(" REACT_NATIVE_OVERRIDE_HERMES_DIR" )) {
6+ throw new GradleException ([
7+ " React Native Node-API needs a custom version of Hermes with Node-API enabled." ,
8+ " Run the following in your terminal, to clone Hermes and instruct React Native to use it:" ,
9+ " " ,
10+ " export REACT_NATIVE_OVERRIDE_HERMES_DIR=\$ (npx react-native-node-api vendor-hermes --silent --force)" ,
11+ " " ,
12+ " And follow this guide to build React Native from source:" ,
13+ " https://reactnative.dev/contributing/how-to-build-from-source#update-your-project-to-build-from-source"
14+ ]. join(' \n ' ))
15+ }
16+
517buildscript {
618 ext. getExtOrDefault = {name ->
719 return rootProject. ext. has(name) ? rootProject. ext. get(name) : project. properties[' NodeApiModules_' + name]
@@ -135,22 +147,6 @@ dependencies {
135147 implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
136148}
137149
138- task checkHermesOverride {
139- doFirst {
140- if (! System . getenv(" REACT_NATIVE_OVERRIDE_HERMES_DIR" )) {
141- throw new GradleException ([
142- " React Native Node-API needs a custom version of Hermes with Node-API enabled." ,
143- " Run the following in your terminal, to clone Hermes and instruct React Native to use it:" ,
144- " " ,
145- " export REACT_NATIVE_OVERRIDE_HERMES_DIR=\$ (npx react-native-node-api vendor-hermes --silent --force)" ,
146- " " ,
147- " And follow this guide to build React Native from source:" ,
148- " https://reactnative.dev/contributing/how-to-build-from-source#update-your-project-to-build-from-source"
149- ]. join(' \n ' ))
150- }
151- }
152- }
153-
154150def commandLinePrefix = OperatingSystem . current(). isWindows() ? [" cmd" , " /c" , " node" ] : []
155151def cliPath = file(" ../bin/react-native-node-api.mjs" )
156152
@@ -169,5 +165,5 @@ task linkNodeApiModules {
169165 }
170166}
171167
172- preBuild. dependsOn checkHermesOverride, linkNodeApiModules
168+ preBuild. dependsOn linkNodeApiModules
173169
0 commit comments