From 62af6f1ed876756135ca24ec47075dee5665d7c6 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Tue, 27 Feb 2018 21:34:30 +0000 Subject: [PATCH] ios: use file to override native modules build Reads the contents of a react-native project's file for overriding the automatic native modules detection. --- scripts/module-postlink.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/module-postlink.js b/scripts/module-postlink.js index f4f0d31..df6bc14 100644 --- a/scripts/module-postlink.js +++ b/scripts/module-postlink.js @@ -148,6 +148,15 @@ if ( detectedConfigs && detectedConfigs.ios && detectedConfigs.ios.pbxprojPath) var rebuildNativeModulesBuildPhaseScript = ` set -e if [ -z "$NODEJS_MOBILE_BUILD_NATIVE_MODULES" ]; then +# If build native modules preference is not set, look for it in the project's +#nodejs-assets/BUILD_NATIVE_MODULES.txt file. +NODEJS_ASSETS_DIR="$( cd "$PROJECT_DIR" && cd ../nodejs-assets/ && pwd )" +PREFERENCE_FILE_PATH="$NODEJS_ASSETS_DIR/BUILD_NATIVE_MODULES.txt" +if [ -f "$PREFERENCE_FILE_PATH" ]; then + NODEJS_MOBILE_BUILD_NATIVE_MODULES="$(cat $PREFERENCE_FILE_PATH | xargs)" +fi +fi +if [ -z "$NODEJS_MOBILE_BUILD_NATIVE_MODULES" ]; then # If build native modules preference is not set, try to find .gyp files #to turn it on. gypfiles=($(find "$CODESIGNING_FOLDER_PATH/nodejs-project/" -type f -name "*.gyp")) @@ -192,6 +201,15 @@ popd var signNativeModulesBuildPhaseScript = ` set -e if [ -z "$NODEJS_MOBILE_BUILD_NATIVE_MODULES" ]; then +# If build native modules preference is not set, look for it in the project's +#nodejs-assets/BUILD_NATIVE_MODULES.txt file. +NODEJS_ASSETS_DIR="$( cd "$PROJECT_DIR" && cd ../nodejs-assets/ && pwd )" +PREFERENCE_FILE_PATH="$NODEJS_ASSETS_DIR/BUILD_NATIVE_MODULES.txt" +if [ -f "$PREFERENCE_FILE_PATH" ]; then + NODEJS_MOBILE_BUILD_NATIVE_MODULES="$(cat $PREFERENCE_FILE_PATH | xargs)" +fi +fi +if [ -z "$NODEJS_MOBILE_BUILD_NATIVE_MODULES" ]; then # If build native modules preference is not set, try to find .gyp files #to turn it on. gypfiles=($(find "$CODESIGNING_FOLDER_PATH/nodejs-project/" -type f -name "*.gyp"))