group = "com.atmob.keyboard_android"
version = "1.0-SNAPSHOT"

// 加载 local.properties 文件
// 需要在 local.properties 文件中配置你的flutter的sdk目录，例如：flutter.sdk=C\:\\Users\\XM20240809\\fvm\\versions\\3.29.2
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withInputStream { stream ->
        localProperties.load(stream)
    }
}

// 读取变量
def flutterSdk = localProperties.getProperty('flutter.sdk')

buildscript {
    ext.kotlin_version = "1.8.22"
    repositories {
        maven { url 'https://jitpack.io' }
        google()
        mavenCentral()
    }

    dependencies {
        classpath("com.android.tools.build:gradle:8.7.0")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
    }
}

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
        google()
        mavenCentral()
    }
}

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

android {
    namespace = "com.atmob.keyboard_android"

    compileSdk = 35

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11
    }

    sourceSets {
        main.java.srcDirs += "src/main/kotlin"
        test.java.srcDirs += "src/test/kotlin"
    }

    defaultConfig {
        minSdk = 21
    }

    buildFeatures {
        // 生成BuildConfig
        buildConfig true
    }

    def glide_version = '4.13.2'

    dependencies {
        testImplementation("org.jetbrains.kotlin:kotlin-test")
        testImplementation("org.mockito:mockito-core:5.0.0")
        compileOnly(files("$flutterSdk/bin/cache/artifacts/engine/android-arm/flutter.jar"))

        // AppCompat
        implementation 'androidx.appcompat:appcompat:1.3.1'
        // Material
        implementation 'com.google.android.material:material:1.4.0'
        // RecyclerView
        implementation 'androidx.recyclerview:recyclerview:1.3.0'
        // ConstraintLayout
        implementation "androidx.constraintlayout:constraintlayout:2.1.4"
        // 让Service支持Jetpack Lifecycle组件
        implementation "androidx.lifecycle:lifecycle-service:2.6.1"

        // Lottie动画
        implementation "com.airbnb.android:lottie:6.6.6"

        // Gson
        implementation "com.google.code.gson:gson:2.10"
        // CircleImageView
        implementation 'de.hdodenhof:circleimageview:3.1.0'
        // XPopup
        // implementation 'com.github.li-xiaojun:XPopup:2.10.0'
        // Android Util Code
        implementation 'com.blankj:utilcodex:1.31.1'
        // RecyclerView Adapter
        implementation 'me.drakeet.multitype:multitype:3.5.0'
        // OkHttp3
        implementation 'com.squareup.okhttp3:okhttp:3.12.0'
        // Glide
        implementation "com.github.bumptech.glide:glide:$glide_version"
        implementation "jp.wasabeef:glide-transformations:4.3.0"
        implementation "com.github.zjupure:webpdecoder:2.1.${glide_version}"
        // MagicIndicator ViewPager指示器
        implementation 'com.github.hackware1993:MagicIndicator:1.7.0'
        // 混淆配置
        implementation 'com.blankj:free-proguard:0.0.12'
    }

    testOptions {
        unitTests.all {
            useJUnitPlatform()

            testLogging {
                events "passed", "skipped", "failed", "standardOut", "standardError"
                outputs.upToDateWhen { false }
                showStandardStreams = true
            }
        }
    }
}
