Closed zxcpoiu closed 4 years ago
Hey, thank you for the contribution. The change looks good to me. Just a Nit: If the environment is in yarn workspace and package be hoisted, the path might be different. Upstream build.gradle has a better solution - the findNodeModulePath. Do you mind to revise to use findNodeModulePath?
Sure!
I was testing on 0.61, so missed the findNodeModulePath
part
Thanks for pointed out. Updated.
Thank you @zxcpoiu. That's awesome 🔥 and I am going to merge this.
Motivation
The
$projectDir
for prebuilding v8 RN on the local machine is located at/path/to/react-native-v8/build/ReactAndroid
.This project is prebuilding V8 version of RN and publish to npm. The
ReactAndroid
path may located at/path/to/react-native-v8/build/ReactAndroid
And thev8-android
is installed at/path/to/react-native-v8/node_modules/v8-android
But for users who have forked RN source and with this v8 patch, it builds ReactAndroid AAR manually. The
ReactAndroid
path may located at/path/to/app/node_modules/react-native/ReactAndroid
And thev8-android
is installed at/path/to/app/node_modules/v8-android
Fix
This PR assumes
$projectDir
is/path/to/react-native-v8/build/ReactAndroid
as it is now, if the dir does not exist, fallback to/path/to/app/node_modules/react-native/ReactAndroid
No breaking changes.
Fix 2 ( updated )
Use
findNodeModulePath
introduced since RN 62, which is is a better algo to solve this.