-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from Giphy/feat/drop-old-rn-support
feat!: drop support for React Native <0.73.0
- Loading branch information
Showing
24 changed files
with
3,435 additions
and
1,522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ buildscript { | |
} | ||
|
||
dependencies { | ||
classpath "com.android.tools.build:gradle:7.2.1" | ||
classpath "com.android.tools.build:gradle:8.1.0" | ||
// noinspection DifferentKotlinGradleVersion | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
|
@@ -19,30 +19,17 @@ apply plugin: "kotlin-android" | |
|
||
import groovy.json.JsonSlurper | ||
|
||
// https://github.com/callstack/react-native-builder-bob/discussions/359 | ||
def registrationCompat = { | ||
def reactNativeVersion = { | ||
def reactNativeManifest = file("$projectDir/../node_modules/react-native/package.json").exists() | ||
? file("$projectDir/../node_modules/react-native/package.json") // developer mode, to run example app | ||
: file("$projectDir/../../../react-native/package.json") | ||
def reactNativeVersion = new JsonSlurper().parseText(reactNativeManifest.text).version as String | ||
// Fabric was introduced at [email protected], full CMake support were introduced at [email protected] | ||
// Use Android.mk for compatibility with [email protected]/0.69 | ||
reactNativeVersion.matches('(0.68.*|0.69.*)') | ||
}() | ||
|
||
def codegenViewLibraryName = "GiphyReactNativeSDK" | ||
def codegenViewModuleName = { | ||
// Autolink for Fabric uses codegenConfig.name in package.json since [email protected] | ||
// Use codegenViewLibraryName for compatibility with [email protected]/0.69 | ||
def libraryManifestJson = new JsonSlurper().parseText(file("$projectDir/../package.json").text) | ||
registrationCompat ? codegenViewLibraryName : libraryManifestJson.codegenConfig.name | ||
new JsonSlurper().parseText(reactNativeManifest.text).version as String | ||
}() | ||
|
||
def isNewArchitectureEnabled() { | ||
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" | ||
} | ||
|
||
|
||
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') } | ||
|
||
if (isNewArchitectureEnabled()) { | ||
|
@@ -61,65 +48,19 @@ def getExtOrIntegerDefault(name) { | |
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["GiphyReactNativeSDK." + name]).toInteger() | ||
} | ||
|
||
def supportsNamespace() { | ||
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') | ||
def major = parsed[0].toInteger() | ||
def minor = parsed[1].toInteger() | ||
|
||
// Namespace support was added in 7.3.0 | ||
if (major == 7 && minor >= 3) { | ||
return true | ||
} | ||
|
||
return major >= 8 | ||
} | ||
|
||
android { | ||
if (supportsNamespace()) { | ||
namespace "com.giphyreactnativesdk" | ||
} else { | ||
sourceSets { | ||
main { | ||
manifest.srcFile "src/main/AndroidManifestDeprecated.xml" | ||
} | ||
} | ||
} | ||
android { | ||
buildFeatures { | ||
buildConfig = true | ||
} | ||
|
||
namespace "com.giphyreactnativesdk" | ||
|
||
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") | ||
|
||
defaultConfig { | ||
minSdkVersion getExtOrIntegerDefault("minSdkVersion") | ||
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") | ||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||
buildConfigField "String", "CODEGEN_MODULE_REGISTRATION", (isNewArchitectureEnabled() && registrationCompat ? "\"${codegenViewModuleName}_registration\"" : "null") | ||
|
||
if (isNewArchitectureEnabled() && registrationCompat) { | ||
def reactAndroidProject = project(':ReactAndroid') | ||
externalNativeBuild { | ||
ndkBuild { | ||
arguments "APP_PLATFORM=android-21", | ||
"APP_STL=c++_shared", | ||
"NDK_TOOLCHAIN_VERSION=clang", | ||
"GENERATED_SRC_DIR=$buildDir/generated/source", // for react_codegen_* in this library's codegen/jni | ||
"PROJECT_BUILD_DIR=${appProject.buildDir}", // for REACT_NDK_EXPORT_DIR in ReactAndroid's Android-prebuilt.mk | ||
"REACT_ANDROID_DIR=${reactAndroidProject.projectDir}", | ||
"REACT_ANDROID_BUILD_DIR=${reactAndroidProject.buildDir}", | ||
"CODEGEN_MODULE_NAME=$codegenViewModuleName" | ||
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1" | ||
cppFlags "-std=c++17" | ||
targets "${codegenViewModuleName}_registration" | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (isNewArchitectureEnabled() && registrationCompat) { | ||
// We configure the NDK build only if you decide to opt-in for the New Architecture. | ||
externalNativeBuild { | ||
ndkBuild { | ||
path "Android.mk" | ||
} | ||
} | ||
} | ||
|
||
buildTypes { | ||
|
@@ -133,8 +74,8 @@ android { | |
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
sourceCompatibility JavaVersion.VERSION_17 | ||
targetCompatibility JavaVersion.VERSION_17 | ||
} | ||
|
||
sourceSets { | ||
|
@@ -197,12 +138,9 @@ task configureGiphyVideoPlayerAdapter { | |
preBuild.dependsOn configureGiphyVideoPlayerAdapter | ||
|
||
dependencies { | ||
// For < 0.71, this will be from the local maven repo | ||
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin | ||
//noinspection GradleDynamicVersion | ||
implementation "com.facebook.react:react-native:+" | ||
implementation "com.facebook.react:react-android:$reactNativeVersion" | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
implementation 'com.giphy.sdk:ui:2.3.15-fresco-v2.5.0' | ||
implementation 'com.giphy.sdk:ui:2.3.16' | ||
} | ||
|
||
if (isNewArchitectureEnabled()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.giphyreactnativesdk"> | ||
|
||
</manifest> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export NODE_BINARY=/opt/homebrew/bin/node | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.