@shopify/react-native-skia 0.1.170 → 0.1.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +62 -34
 - package/android/build.gradle +20 -10
 - package/package.json +1 -1
 
    
        package/android/CMakeLists.txt
    CHANGED
    
    | 
         @@ -12,6 +12,11 @@ set (SKIA_SKSHAPER_LIB "skshaper") 
     | 
|
| 
       12 
12 
     | 
    
         
             
            #set (SKIA_SKPARAGRAPH_LIB "skparagraph")
         
     | 
| 
       13 
13 
     | 
    
         
             
            #set (SKIA_SKUNICODE_LIB "skunicode")
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
      
 15 
     | 
    
         
            +
            # Clear some variables
         
     | 
| 
      
 16 
     | 
    
         
            +
            unset(LIBRN_DIR CACHE)
         
     | 
| 
      
 17 
     | 
    
         
            +
            unset(libfbjni_link_DIRS CACHE)
         
     | 
| 
      
 18 
     | 
    
         
            +
            unset(libfbjni_include_DIRS CACHE)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       15 
20 
     | 
    
         
             
            set(build_DIR ${CMAKE_SOURCE_DIR}/build)
         
     | 
| 
       16 
21 
     | 
    
         
             
            file(GLOB LIBRN_DIR "${PREBUILT_DIR}/${ANDROID_ABI}")
         
     | 
| 
       17 
22 
     | 
    
         
             
            file(GLOB libfbjni_link_DIRS "${build_DIR}/fbjni*.aar/jni/${ANDROID_ABI}")
         
     | 
| 
         @@ -114,49 +119,72 @@ find_library( 
     | 
|
| 
       114 
119 
     | 
    
         
             
                    LOG_LIB
         
     | 
| 
       115 
120 
     | 
    
         
             
                    log
         
     | 
| 
       116 
121 
     | 
    
         
             
            )
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
122 
     | 
    
         
             
            message("-- LOG     : " ${LOG_LIB})
         
     | 
| 
       119 
123 
     | 
    
         | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
              
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
                     find_library(
         
     | 
| 
       126 
     | 
    
         
            -
                             JSI_LIB
         
     | 
| 
       127 
     | 
    
         
            -
                             jsi
         
     | 
| 
       128 
     | 
    
         
            -
                             PATHS ${LIBRN_DIR}
         
     | 
| 
       129 
     | 
    
         
            -
                             NO_CMAKE_FIND_ROOT_PATH
         
     | 
| 
       130 
     | 
    
         
            -
                     )
         
     | 
| 
       131 
     | 
    
         
            -
             endif()
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
             message("-- JSI     : " ${JSI_LIB})
         
     | 
| 
      
 124 
     | 
    
         
            +
            if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
         
     | 
| 
      
 125 
     | 
    
         
            +
                # We need to find packages since from RN 0.71 binaries are prebuilt
         
     | 
| 
      
 126 
     | 
    
         
            +
                find_package(fbjni REQUIRED CONFIG)
         
     | 
| 
      
 127 
     | 
    
         
            +
                find_package(ReactAndroid REQUIRED CONFIG)
         
     | 
| 
      
 128 
     | 
    
         
            +
            endif()
         
     | 
| 
       134 
129 
     | 
    
         | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
      
 130 
     | 
    
         
            +
            unset(JSI_LIB CACHE)
         
     | 
| 
      
 131 
     | 
    
         
            +
            if(${REACT_NATIVE_VERSION} LESS 66)
         
     | 
| 
      
 132 
     | 
    
         
            +
                # JSI lib didn't exist on RN 0.65 and before. Simply omit it.
         
     | 
| 
      
 133 
     | 
    
         
            +
                set (JSI_LIB "")
         
     | 
| 
      
 134 
     | 
    
         
            +
            elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
         
     | 
| 
      
 135 
     | 
    
         
            +
                # RN 0.71 distributes prebuilt binaries.
         
     | 
| 
      
 136 
     | 
    
         
            +
                set (JSI_LIB ReactAndroid::jsi)
         
     | 
| 
      
 137 
     | 
    
         
            +
            else()
         
     | 
| 
      
 138 
     | 
    
         
            +
                # RN 0.66 distributes libjsi.so, can be used instead of compiling jsi.cpp manually.
         
     | 
| 
      
 139 
     | 
    
         
            +
                find_library(
         
     | 
| 
      
 140 
     | 
    
         
            +
                    JSI_LIB
         
     | 
| 
      
 141 
     | 
    
         
            +
                    jsi
         
     | 
| 
       138 
142 
     | 
    
         
             
                    PATHS ${LIBRN_DIR}
         
     | 
| 
       139 
143 
     | 
    
         
             
                    NO_CMAKE_FIND_ROOT_PATH
         
     | 
| 
       140 
     | 
    
         
            -
            )
         
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
      
 144 
     | 
    
         
            +
                )
         
     | 
| 
      
 145 
     | 
    
         
            +
            endif()
         
     | 
| 
      
 146 
     | 
    
         
            +
            message("-- JSI     : " ${JSI_LIB})
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
            unset(REACT_LIB CACHE)
         
     | 
| 
      
 149 
     | 
    
         
            +
            if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
         
     | 
| 
      
 150 
     | 
    
         
            +
                # RN 0.71 distributes prebuilt binaries.
         
     | 
| 
      
 151 
     | 
    
         
            +
                set (REACT_LIB ReactAndroid::react_nativemodule_core)
         
     | 
| 
      
 152 
     | 
    
         
            +
            else()
         
     | 
| 
      
 153 
     | 
    
         
            +
                find_library(
         
     | 
| 
      
 154 
     | 
    
         
            +
                        REACT_LIB
         
     | 
| 
      
 155 
     | 
    
         
            +
                        react_nativemodule_core
         
     | 
| 
      
 156 
     | 
    
         
            +
                        PATHS ${LIBRN_DIR}
         
     | 
| 
      
 157 
     | 
    
         
            +
                        NO_CMAKE_FIND_ROOT_PATH
         
     | 
| 
      
 158 
     | 
    
         
            +
                )
         
     | 
| 
      
 159 
     | 
    
         
            +
            endif()
         
     | 
| 
       142 
160 
     | 
    
         
             
            message("-- REACT   : " ${REACT_LIB})
         
     | 
| 
       143 
161 
     | 
    
         | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
      
 162 
     | 
    
         
            +
            unset(FBJNI_LIBRARY CACHE)
         
     | 
| 
      
 163 
     | 
    
         
            +
            if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
         
     | 
| 
      
 164 
     | 
    
         
            +
                # RN 0.71 distributes prebuilt binaries.
         
     | 
| 
      
 165 
     | 
    
         
            +
                set (FBJNI_LIBRARY fbjni::fbjni)
         
     | 
| 
      
 166 
     | 
    
         
            +
            else()
         
     | 
| 
      
 167 
     | 
    
         
            +
                find_library(
         
     | 
| 
      
 168 
     | 
    
         
            +
                        FBJNI_LIBRARY
         
     | 
| 
      
 169 
     | 
    
         
            +
                        fbjni
         
     | 
| 
      
 170 
     | 
    
         
            +
                        PATHS ${libfbjni_link_DIRS}
         
     | 
| 
      
 171 
     | 
    
         
            +
                        NO_CMAKE_FIND_ROOT_PATH
         
     | 
| 
      
 172 
     | 
    
         
            +
                )
         
     | 
| 
      
 173 
     | 
    
         
            +
            endif()
         
     | 
| 
       151 
174 
     | 
    
         
             
            message("-- FBJNI   : " ${FBJNI_LIBRARY})
         
     | 
| 
       152 
175 
     | 
    
         | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
             
     | 
| 
      
 176 
     | 
    
         
            +
            unset(TURBOMODULES_LIB CACHE)
         
     | 
| 
      
 177 
     | 
    
         
            +
            if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
         
     | 
| 
      
 178 
     | 
    
         
            +
                # RN 0.71 distributes prebuilt binaries.
         
     | 
| 
      
 179 
     | 
    
         
            +
                set (TURBOMODULES_LIB "ReactAndroid::turbomodulejsijni")
         
     | 
| 
      
 180 
     | 
    
         
            +
            else()
         
     | 
| 
      
 181 
     | 
    
         
            +
                find_library(
         
     | 
| 
      
 182 
     | 
    
         
            +
                        TURBOMODULES_LIB
         
     | 
| 
      
 183 
     | 
    
         
            +
                        turbomodulejsijni
         
     | 
| 
      
 184 
     | 
    
         
            +
                        PATHS ${LIBRN_DIR}
         
     | 
| 
      
 185 
     | 
    
         
            +
                        NO_CMAKE_FIND_ROOT_PATH
         
     | 
| 
      
 186 
     | 
    
         
            +
                )
         
     | 
| 
      
 187 
     | 
    
         
            +
            endif()
         
     | 
| 
       160 
188 
     | 
    
         
             
            message("-- TURBO   : " ${TURBOMODULES_LIB})
         
     | 
| 
       161 
189 
     | 
    
         | 
| 
       162 
190 
     | 
    
         
             
            # Link
         
     | 
    
        package/android/build.gradle
    CHANGED
    
    | 
         @@ -47,7 +47,7 @@ def nodeModules = findNodeModules(projectDir) 
     | 
|
| 
       47 
47 
     | 
    
         
             
            logger.warn("react-native-skia: node_modules/ found at: ${nodeModules}")
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
            def sourceBuild = false
         
     | 
| 
       50 
     | 
    
         
            -
            def defaultDir 
     | 
| 
      
 50 
     | 
    
         
            +
            def defaultDir
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
            if (rootProject.ext.has('reactNativeAndroidRoot')) {
         
     | 
| 
       53 
53 
     | 
    
         
             
              defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
         
     | 
| 
         @@ -55,7 +55,7 @@ if (rootProject.ext.has('reactNativeAndroidRoot')) { 
     | 
|
| 
       55 
55 
     | 
    
         
             
                sourceBuild = true
         
     | 
| 
       56 
56 
     | 
    
         
             
                defaultDir = project(':ReactAndroid').projectDir
         
     | 
| 
       57 
57 
     | 
    
         
             
            } else {
         
     | 
| 
       58 
     | 
    
         
            -
              defaultDir = file("$nodeModules/react-native 
     | 
| 
      
 58 
     | 
    
         
            +
              defaultDir = file("$nodeModules/react-native")
         
     | 
| 
       59 
59 
     | 
    
         
             
            }
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
            if (!defaultDir.exists()) {
         
     | 
| 
         @@ -78,7 +78,7 @@ if (gradle.startParameter.taskRequests.args[0].toString().contains("Release")) { 
     | 
|
| 
       78 
78 
     | 
    
         | 
| 
       79 
79 
     | 
    
         
             
            def reactProperties = new Properties()
         
     | 
| 
       80 
80 
     | 
    
         
             
            file("$nodeModules/react-native/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
         
     | 
| 
       81 
     | 
    
         
            -
            def FULL_RN_VERSION = reactProperties.getProperty("VERSION_NAME")
         
     | 
| 
      
 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 
83 
     | 
    
         | 
| 
       84 
84 
     | 
    
         
             
            logger.warn("react-native-skia: RN Version: ${REACT_NATIVE_VERSION} / ${FULL_RN_VERSION}")
         
     | 
| 
         @@ -136,6 +136,10 @@ android { 
     | 
|
| 
       136 
136 
     | 
    
         
             
                    }
         
     | 
| 
       137 
137 
     | 
    
         
             
                }
         
     | 
| 
       138 
138 
     | 
    
         | 
| 
      
 139 
     | 
    
         
            +
                buildFeatures {
         
     | 
| 
      
 140 
     | 
    
         
            +
                    prefab true
         
     | 
| 
      
 141 
     | 
    
         
            +
                }
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
       139 
143 
     | 
    
         
             
                packagingOptions {
         
     | 
| 
       140 
144 
     | 
    
         
             
                    excludes = [
         
     | 
| 
       141 
145 
     | 
    
         
             
                         "**/libc++_shared.so",
         
     | 
| 
         @@ -146,8 +150,6 @@ android { 
     | 
|
| 
       146 
150 
     | 
    
         
             
                    ]
         
     | 
| 
       147 
151 
     | 
    
         
             
                }
         
     | 
| 
       148 
152 
     | 
    
         | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
153 
     | 
    
         
             
                // Create new configurations that can be referred to in dependencies.
         
     | 
| 
       152 
154 
     | 
    
         
             
                // The Android Gradle Plugin 3.* does not allow hooking into existing
         
     | 
| 
       153 
155 
     | 
    
         
             
                // configurations like `implementation`.
         
     | 
| 
         @@ -181,17 +183,25 @@ dependencies { 
     | 
|
| 
       181 
183 
     | 
    
         
             
                //noinspection GradleDynamicVersion
         
     | 
| 
       182 
184 
     | 
    
         
             
                implementation 'com.facebook.react:react-native:+'  // From node_modules
         
     | 
| 
       183 
185 
     | 
    
         | 
| 
       184 
     | 
    
         
            -
                 
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
             
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
      
 186 
     | 
    
         
            +
                if (REACT_NATIVE_VERSION < 71) {
         
     | 
| 
      
 187 
     | 
    
         
            +
                    logger.warn("react-native-skia: Extracting files from AAR (pre RN 0.71)")
         
     | 
| 
      
 188 
     | 
    
         
            +
                    //noinspection GradleDynamicVersion
         
     | 
| 
      
 189 
     | 
    
         
            +
                    extractHeaders("com.facebook.fbjni:fbjni:0.2.2:headers")
         
     | 
| 
      
 190 
     | 
    
         
            +
                    //noinspection GradleDynamicVersion
         
     | 
| 
      
 191 
     | 
    
         
            +
                    extractJNI("com.facebook.fbjni:fbjni:0.2.2")
         
     | 
| 
      
 192 
     | 
    
         
            +
                }
         
     | 
| 
       188 
193 
     | 
    
         | 
| 
       189 
194 
     | 
    
         
             
                if (!sourceBuild) {
         
     | 
| 
       190 
195 
     | 
    
         
             
                    def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
         
     | 
| 
       191 
196 
     | 
    
         
             
                    if (REACT_NATIVE_VERSION < 69) {
         
     | 
| 
      
 197 
     | 
    
         
            +
                        logger.warn("react-native-skia: aar state pre 69. match **/**/*.aar")
         
     | 
| 
       192 
198 
     | 
    
         
             
                        rnAarMatcher = "**/**/*.aar"
         
     | 
| 
      
 199 
     | 
    
         
            +
                    } else if (REACT_NATIVE_VERSION >= 71) {
         
     | 
| 
      
 200 
     | 
    
         
            +
                        logger.warn("react-native-skia: aar state post 70, do nothing")
         
     | 
| 
      
 201 
     | 
    
         
            +
                        return
         
     | 
| 
       193 
202 
     | 
    
         
             
                    }
         
     | 
| 
       194 
     | 
    
         
            -
                    def rnAAR = fileTree("${nodeModules}/react-native/android").matching({ it.include rnAarMatcher }).singleFile 
     | 
| 
      
 203 
     | 
    
         
            +
                    def rnAAR = fileTree("${nodeModules}/react-native/android").matching({ it.include rnAarMatcher }).singleFile
         
     | 
| 
      
 204 
     | 
    
         
            +
                    logger.warn("react-native-skia: Extracting JNI files (pre RN 0.71) ${rnAAR}")
         
     | 
| 
       195 
205 
     | 
    
         
             
                    extractJNI(files(rnAAR))
         
     | 
| 
       196 
206 
     | 
    
         
             
                }
         
     | 
| 
       197 
207 
     | 
    
         
             
            }
         
     | 
    
        package/package.json
    CHANGED