Skip to content

Commit

Permalink
android: use file to override native modules build
Browse files Browse the repository at this point in the history
Reads the contents of a react-native project's file for overriding
the automatic native modules detection.
  • Loading branch information
jaimecbernardo committed Feb 27, 2018
1 parent 41f7dce commit fabbd6b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ import org.gradle.internal.os.OperatingSystem;

String shouldRebuildNativeModules = System.getenv('NODEJS_MOBILE_BUILD_NATIVE_MODULES');

if (shouldRebuildNativeModules==null) {
// If the environment variable is not set right now, check if it has been saved to a file.
def nativeModulesPreferenceFile = file("${rootProject.projectDir}/../nodejs-assets/BUILD_NATIVE_MODULES.txt");
if (nativeModulesPreferenceFile.exists()) {
shouldRebuildNativeModules=nativeModulesPreferenceFile.text.trim();
}
}

if (shouldRebuildNativeModules==null) {
// If build native modules preference is not set, try to find .gyp files to turn it on.
shouldRebuildNativeModules="0";
Expand Down

0 comments on commit fabbd6b

Please sign in to comment.