apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

androidExtensions {
    experimental = true
}

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "net.frju.flym"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 40
        versionName "2.5.6"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

        kotlinOptions {
            jvmTarget = "1.8"
        }
    }

    lintOptions {
        // if true, stop the gradle build if errors are found
        abortOnError true
    }

    File localProps = project.rootProject.file('local.properties')
    Properties properties = new Properties()
    if (localProps.exists()) {
        properties.load(localProps.newDataInputStream())
    }

    signingConfigs {
        debug {
            if (properties.getProperty("KEYSTORE_PATH") != null) {
                storeFile file(properties.getProperty("KEYSTORE_PATH"))
                storePassword properties.getProperty("KEYSTORE_PASSWORD")
                keyAlias properties.getProperty("KEY_ALIAS")
                keyPassword properties.getProperty("KEY_PASSWORD")
            }
        }
        release {
            if (properties.getProperty("KEYSTORE_PATH") != null) {
                storeFile file(properties.getProperty("KEYSTORE_PATH"))
                storePassword properties.getProperty("KEYSTORE_PASSWORD")
                keyAlias properties.getProperty("KEY_ALIAS")
                keyPassword properties.getProperty("KEY_PASSWORD")
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            if (properties.getProperty("KEYSTORE_PATH") != null) {
                signingConfig signingConfigs.release
            }
        }
    }

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

kapt {
    arguments {
        arg("room.schemaLocation", "$projectDir/schemas")
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    def lifecycle_version = "2.2.0"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"

    def room_version = "2.2.5"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    def anko_version = '0.10.8'
    implementation "org.jetbrains.anko:anko-sdk21:$anko_version"
    implementation "org.jetbrains.anko:anko-sdk21-listeners:$anko_version"
    implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
    implementation "org.jetbrains.anko:anko-design:$anko_version"

    def okhttp_version = '4.9.0'
    implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
    implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttp_version"

    def glide_version = '4.11.0'
    implementation "com.github.bumptech.glide:glide:$glide_version"
    kapt "com.github.bumptech.glide:compiler:$glide_version"

    implementation 'androidx.core:core-ktx:1.5.0-alpha05'
    implementation 'androidx.paging:paging-runtime-ktx:2.1.2'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.preference:preference-ktx:1.1.1'
    implementation 'org.jsoup:jsoup:1.13.1'
    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    implementation 'com.github.Tunous:SwipeActionView:1.3.1'
    implementation 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
    implementation 'com.github.jrvansuita:MaterialAbout:0.2.3'
    implementation 'q.rorbin:badgeview:1.1.3'
    implementation 'net.dankito.readability4j:readability4j:1.0.5'
    implementation 'pub.devrel:easypermissions:3.0.0'
    implementation 'com.rometools:rome-opml:1.15.0'

    testImplementation 'junit:junit:4.13.1'
}
