Skip to content

Commit

Permalink
plugin: use alternative nodejs-mobile-gyp path
Browse files Browse the repository at this point in the history
Tries to use nodejs-mobile-gyp from the cordova app's base
'node_modules' path if it isn't found within the plugin's
'node_modules'.
  • Loading branch information
jaimecbernardo committed Jun 7, 2018
1 parent e14bcc7 commit 3cf9b28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions install/hooks/ios/after-plugin-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ if [ -z "$NODEJS_MOBILE_BUILD_NATIVE_MODULES" ]; then
fi
if [ "1" != "$NODEJS_MOBILE_BUILD_NATIVE_MODULES" ]; then exit 0; fi
# Get the nodejs-mobile-gyp location
if [ -d "$PROJECT_DIR/../../plugins/nodejs-mobile-cordova/node_modules/nodejs-mobile-gyp/" ]; then
NODEJS_MOBILE_GYP_DIR="$( cd "$PROJECT_DIR" && cd ../../plugins/nodejs-mobile-cordova/node_modules/nodejs-mobile-gyp/ && pwd )"
else
NODEJS_MOBILE_GYP_DIR="$( cd "$PROJECT_DIR" && cd ../../node_modules/nodejs-mobile-gyp/ && pwd )"
fi
NODEJS_MOBILE_GYP_BIN_FILE="$NODEJS_MOBILE_GYP_DIR"/bin/node-gyp.js
# Rebuild modules with right environment
NODEJS_HEADERS_DIR="$( cd "$( dirname "$PRODUCT_SETTINGS_PATH" )" && cd Plugins/nodejs-mobile-cordova/ && pwd )"
Expand Down
8 changes: 7 additions & 1 deletion src/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ if ("1".equals(shouldRebuildNativeModules)) {
//environment ('PATH', "${npm_toolchain_add_to_path}" + System.getProperty("path.separator") + "${System.env.PATH}")
environment ('npm_config_node_engine', 'v8' )
environment ('npm_config_nodedir', "${project.projectDir}/src/com/janeasystems/cdvnodejsmobile/jni/libnode/" )
environment ('npm_config_node_gyp', "${rootProject.projectDir}/../../plugins/nodejs-mobile-cordova/node_modules/nodejs-mobile-gyp/bin/node-gyp.js" )
String npm_gyp_path_to_use;
if( file("${rootProject.projectDir}/../../plugins/nodejs-mobile-cordova/node_modules/nodejs-mobile-gyp/bin/node-gyp.js").exists() ) {
npm_gyp_path_to_use = "${rootProject.projectDir}/../../plugins/nodejs-mobile-cordova/node_modules/nodejs-mobile-gyp/bin/node-gyp.js";
} else {
npm_gyp_path_to_use = "${rootProject.projectDir}/../../node_modules/nodejs-mobile-gyp/bin/node-gyp.js";
}
environment ('npm_config_node_gyp', npm_gyp_path_to_use)
environment ('npm_config_arch', temp_arch)
environment ('npm_config_platform', 'android')
environment ('npm_config_format', 'make-android')
Expand Down

0 comments on commit 3cf9b28

Please sign in to comment.