File tree Expand file tree Collapse file tree 5 files changed +58
-10
lines changed Expand file tree Collapse file tree 5 files changed +58
-10
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,15 @@ cmake_minimum_required(VERSION 3.13)
22set (CMAKE_VERBOSE_MAKEFILE on )
33project (jsc-android)
44
5- add_library (jsclib SHARED IMPORTED GLOBAL )
5+ add_library (jsc SHARED empty.cpp )
66
7- set_target_properties (jsclib
8- PROPERTIES
9- IMPORTED_LOCATION
10- "${PREBUILT_LIBS_DIR} /${ANDROID_ABI} /libjsc.so" )
7+ set (OUTPUT_SRC "${PREBUILT_LIBS_DIR} /${ANDROID_ABI} /libjsc.so" )
8+ set (OUTPUT_DST "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /libjsc.so" )
119
12- add_library (jsc SHARED empty.cpp)
10+ add_custom_command (
11+ TARGET jsc POST_BUILD
12+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
13+ ${OUTPUT_SRC}
14+ ${OUTPUT_DST}
15+ COMMENT "Overwriting ${OUTPUT_SRC} to ${OUTPUT_DST} "
16+ )
Original file line number Diff line number Diff line change @@ -56,7 +56,6 @@ android {
5656
5757 prefab {
5858 jsc {
59- headerOnly true
6059 headers file(headersDir). absolutePath
6160 }
6261 }
Original file line number Diff line number Diff line change 2626 "web" : {
2727 "favicon" : " ./assets/favicon.png"
2828 },
29- "jsEngine" : " jsc"
29+ "jsEngine" : " jsc" ,
30+ "plugins" : [" ./plugins/withJscAndroid" ]
3031 }
3132}
Original file line number Diff line number Diff line change 66 "start" : " expo start" ,
77 "android" : " expo run:android" ,
88 "ios" : " expo run:ios" ,
9- "web" : " expo start --web" ,
10- "postinstall" : " rm -rf node_modules/jsc-android/dist && cd node_modules/jsc-android && ln -s ../../../dist"
9+ "web" : " expo start --web"
1110 },
1211 "dependencies" : {
1312 "expo" : " ~52.0.7" ,
Original file line number Diff line number Diff line change 1+ const assert = require ( 'assert' ) ;
2+ const { withProjectBuildGradle } = require ( 'expo/config-plugins' ) ;
3+
4+ const withJscAndroidProjectBuildGradle = ( config ) => {
5+ return withProjectBuildGradle ( config , ( config ) => {
6+ assert ( config . modResults . language === 'groovy' ) ;
7+ if ( ! config . modResults . contents . match ( / \/ \/ L o c a l d i s t m a v e n r e p o / ) ) {
8+ const mavenRepo = `
9+ maven {
10+ // Local dist maven repo
11+ url('../../dist')
12+ }` ;
13+ config . modResults . contents = config . modResults . contents . replace (
14+ / ^ ( a l l p r o j e c t s \{ [ \s \S ] + ?r e p o s i t o r i e s \{ ) / gm,
15+ `$1${ mavenRepo } `
16+ ) ;
17+ }
18+
19+ if (
20+ ! config . modResults . contents . match (
21+ / i o \. g i t h u b \. r e a c t - n a t i v e - c o m m u n i t y : j s c - a n d r o i d : /
22+ )
23+ ) {
24+ config . modResults . contents += `
25+ allprojects {
26+ configurations.all {
27+ resolutionStrategy.dependencySubstitution {
28+ substitute(module('org.webkit:android-jsc'))
29+ .using(module('io.github.react-native-community:jsc-android:+'))
30+ }
31+ }
32+ }
33+ ` ;
34+ }
35+
36+ return config ;
37+ } ) ;
38+ } ;
39+
40+ const withJscAndroid = ( config ) => {
41+ config = withJscAndroidProjectBuildGradle ( config ) ;
42+ return config ;
43+ } ;
44+
45+ module . exports = withJscAndroid ;
You can’t perform that action at this time.
0 commit comments