Skip to content

Commit

Permalink
fix: autolinking bug on Windows when reading config (react-native-com…
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr authored and dratwas committed Jul 12, 2019
1 parent 998cf9c commit 3268a50
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/platform-android/native_modules.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,23 @@ class ReactNativeModules {

def cmdProcess
def root = getReactNativeProjectRoot()
def command = "./node_modules/.bin/react-native config"

def command = "node ./node_modules/react-native/cli.js config"
def reactNativeConfigOutput = ""

try {
cmdProcess = Runtime.getRuntime().exec(command, null, root)
cmdProcess.waitFor()
def inputStreamReader = new InputStreamReader(cmdProcess.getInputStream())
def bufferedReader = new BufferedReader(inputStreamReader)
def line = null
while ((line = bufferedReader.readLine()) != null){
reactNativeConfigOutput += line
}
} catch (Exception exception) {
this.logger.warn("${LOG_PREFIX}${exception.message}")
this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed.")
return reactNativeModules
}

def reactNativeConfigOutput = cmdProcess.in.text
def json = new JsonSlurper().parseText(reactNativeConfigOutput)
this.packageName = json["project"]["android"]["packageName"]
def dependencies = json["dependencies"]
Expand Down

0 comments on commit 3268a50

Please sign in to comment.