Skip to content

Commit

Permalink
a brand new jsc with full es6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
gengjiawen committed Nov 30, 2018
1 parent 76a59fa commit 22be730
Show file tree
Hide file tree
Showing 29 changed files with 123 additions and 32 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ buck-out
.gradle
local.properties
*.iml
/android/

# Node
node_modules
Expand Down
34 changes: 3 additions & 31 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -145,40 +145,13 @@ task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy)
}
}

task downloadJSCHeaders(type: Download) {
// in sync with webkit SVN revision 174650
def jscAPIBaseURL = 'https://raw.githubusercontent.com/WebKit/webkit/38b15a3ba3c1b0798f2036f7cea36ffdc096202e/Source/JavaScriptCore/API/'
def jscHeaderFiles = ['JavaScript.h', 'JSBase.h', 'JSContextRef.h', 'JSObjectRef.h', 'JSStringRef.h', 'JSValueRef.h', 'WebKitAvailability.h']
def output = new File(downloadsDir, 'jsc')
output.mkdirs()
src(jscHeaderFiles.collect { headerName -> "$jscAPIBaseURL$headerName" })
onlyIfNewer true
overwrite false
dest output
}

// Create Android.mk library module based on so files from mvn + include headers fetched from webkit.org
task prepareJSC(dependsOn: dependenciesPath ? [] : [downloadJSCHeaders]) {
doLast {
copy {
from zipTree(configurations.compile.fileCollection { dep -> dep.name == 'android-jsc' }.singleFile)
from dependenciesPath ? "$dependenciesPath/jsc-headers" : {downloadJSCHeaders.dest}
from 'src/main/jni/third-party/jsc'
include 'jni/**/*.so', '*.h', 'Android.mk'
filesMatching('*.h', { fname -> fname.path = "JavaScriptCore/${fname.path}"})
into "$thirdPartyNdkDir/jsc";
}
}
}

task downloadNdkBuildDependencies {
if (!boostPath) {
dependsOn downloadBoost
}
dependsOn downloadDoubleConversion
dependsOn downloadFolly
dependsOn downloadGlog
dependsOn downloadJSCHeaders
}

def getNdkBuildName() {
Expand Down Expand Up @@ -232,8 +205,8 @@ def getNdkBuildFullPath() {
return ndkBuildFullPath
}

task buildReactNdkLib(dependsOn: [prepareJSC, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog], type: Exec) {
inputs.dir('src/main/jni/react')
task buildReactNdkLib(dependsOn: [prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog], type: Exec) {
inputs.file('src/main/jni/react')
outputs.dir("$buildDir/react-ndk/all")
commandLine getNdkBuildFullPath(),
'NDK_PROJECT_PATH=null',
Expand Down Expand Up @@ -291,7 +264,7 @@ android {

sourceSets.main {
jni.srcDirs = []
jniLibs.srcDirs = ["$buildDir/react-ndk/exported", 'src/main/jni/third-party/jsc/jni']
jniLibs.srcDir "$buildDir/react-ndk/exported"
res.srcDirs = ['src/main/res/devsupport', 'src/main/res/shell', 'src/main/res/views/modal', 'src/main/res/views/uimanager']
java {
srcDirs = ['src/main/java', 'src/main/libraries/soloader/java', 'src/main/jni/first-party/fb/jni/java']
Expand Down Expand Up @@ -326,7 +299,6 @@ dependencies {
api "com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}"
api "com.squareup.okhttp3:okhttp-urlconnection:${OKHTTP_VERSION}"
api 'com.squareup.okio:okio:1.14.0'
compile 'org.webkit:android-jsc:r174650'

testImplementation "junit:junit:${JUNIT_VERSION}"
testImplementation "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}"
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified ReactAndroid/src/main/jniLibs/arm64-v8a/libjsc.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added ReactAndroid/src/main/jniLibs/x86/libjsc.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified ReactAndroid/src/main/jniLibs/x86_64/libjsc.so
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3bf7d42a505e3878d9b3fd427053d740
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
949a0e633e25584fcb596cca5aa7973f9315d1de
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
546e241acb2ec42c06e49ee9f58bd14a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f49f4d12ec374eb30a84a0d6a672d31fe7e05697
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
da9602ba065b990a156e7b14702f15b8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
89fce83b288a7a09e9dba9059f87a07eac1b3ded
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.facebook.react</groupId>
<artifactId>react-native</artifactId>
<version>1000.0.0-master</version>
<packaging>aar</packaging>
<name>ReactNative</name>
<description>A framework for building native apps with React</description>
<url>https://github.com/facebook/react-native</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/facebook/react-native/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>facebook</id>
<name>Facebook</name>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/facebook/react-native.git</connection>
<developerConnection>scm:git:git@github.com:facebook/react-native.git</developerConnection>
<url>https://github.com/facebook/react-native.git</url>
</scm>
<dependencies>
<dependency>
<groupId>com.facebook.infer.annotation</groupId>
<artifactId>infer-annotation</artifactId>
<version>0.11.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>fresco</artifactId>
<version>1.10.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>imagepipeline-okhttp3</artifactId>
<version>1.10.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.facebook.soloader</groupId>
<artifactId>soloader</artifactId>
<version>0.5.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.11.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-urlconnection</artifactId>
<version>3.11.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.14.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
71d16f7d3f09de1b71e6e910ec9b7ca7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
47e8a1696161d87980fe01eb764a61f5ed4469f6
12 changes: 12 additions & 0 deletions android/com/facebook/react/react-native/maven-metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.facebook.react</groupId>
<artifactId>react-native</artifactId>
<versioning>
<release>1000.0.0-master</release>
<versions>
<version>1000.0.0-master</version>
</versions>
<lastUpdated>20181118095153</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
325a338a06576678cc608e2079cfbf24
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0aa3165fa9f7ebb48853209e94a7a64d39808a39
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
"inquirer": "^3.0.6",
"jest": "24.0.0-alpha.6",
"jest-junit": "5.2.0",
"jsc-android": "^236355.1.0",
"lodash": "^4.17.5",
"metro": "0.50.0",
"metro-babel-register": "0.50.0",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3938,6 +3938,11 @@ jsbn@~0.1.0:
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM=

jsc-android@^236355.1.0:
version "236355.1.0"
resolved "https://registry.yarnpkg.com/jsc-android/-/jsc-android-236355.1.0.tgz#aba6330b9ff9c49632abe50bfc3e5def5c08af58"
integrity sha512-6W6KH19eHNjn6jQF9lgV8Www10iBgmUnLwDgmEmI7zQ+/apjz6seCaMQLTD16aXIer6cgGQa7RRavPskydJ2KA==

jsdom@^11.5.1:
version "11.12.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8"
Expand Down

0 comments on commit 22be730

Please sign in to comment.