buildscript {
    ext.kotlinVersion = '1.9.23'

    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:8.7.3'
        // noinspection DifferentKotlinGradleVersion
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

ext {
    moengageNativeBOMVersion = "1.5.1"
    moengagePluginBaseBOMVersion = "1.2.1"
}

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

android {
    compileSdk 35
    namespace "com.moengage.react.geofence"
    defaultConfig {
        minSdk 23
        versionCode 1
        versionName "1.0"

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

    buildTypes {
        release {
            minifyEnabled false
        }
    }
    lintOptions {
        disable 'GradleCompatible'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        freeCompilerArgs = ['-Xjvm-default=all']
    }

    buildFeatures {
        buildConfig true
    }


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

repositories {
    mavenCentral()
    google()
}

dependencies {
    // noinspection GradleDynamicVersion
    compileOnly('com.facebook.react:react-native')
    compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

    implementation(platform("com.moengage:android-bom:$moengageNativeBOMVersion"))
    compileOnly("com.moengage:moe-android-sdk")
    api("com.moengage:geofence")

    implementation(platform("com.moengage:plugin-base-bom:$moengagePluginBaseBOMVersion"))
    implementation("com.moengage:plugin-base-geofence")
}

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