plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-parcelize'
}

def name = "reader"
def code = 1
def version = "1.0.0"

android {
    compileSdkVersion 30
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.novel.read"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode code
        versionName version

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters "armeabi"
        }
        multiDexEnabled true
        resConfigs "zh", "zh-rCN"
        resConfigs "zh", "zh-rTW"
        resConfigs "zh", "zh-rHK"
    }

    signingConfigs {
        release {
            keyAlias 'key0'
            keyPassword '1qaz@WSX'
            storeFile file('reader.jks')
            storePassword '1qaz@WSX'
        }
    }
    buildFeatures {
        viewBinding true
    }
    buildTypes {
        debug {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        release {
            buildConfigField "boolean", "LOG_DEBUG", "false" //不显示log
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }

        android.applicationVariants.all { variant ->
            variant.outputs.all {
                def flavor = variant.productFlavors[0].name
                outputFileName = "${name}_${flavor}_${defaultConfig.versionName}.apk"
            }
        }
    }

    flavorDimensions "mode"
    productFlavors {
        app {
            dimension "mode"
            manifestPlaceholders = [APP_CHANNEL_VALUE: "app"]
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.aar'])
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation "com.android.support:multidex:1.0.3"

    //kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

    //androidX
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.media:media:1.2.1'
    implementation 'androidx.preference:preference-ktx:1.1.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.viewpager2:viewpager2:1.0.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'com.google.android:flexbox:1.1.0'
    implementation 'com.google.code.gson:gson:2.8.6'

    //基本的网络框架
    implementation 'com.squareup.okhttp3:okhttp:3.14.9'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.7.2'
    implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'

    //anko
    def anko_version = '0.10.8'
    implementation "org.jetbrains.anko:anko-sdk27:$anko_version"
    implementation "org.jetbrains.anko:anko-sdk27-listeners:$anko_version"

    //sql
    implementation 'org.litepal.android:kotlin:3.0.0'

    //协程
    def coroutines_version = '1.3.7'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"

    //liveEventBus
    implementation 'com.jeremyliao:live-event-bus-x:1.7.2'

    //lifecycle
    def lifecycle_version = '2.2.0'
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.11.0'

    //MarkDown
    implementation 'io.noties.markwon:core:4.6.0'
    implementation 'io.noties.markwon:image-glide:4.6.0'
    //转换繁体
    implementation files('libs/ZHConverter.jar')
    //brvah
    implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.6'

    //字符串比较
    implementation 'net.ricecode:string-similarity:1.0.0'

    //epub
    implementation('com.positiondev.epublib:epublib-core:3.1') {
        exclude group: 'org.slf4j'
        exclude group: 'xmlpull'
    }

    //flex
    implementation 'com.google.android:flexbox:1.1.0'

    implementation 'com.allenliu.versionchecklib:library:2.2.0'

    implementation 'com.permissionx.guolindev:permissionx:1.4.0'
}