From 83506d93add8b427d3cd2200d9d28f40d35833a1 Mon Sep 17 00:00:00 2001 From: Matas Date: Thu, 27 Oct 2022 14:54:15 +0100 Subject: [PATCH] fix: get rootProject values for build.gradle --- android/build.gradle | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 7705da3..d56b7eb 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,10 +1,5 @@ buildscript { - ext { - compileSdkVersion = 30 - kotlinVersion = "1.7.10" - minSdkVersion = 21 - targetSdkVersion = 30 - } + def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : "1.7.20" repositories { google() @@ -13,23 +8,23 @@ buildscript { dependencies { classpath "com.android.tools.build:gradle:4.2.2" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -def getExt(name) { - return rootProject.ext.get(name) +def getExtOrDefault(name, defaultValue) { + return rootProject.ext.has(name) ? rootProject.ext.get(name) : defaultValue } android { - compileSdkVersion getExt('compileSdkVersion') + compileSdkVersion getExtOrDefault('compileSdkVersion', 31) defaultConfig { - minSdkVersion getExt('minSdkVersion') - targetSdkVersion getExt('targetSdkVersion') + minSdkVersion getExtOrDefault('minSdkVersion', 21) + targetSdkVersion getExtOrDefault('targetSdkVersion', 31) } lintOptions {