apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: '../constants.gradle'

static def releaseTime() {
    return new Date().format("yyyy_MM_dd", TimeZone.getTimeZone("UTC"))
}

android {
    compileSdkVersion project.ext.compileSdkVersion
    buildToolsVersion project.ext.buildToolsVersion

    defaultConfig {
        applicationId "xyz.doikki.dkplayer"
        minSdkVersion project.ext.minSdkVersion
        targetSdkVersion project.ext.targetSdkVersion
        versionCode project.ext.releaseVersionCode
        versionName project.ext.releaseVersion

        ndk {
            //使用abiFilters筛选你需要的so
//            abiFilters 'arm64-v8a'
        }
        multiDexEnabled true
    }


    signingConfigs {
        release {
            storeFile file("../devlin.jks")
            storePassword KEYSTORE_PWD
            keyAlias KEY_ALIAS
            keyPassword KEY_PWD
        }
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }


    buildTypes {
        debug {
            signingConfig signingConfigs.release
            zipAlignEnabled false
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        release {
            signingConfig signingConfigs.release
            zipAlignEnabled true
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            outputFileName = "${variant.name}-${variant.versionName}-${releaseTime()}(${variant.versionCode}).apk"
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
//    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0'
    implementation "androidx.multidex:multidex:2.0.1"
    implementation "androidx.core:core-ktx:1.7.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation "androidx.constraintlayout:constraintlayout:2.1.3"
    implementation "androidx.viewpager2:viewpager2:1.0.0"
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
    implementation 'com.github.ctiao:DanmakuFlameMaster:0.9.25'
    implementation 'com.github.ctiao:ndkbitmap-armv7a:0.9.21'
    implementation "com.google.android.material:material:1.6.1"
    implementation 'com.google.code.gson:gson:2.9.0'
    implementation "androidx.activity:activity-ktx:1.4.0"

    implementation project(':dkplayer-java')
    implementation project(':dkplayer-ui')
    implementation project(path: ':dkplayer-players:ijk')
    implementation project(path: ':dkplayer-players:exo')
    //缓存
    implementation project(':dkplayer-videocache')


//    implementation 'xyz.doikki.android.dkplayer:dkplayer-java:3.3.6'
//    implementation 'xyz.doikki.android.dkplayer:dkplayer-ui:3.3.6'
//    implementation 'xyz.doikki.android.dkplayer:player-exo:3.3.6'
//    implementation 'xyz.doikki.android.dkplayer:player-ijk:3.3.6'
//    implementation 'xyz.doikki.android.dkplayer:videocache:3.3.6'
}
