Skip to content

Commit

Permalink
Fix jsc-android not found if building from source (#24547)
Browse files Browse the repository at this point in the history
Summary:
If an app [builds from RN source](https://facebook.github.io/react-native/docs/building-from-source), there was an error for jsc-android not found.
It is a side effect of my previous [JSC as node dependency change](8e37585)
For building from RN source case, the jsc-android is located at `/path/to/app/node_modules/jsc-android`.
Original gradle task will try to find it at `/path/to/app/node_modules/react-native/ReactAndroid/../node_modules/jsc-android`, as ReactAndroid project path was being override inside node_modules.
The change fixes the building from source case.

N/A
This change does not need to publish into changelog, as it is a master branch building fix.
Pull Request resolved: #24547

Differential Revision: D15044703

Pulled By: cpojer

fbshipit-source-id: a7d824b1a14064d46c4a2ec9ea28255179174c83
  • Loading branch information
Kudo authored and facebook-github-bot committed Apr 23, 2019
1 parent 7ac1d18 commit 040502b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,16 @@ task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy)
// Create Android.mk library module based on jsc from npm
task prepareJSC {
doLast {
def jscPackageRoot = fileTree("$projectDir/../node_modules/jsc-android/dist")
def jscAAR = jscPackageRoot.matching({ it.include "**/android-jsc/**/*.aar" }).singleFile
def jscPackageRoot = file("$projectDir/../node_modules/jsc-android/dist")
if (!jscPackageRoot.exists()) {
// For an app to build from RN source, the jsc-android is located at /path/to/app/node_modules
// and $projectDir may located at /path/to/app/node_modules/react-native/ReactAndroid
jscPackageRoot = file("$projectDir/../../jsc-android/dist")
}
def jscAAR = fileTree(jscPackageRoot).matching({ it.include "**/android-jsc/**/*.aar" }).singleFile
def soFiles = zipTree(jscAAR).matching({ it.include "**/*.so" })

def headerFiles = jscPackageRoot.matching({ it.include "**/include/*.h" })
def headerFiles = fileTree(jscPackageRoot).matching({ it.include "**/include/*.h" })

copy {
from(soFiles)
Expand Down

0 comments on commit 040502b

Please sign in to comment.