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

buildscript {
    if (findProject(':expo-modules-core') == null) {
        repositories {
            mavenCentral()
            google()
            jcenter()
        }

        dependencies {
            classpath 'com.android.tools.build:gradle:7.0.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
        }
    }
}

// 创建通用的ext变量，用于定义版本号
def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

// Android配置
android {
    compileSdkVersion safeExtGet('compileSdkVersion', 31)
    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 21)
        targetSdkVersion safeExtGet('targetSdkVersion', 31)
        versionCode 1
        versionName "1.0"
    }

    lintOptions {
        abortOnError false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }
}

repositories {
    mavenCentral()
    google()
    jcenter()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.0"

    //noinspection GradleDynamicVersion
    implementation 'com.facebook.react:react-native:+'
}
