diff --git a/android/build.gradle b/android/build.gradle index 617deb13..77fb7622 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ buildscript { } ext.getExtOrDefault = { name -> - getExtOrFallback(name, project.properties["lib_" + name]) + getExtOrFallback(name, project.properties["KlarnaMobileSDKRN_" + name]) } repositories { @@ -17,26 +17,19 @@ buildscript { } } -def isNewArchitectureEnabled() { - return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" +def getExtOrDefault(name) { + return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["KlarnaMobileSDKRN_" + name] } -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') } - -if (isNewArchitectureEnabled()) { - apply plugin: "com.facebook.react" +def getExtOrIntegerDefault(name) { + return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["KlarnaMobileSDKRN_" + name]).toInteger() } -def getExtOrDefault(name) { - return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["lib_" + name] +def isNewArchitectureEnabled() { + return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" } -def getExtOrIntegerDefault(name) { - return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["lib_" + name]).toInteger() -} +def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') } def supportsNamespace() { def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') @@ -51,6 +44,12 @@ def supportsNamespace() { return major >= 8 } +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +if (isNewArchitectureEnabled()) { + apply plugin: "com.facebook.react" +} + android { if (supportsNamespace()) { namespace "com.klarna.mobile.sdk.reactnative" diff --git a/android/gradle.properties b/android/gradle.properties index 8270ac09..6a458119 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -16,9 +16,9 @@ kotlin.code.style=official android.useAndroidX=true android.enableJetifier=true -lib_gradlePluginVersion=7.2.1 -lib_kotlinVersion=1.7.0 -lib_minSdkVersion=21 -lib_targetSdkVersion=31 -lib_compileSdkVersion=31 -lib_ndkVersion=21.4.7075529 +KlarnaMobileSDKRN_gradlePluginVersion=7.2.1 +KlarnaMobileSDKRN_kotlinVersion=1.7.0 +KlarnaMobileSDKRN_minSdkVersion=21 +KlarnaMobileSDKRN_targetSdkVersion=31 +KlarnaMobileSDKRN_compileSdkVersion=31 +KlarnaMobileSDKRN_ndkVersion=21.4.7075529