Kudo/react-native-v8

CMake build error due to incorrect absolute RN_DIR path

BrechtBD opened this issue · 0 comments

I'm getting a cmake error when building the react-native application with react-native-v8 version 1.4.0

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-v8:generateJsonModelDebug'.
> C:\DEV\...\node_modules\react-native-v8\android\CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Error at C:\DEV\p...\node_modules\react-native-v8\android\CMakeLists.txt:117 (add_library):
    Syntax error in cmake code when parsing string

      C:\DEV\...\node_modules\react-native/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp;C:\DEV\projects\delijn\ControleApp\node_modules\react-native/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp

    Invalid character escape '\D'.

I believe it's because following piece of code returns the RN_DIR path using backward slashes (while it should be forward slashes?):

File findNodePackageDir(String packageName, boolean absolute = true) {
def nodeCommand = ["node", "--print", "require.resolve('${packageName}/package.json')"]
def proc = nodeCommand.execute(null, rootDir)
def error = proc.err.text
if (error) {
throw new GradleException("findNodePackageDir() execution failed - nodeCommand[${nodeCommand.join(' ')}]\n" + error)
}
def dir = new File(proc.text.trim()).getParentFile()
return absolute ? dir.getAbsoluteFile() : dir
}