apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

def cmd = 'bash -c "git rev-list HEAD --count"'
def gitVersion = cmd.execute().text.trim().toInteger()

static def getAlphaVersionName() {
    'alpha' + new Date().format('yyyyMMdd')
}

android {
    packagingOptions {
        exclude 'lib/*/libRSSupport.so'
        exclude 'lib/*/librsjni.so'
        exclude 'lib/*/librsjni_androidx.so'
    }

    compileSdkVersion 29
    buildToolsVersion '29.0.3'
    defaultConfig {
        applicationId 'soko.ekibun.bangumi'
        minSdkVersion 22
        targetSdkVersion 29
        versionCode gitVersion
        versionName getAlphaVersionName()
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        buildConfigField "boolean", "AUTO_UPDATES", "true"
    }
    buildTypes {
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "versionCode"
    productFlavors {
        coolapk {
            dimension "versionCode"
            buildConfigField "boolean", "AUTO_UPDATES", "false"
        }
        github {
            dimension "versionCode"
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.preference:preference:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.2.0-alpha04'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'org.jsoup:jsoup:1.11.2'
    implementation 'com.github.bumptech.glide:glide:4.10.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
    implementation 'com.zlc.glide:webpdecoder:1.6.4.10.0'
    implementation 'com.github.bumptech.glide:okhttp3-integration:4.10.0'
    implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50'
    implementation 'com.squareup.okhttp3:okhttp:4.2.2'
    implementation 'com.squareup.okhttp3:okhttp-brotli:4.2.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:retrofit-converters:2.3.0'
    implementation 'com.squareup.retrofit2:retrofit-adapters:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'jp.wasabeef:glide-transformations:4.0.1'
    implementation 'com.oushangfeng:PinnedSectionItemDecoration:1.3.2'
    implementation 'com.github.siyamed:android-shape-imageview:0.9.3'
    implementation 'androidx.browser:browser:1.2.0'
    implementation 'com.zhy:base-adapter:3.0.3'
    implementation 'com.nshmura:recyclertablayout:1.5.0'
    implementation 'com.github.chrisbanes:PhotoView:2.1.4'
    implementation 'am.util:viewpager:25.3.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
    implementation 'com.jakewharton:disklrucache:2.0.2'
    implementation 'com.caverock:androidsvg:1.2.1'
    implementation 'com.michaelmuenzer.android:ScrollableNumberPicker:0.2.2'
}
