Skip to content

Commit

Permalink
fix(android): use kotlinVersion to determine default corutines version (
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas authored May 8, 2024
1 parent 9a9bc35 commit 7d88236
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}


def getKotlinVersion() {
return rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '1.6.21'
}

def getCoroutinesVersion(kotlinVersion) {
return kotlinVersion >= '1.9' ? '1.8.0' : '1.6.4'
}

// expo plugin
if (rootProject.ext.has('expoRNMapboxMapsImpl')) {
rootProject.ext.set('RNMapboxMapsImpl', rootProject.ext.get('expoRNMapboxMapsImpl'))
Expand All @@ -21,15 +30,17 @@ if (rootProject.ext.has('expoRNMapboxMapsVersion')) {
rootProject.ext.set('RNMapboxMapsVersion', rootProject.ext.get('expoRNMapboxMapsVersion'))
}

project.ext.set("kotlinVersion", getKotlinVersion())

buildscript {
repositories {
google()
mavenCentral()
}

def kotlinVersion = this.kotlinVersion
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '1.6.21'}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
}
}

Expand Down Expand Up @@ -142,9 +153,8 @@ dependencies {
// React Native
implementation "com.facebook.react:react-native:+"

// kotlin coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${safeExtGet('kotlinxCoroutinesCoreVersion', '1.8.0')}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('kotlinxCoroutinesAndroidVersion', '1.8.0')}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${safeExtGet('kotlinxCoroutinesCoreVersion', getCoroutinesVersion(getKotlinVersion()))}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('kotlinxCoroutinesAndroidVersion', getCoroutinesVersion(getKotlinVersion()))}"

// Mapbox SDK
customizableDependencies('RNMapboxMapsLibs') {
Expand Down

0 comments on commit 7d88236

Please sign in to comment.