File tree 5 files changed +58
-10
lines changed
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)
2
2
set (CMAKE_VERBOSE_MAKEFILE on )
3
3
project (jsc-android)
4
4
5
- add_library (jsclib SHARED IMPORTED GLOBAL )
5
+ add_library (jsc SHARED empty.cpp )
6
6
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" )
11
9
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 {
56
56
57
57
prefab {
58
58
jsc {
59
- headerOnly true
60
59
headers file(headersDir). absolutePath
61
60
}
62
61
}
Original file line number Diff line number Diff line change 26
26
"web" : {
27
27
"favicon" : " ./assets/favicon.png"
28
28
},
29
- "jsEngine" : " jsc"
29
+ "jsEngine" : " jsc" ,
30
+ "plugins" : [" ./plugins/withJscAndroid" ]
30
31
}
31
32
}
Original file line number Diff line number Diff line change 6
6
"start" : " expo start" ,
7
7
"android" : " expo run:android" ,
8
8
"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"
11
10
},
12
11
"dependencies" : {
13
12
"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