buildscript {
    // Buildscript is evaluated before everything else so we can't use safeExtGet
    def kotlinVersion = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '2.0.21'

    repositories {
        mavenCentral()
        google()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

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

apply plugin: 'com.android.library'

android {
    compileSdkVersion safeExtGet('compileSdkVersion', 35)
    buildToolsVersion safeExtGet('buildToolsVersion', '35.0.0')

    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 20)
        targetSdkVersion safeExtGet('targetSdkVersion', 35)
        versionCode 1
        versionName "1.0"
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
    implementation 'com.github.herokotlin:Code:0.3.2'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '2.0.21')}"
}

apply plugin: 'kotlin-android'
