Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ buildscript {

apply plugin: "com.android.library"
apply plugin: "kotlin-android"
apply plugin: "com.facebook.react"

def getExtOrDefault(name) {
return project.properties["Didomi_" + name].toString()
Expand All @@ -26,19 +27,39 @@ def getExtOrIntegerDefault(name) {
return project.properties["Didomi_" + name].toInteger()
}

def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

def parsedPackage = new JsonSlurper().parseText(file("../package.json").text)

android {
compileSdk getExtOrIntegerDefault("compileSdkVersion")
namespace "io.didomi.reactnative"

defaultConfig {
minSdk getExtOrIntegerDefault("minSdkVersion")
targetSdk getExtOrIntegerDefault("targetSdkVersion")
versionCode 1
versionName "${parsedPackage.version}"

multiDexEnabled = true

buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
}

buildFeatures {
buildConfig = true
}

sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch/java']
} else {
java.srcDirs += ['src/oldarch/java']
}
}
}

buildTypes {
Expand All @@ -60,6 +81,12 @@ android {

}

react {
jsRootDir = file("../src/specs")
libraryName = "RNDidomiSpec"
codegenJavaPackageName = "io.didomi.reactnative"
}

repositories {
google()
mavenLocal()
Expand Down
Loading
Loading