Skip to content

Commit

Permalink
fix possible property conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
NMGuner committed Aug 20, 2024
1 parent 8a90d03 commit 51e46ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
29 changes: 14 additions & 15 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}

ext.getExtOrDefault = { name ->
getExtOrFallback(name, project.properties["lib_" + name])
getExtOrFallback(name, project.properties["KlarnaMobileSDKRN_" + name])
}

repositories {
Expand All @@ -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('.')
Expand All @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 51e46ee

Please sign in to comment.