Skip to content

Commit a61c3cc

Browse files
committed
fix: hermesc path when building from different OS
1 parent c664069 commit a61c3cc

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

android/app/build.gradle

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ apply plugin: "org.jetbrains.kotlin.android"
33
apply plugin: "com.facebook.react"
44
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
55

6+
import org.gradle.internal.os.OperatingSystem
7+
68
/**
79
* This is the configuration block to customize your React Native Android app.
810
* By default you don't need to apply any configuration, just uncomment the lines you need.
@@ -48,7 +50,18 @@ apply plugin: 'org.jetbrains.kotlin.plugin.compose'
4850
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
4951
// hermesFlags = ["-O", "-output-source-map"]
5052

51-
hermesCommand = "../node_modules/react-native/node_modules/hermes-compiler/hermesc"
53+
def hermescDir = file("../node_modules/react-native/node_modules/hermes-compiler/hermesc")
54+
def os = OperatingSystem.current()
55+
56+
if (os.isMacOsX()) {
57+
hermesCommand = "${hermescDir}/osx-bin/hermesc"
58+
} else if (os.isLinux()) {
59+
hermesCommand = "${hermescDir}/linux64-bin/hermesc"
60+
} else if (os.isWindows()) {
61+
hermesCommand = "${hermescDir}/win64-bin/hermesc.exe"
62+
} else {
63+
throw new GradleException("Unsupported OS for Hermes compiler: " + OperatingSystem.current())
64+
}
5265

5366
/* Autolinking */
5467
autolinkLibrariesWithApp()

0 commit comments

Comments
 (0)