@shopify/react-native-skia 0.1.174 → 0.1.175

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ set (CMAKE_VERBOSE_MAKEFILE ON)
5
5
  set (CMAKE_CXX_STANDARD 17)
6
6
  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_GL -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID")
7
7
 
8
- set (PACKAGE_NAME "reactskia")
8
+ set (PACKAGE_NAME "rnskia")
9
9
  set (SKIA_LIB "skia")
10
10
  set (SKIA_SVG_LIB "svg")
11
11
  set (SKIA_SKSHAPER_LIB "skshaper")
@@ -31,7 +31,7 @@ link_directories(../libs/android/${ANDROID_ABI}/)
31
31
 
32
32
  if(${REACT_NATIVE_VERSION} LESS 66)
33
33
  file(
34
- TO_CMAKE_PATH
34
+ TO_CMAKE_PATH
35
35
  "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
36
36
  INCLUDE_JSI_CPP
37
37
  )
@@ -59,7 +59,7 @@ add_library(
59
59
  "${PROJECT_SOURCE_DIR}/cpp/rnskia/dom/base/ConcatablePaint.cpp"
60
60
 
61
61
  "${PROJECT_SOURCE_DIR}/cpp/api/third_party/CSSColorParser.cpp"
62
-
62
+
63
63
  )
64
64
 
65
65
  target_include_directories(
@@ -92,7 +92,7 @@ target_include_directories(
92
92
  cpp/rnskia/dom/base
93
93
  cpp/rnskia/dom/nodes
94
94
  cpp/rnskia/dom/props
95
- cpp/utils
95
+ cpp/utils
96
96
 
97
97
  ${libfbjni_include_DIRS}
98
98
  )
@@ -205,4 +205,4 @@ target_link_libraries(
205
205
  -lGLESv2
206
206
  -lEGL
207
207
  -landroid
208
- )
208
+ )
@@ -80,6 +80,7 @@ def reactProperties = new Properties()
80
80
  file("$nodeModules/react-native/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
81
81
  def FULL_RN_VERSION = (System.getenv("REACT_NATIVE_OVERRIDE_VERSION") ?: reactProperties.getProperty("VERSION_NAME"))
82
82
  def REACT_NATIVE_VERSION = FULL_RN_VERSION.split("\\.")[1].toInteger()
83
+ def ENABLE_PREFAB = REACT_NATIVE_VERSION > 68
83
84
 
84
85
  logger.warn("react-native-skia: RN Version: ${REACT_NATIVE_VERSION} / ${FULL_RN_VERSION}")
85
86
  logger.warn("react-native-skia: isSourceBuild: ${sourceBuild}")
@@ -87,6 +88,7 @@ logger.warn("react-native-skia: PrebuiltDir: ${prebuiltDir}")
87
88
  logger.warn("react-native-skia: buildType: ${buildType}")
88
89
  logger.warn("react-native-skia: buildDir: ${buildDir}")
89
90
  logger.warn("react-native-skia: node_modules: ${nodeModules}")
91
+ logger.warn("react-native-skia: Enable Prefab: ${ENABLE_PREFAB}")
90
92
 
91
93
  buildscript {
92
94
  // The Android Gradle plugin is only required when opening the android folder stand-alone.
@@ -132,14 +134,10 @@ android {
132
134
 
133
135
  externalNativeBuild {
134
136
  cmake {
135
- path file('CMakeLists.txt')
137
+ path file('CMakeLists.txt')
136
138
  }
137
139
  }
138
140
 
139
- buildFeatures {
140
- prefab true
141
- }
142
-
143
141
  packagingOptions {
144
142
  excludes = [
145
143
  "**/libc++_shared.so",
@@ -150,6 +148,18 @@ android {
150
148
  ]
151
149
  }
152
150
 
151
+ if (ENABLE_PREFAB) {
152
+ buildFeatures {
153
+ prefab true
154
+ prefabPublishing true
155
+ }
156
+ prefab {
157
+ rnskia {
158
+ headers "${project.buildDir}/headers/rnskia/"
159
+ }
160
+ }
161
+ }
162
+
153
163
  // Create new configurations that can be referred to in dependencies.
154
164
  // The Android Gradle Plugin 3.* does not allow hooking into existing
155
165
  // configurations like `implementation`.
@@ -255,6 +265,15 @@ task extractJNIFiles {
255
265
 
256
266
  extractJNIFiles.mustRunAfter extractAARHeaders
257
267
 
268
+ if (ENABLE_PREFAB) {
269
+ task prepareHeaders(type: Copy) {
270
+ from fileTree('../cpp').filter { it.isFile() }
271
+ into "${project.buildDir}/headers/rnskia/"
272
+ includeEmptyDirs = false
273
+ }
274
+ preBuild.dependsOn(prepareHeaders)
275
+ }
276
+
258
277
  def nativeBuildDependsOn(dependsOnTask, variant) {
259
278
  def buildTasks = tasks.findAll({ task ->
260
279
  !task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake")) })
@@ -266,5 +285,5 @@ def nativeBuildDependsOn(dependsOnTask, variant) {
266
285
 
267
286
  afterEvaluate {
268
287
  nativeBuildDependsOn(extractAARHeaders, null)
269
- nativeBuildDependsOn(extractJNIFiles, null)
270
- }
288
+ nativeBuildDependsOn(extractJNIFiles, null)
289
+ }
@@ -57,7 +57,7 @@ public class RNSkiaModule extends ReactContextBaseJavaModule implements Lifecycl
57
57
  }
58
58
 
59
59
  try {
60
- System.loadLibrary("reactskia");
60
+ System.loadLibrary("rnskia");
61
61
  ReactApplicationContext context = weakReactContext.get();
62
62
  if (context == null) {
63
63
  Log.e(NAME, "React Application Context was null!");
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "0.1.174",
10
+ "version": "0.1.175",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [