fix(android): check androidX version at early build process before really launching build (#4388)
This commit is contained in:
@@ -7,6 +7,9 @@ buildscript {
|
|||||||
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNVideo_kotlinVersion']
|
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNVideo_kotlinVersion']
|
||||||
def requiredKotlinVersion = project.properties['RNVideo_kotlinVersion']
|
def requiredKotlinVersion = project.properties['RNVideo_kotlinVersion']
|
||||||
|
|
||||||
|
def androidx_version = rootProject.ext.has('androidxActivityVersion') ? rootProject.ext.get('androidxActivityVersion') : project.properties['RNVideo_androidxActivityVersion']
|
||||||
|
def requiredAndroidxVersion = project.properties['RNVideo_androidxActivityVersion']
|
||||||
|
|
||||||
def isVersionAtLeast = { version, requiredVersion ->
|
def isVersionAtLeast = { version, requiredVersion ->
|
||||||
def (v1, v2) = [version, requiredVersion].collect { it.tokenize('.')*.toInteger() }
|
def (v1, v2) = [version, requiredVersion].collect { it.tokenize('.')*.toInteger() }
|
||||||
for (int i = 0; i < Math.max(v1.size(), v2.size()); i++) {
|
for (int i = 0; i < Math.max(v1.size(), v2.size()); i++) {
|
||||||
@@ -35,6 +38,11 @@ buildscript {
|
|||||||
} else {
|
} else {
|
||||||
println("Kotlin version is correct: $kotlin_version")
|
println("Kotlin version is correct: $kotlin_version")
|
||||||
}
|
}
|
||||||
|
if (!isVersionAtLeast(androidx_version, requiredAndroidxVersion)) {
|
||||||
|
throw new GradleException("AndroidX version mismatch: Project is using Kotlin version $requiredAndroidxVersion, but it must be at least $requiredAndroidxVersion. Please update the Kotlin version.")
|
||||||
|
} else {
|
||||||
|
println("AndroidX version is correct: $androidx_version")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user