@@ -11,8 +11,8 @@ buildscript {
11
11
12
12
dependencies {
13
13
classpath(" org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version " )
14
- classpath(" com.android.tools.build:gradle:7.2 .1" )
15
- classpath(" com.diffplug.spotless:spotless-plugin-gradle:7.0.3 " )
14
+ classpath(" com.android.tools.build:gradle:8.10 .1" )
15
+ classpath(" com.diffplug.spotless:spotless-plugin-gradle:7.0.4 " )
16
16
}
17
17
}
18
18
@@ -45,6 +45,7 @@ def resolveReactNativeDirectory() {
45
45
commandLine(" node" , " --print" , " require.resolve('react-native/package.json')" )
46
46
}. standardOutput. asText. get(). trim()
47
47
)
48
+
48
49
if (reactNativePackage. exists()) {
49
50
return reactNativePackage. parentFile
50
51
}
@@ -59,41 +60,53 @@ def resolveReactNativeDirectory() {
59
60
if (isNewArchitectureEnabled()) {
60
61
apply plugin : ' com.facebook.react'
61
62
}
63
+
62
64
apply plugin : ' com.android.library'
63
65
apply plugin : ' kotlin-android'
64
66
65
67
if (project == rootProject) {
66
68
apply from : " spotless.gradle"
67
69
}
68
70
71
+ def getExternalLibVersion (project ){
72
+ def inputFile = new File (project. projectDir, " ../package.json" )
73
+ def json = new JsonSlurper (). parseText(inputFile. text)
74
+ def libVerision = json. version as String
75
+ def (major, minor, patch) = libVerision. tokenize(' .' )
76
+
77
+ // Handle cases where version is a pre-release one, e.g. "2.3.0-alpha.1"
78
+ def patchVersion = patch. find(/ (\d +)/ ) ? patch. find(/ (\d +)/ ) : " 0"
79
+
80
+ return [Integer . parseInt(major), Integer . parseInt(minor), Integer . parseInt(patchVersion)]
81
+ }
82
+
69
83
// Check whether Reanimated 2.3 or higher is installed alongside Gesture Handler
70
84
def shouldUseCommonInterfaceFromReanimated () {
71
85
def reanimated = rootProject. subprojects. find { it. name == ' react-native-reanimated' }
72
- if (reanimated != null ) {
73
- def inputFile = new File (reanimated. projectDir, ' ../package.json' )
74
- def json = new JsonSlurper (). parseText(inputFile. text)
75
- def reanimatedVersion = json. version as String
76
- def (major, minor, patch) = reanimatedVersion. tokenize(' .' )
77
- return (Integer . parseInt(major) == 2 && Integer . parseInt(minor) >= 3 ) || Integer . parseInt(major) >= 3
78
- } else {
86
+
87
+ if (reanimated == null ) {
79
88
return false
80
89
}
90
+
91
+ def (major, minor, patch) = getExternalLibVersion(reanimated)
92
+
93
+ return (major == 2 && minor >= 3 ) || major >= 3
81
94
}
82
95
83
96
def shouldUseCommonInterfaceFromRNSVG () {
84
97
// common interface compatible with react-native-svg >= 15.11.2
85
98
def rnsvg = rootProject. subprojects. find { it. name == ' react-native-svg' }
99
+
86
100
if (rnsvg == null ) {
87
101
return false
88
102
}
89
103
90
- def inputFile = new File (rnsvg. projectDir, ' ../package.json' )
91
- def json = new JsonSlurper (). parseText(inputFile. text)
92
- def rnsvgVersion = json. version as String
93
- def (major, minor, patch) = rnsvgVersion. tokenize(' .' )
94
- return (Integer . parseInt(major) == 15 && Integer . parseInt(minor) == 11 && Integer . parseInt(patch) >= 2 ) ||
95
- (Integer . parseInt(major) == 15 && Integer . parseInt(minor) > 11 ) ||
96
- Integer . parseInt(major) > 15
104
+ def (major, minor, patch) = getExternalLibVersion(rnsvg)
105
+
106
+
107
+ return (major == 15 && minor == 11 && patch >= 2 ) ||
108
+ (major == 15 && minor > 11 ) ||
109
+ major > 15
97
110
}
98
111
99
112
def reactNativeArchitectures () {
@@ -107,7 +120,7 @@ def reactProperties = new Properties()
107
120
file(" $REACT_NATIVE_DIR /ReactAndroid/gradle.properties" ). withInputStream { reactProperties. load(it) }
108
121
109
122
def REACT_NATIVE_VERSION = reactProperties. getProperty(" VERSION_NAME" )
110
- def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION . startsWith( " 0.0.0- " ) ? 1000 : REACT_NATIVE_VERSION . split(" \\ ." )[1 ]. toInteger()
123
+ def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION . split(" \\ ." )[1 ]. toInteger()
111
124
112
125
repositories {
113
126
mavenCentral()
@@ -116,7 +129,7 @@ repositories {
116
129
android {
117
130
compileSdkVersion safeExtGet(" compileSdkVersion" , 33 )
118
131
119
- namespace " com.swmansion.gesturehandler"
132
+ namespace = " com.swmansion.gesturehandler"
120
133
buildFeatures {
121
134
buildConfig = true
122
135
prefab = true
@@ -132,10 +145,8 @@ android {
132
145
}
133
146
134
147
defaultConfig {
135
- minSdkVersion safeExtGet(' minSdkVersion' , 21 )
148
+ minSdkVersion safeExtGet(' minSdkVersion' , 24 )
136
149
targetSdkVersion safeExtGet(' targetSdkVersion' , 33 )
137
- versionCode 1
138
- versionName " 1.0"
139
150
buildConfigField " boolean" , " IS_NEW_ARCHITECTURE_ENABLED" , isNewArchitectureEnabled(). toString()
140
151
buildConfigField " int" , " REACT_NATIVE_MINOR_VERSION" , REACT_NATIVE_MINOR_VERSION . toString()
141
152
@@ -180,12 +191,9 @@ android {
180
191
181
192
sourceSets. main {
182
193
java {
183
- // Include "common/" only when it's not provided by Reanimated to mitigate
184
- // multiple definitions of the same class preventing build
185
194
if (shouldUseCommonInterfaceFromReanimated()) {
186
195
srcDirs + = ' reanimated/src/main/java'
187
196
} else {
188
- srcDirs + = ' common/src/main/java'
189
197
srcDirs + = ' noreanimated/src/main/java'
190
198
}
191
199
@@ -200,21 +208,7 @@ android {
200
208
} else {
201
209
// 'paper/src/main/java' includes files from codegen so the library can compile with
202
210
// codegen turned off
203
-
204
- if (REACT_NATIVE_MINOR_VERSION > 77 ) {
205
- srcDirs + = ' paper/src/main/java'
206
- } else {
207
- srcDirs + = ' paper77/src/main/java'
208
- }
209
- }
210
-
211
- if (REACT_NATIVE_MINOR_VERSION >= 77 ) {
212
- // With RN 0.77, ViewManager related functions in the package has different signatures as they
213
- // are no longer nullable
214
- srcDirs + = ' package77/src/main/java'
215
- } else {
216
- // It's safe to delete this block once we drop support for RN 0.76
217
- srcDirs + = ' packageDeprecated/src/main/java'
211
+ srcDirs + = ' paper/src/main/java'
218
212
}
219
213
}
220
214
}
@@ -252,7 +246,7 @@ dependencies {
252
246
implementation rootProject. subprojects. find { it. name == ' react-native-svg' }
253
247
}
254
248
255
- implementation ' androidx.appcompat:appcompat:1.2 .0'
256
- implementation " androidx.core:core-ktx:1.6 .0"
249
+ implementation ' androidx.appcompat:appcompat:1.7 .0'
250
+ implementation " androidx.core:core-ktx:1.16 .0"
257
251
implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
258
252
}
0 commit comments