buildscript {
    if (project == rootProject) {
        repositories {
            google()
            jcenter()
        }

        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.3'
        }
    }
}

apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
    compileSdkVersion safeExtGet('TestModule_compileSdkVersion', 31)
    defaultConfig {
        minSdkVersion safeExtGet('TestModule_minSdkVersion', 16)
        targetSdkVersion safeExtGet('TestModule_targetSdkVersion', 31)
        versionCode 1
        versionName "1.0"
    }

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

repositories {
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url("$rootDir/../node_modules/react-native/android")
    }
    google()
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}

rootProject.allprojects {
    repositories {
        google()
        mavenCentral()
        flatDir {
            dirs "$rootDir/../node_modules/react-native-kochava-tracker/android/libs"
        }
    }
}

dependencies {
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation (name: "KochavaCore", ext: "aar")
    implementation (name: "KochavaTracker", ext: "aar")
    implementation (name: "KochavaTrackerEvents", ext: "aar")
    implementation (name: "KochavaTrackerEngagement", ext: "aar")
    implementation (name: "KochavaTrackerDatapointNetwork", ext: "aar")
}