apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.apollographql.android'
apply plugin: 'com.novoda.build-properties'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

buildProperties {
    notThere {
        using rootProject.file('debug_gradle.properties')
    }
    secrets {
        using rootProject.file('release_gradle.properties')
    }
}

android {
    signingConfigs {
        signing {
            keyAlias((buildProperties.secrets['android_key_alias'] | buildProperties.notThere['android_key_alias']).string)
            keyPassword((buildProperties.secrets['android_store_password'] | buildProperties.notThere['android_store_password']).string)
            storeFile file('fastaccess-public')
            storePassword((buildProperties.secrets['android_store_password'] | buildProperties.notThere['android_store_password']).string)
        }
    }
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.fastaccess.github"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 473
        versionName "4.7.3"
        buildConfigString "GITHUB_CLIENT_ID", (buildProperties.secrets['github_client_id'] | buildProperties.notThere['github_client_id']).string
        buildConfigString "GITHUB_SECRET", (buildProperties.secrets['github_secret'] | buildProperties.notThere['github_secret']).string
        buildConfigString "IMGUR_CLIENT_ID", (buildProperties.secrets['imgur_client_id'] | buildProperties.notThere['imgur_client_id']).string
        buildConfigString "IMGUR_SECRET", (buildProperties.secrets['imgur_secret'] | buildProperties.notThere['imgur_secret']).string
        buildConfigField "String", "REST_URL", '"https://api.github.com/"'
        buildConfigField "String", "IMGUR_URL", '"https://api.imgur.com/3/"'
        multiDexEnabled true
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath true
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            signingConfig signingConfigs.signing
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
            ext.alwaysUpdateBuildId = false
        }
    }

    sourceSets {
        main {
            res.srcDirs = [
                    "src/main/res/",
                    "src/main/res/layouts/main_layouts",
                    "src/main/res/layouts/row_layouts",
                    "src/main/res/layouts/other_layouts",
                    "src/main/res/translations",
                    "src/main/res"
            ]
        }
    }

    lintOptions {
        abortOnError false
        htmlReport true
        xmlReport true
        disable 'InvalidPackage'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    configurations {
        all*.exclude module: 'javax.annotation'
        all*.exclude group: 'org.jetbrains', module: 'annotations-java5'
    }

    packagingOptions { exclude 'META-INF/rxjava.properties' }

    dexOptions {
        jumboMode true
        javaMaxHeapSize "4g"
    }
}

repositories {
    maven { url "https://clojars.org/repo/" }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
    implementation 'androidx.browser:browser:1.2.0'
    implementation 'androidx.palette:palette:1.0.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.core:core:1.1.0'
    implementation "net.grandcentrix.thirtyinch:thirtyinch:${thirtyinchVersion}"
    implementation "net.grandcentrix.thirtyinch:thirtyinch-rx2:${thirtyinchVersion}"
    implementation "com.squareup.retrofit2:retrofit:${retrofit}"
    implementation "com.squareup.retrofit2:converter-gson:${retrofit}"
    implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit}"
    implementation "com.squareup.retrofit2:converter-scalars:${retrofit}"
    implementation "com.github.bumptech.glide:glide:${glideVersion}"
    implementation 'cn.gavinliu:ShapedImageView:0.8.7'
    implementation "com.jakewharton:butterknife:${butterKnifeVersion}"
    implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:2.0.2'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.15'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
    implementation 'com.annimon:stream:1.1.9'
    implementation 'com.github.GrenderG:Toasty:1.1.3'
    implementation 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.2'
    implementation 'com.github.daniel-stoneuk:material-about-library:2.1.0'
    implementation "io.requery:requery:${requery}"
    implementation "io.requery:requery-android:${requery}"
    implementation('com.mikepenz:aboutlibraries:5.9.7@aar') { transitive = true }
    implementation 'com.github.nightwhistler:HtmlSpanner:0.4'
    implementation 'net.sourceforge.htmlcleaner:htmlcleaner:2.2'
    implementation 'com.github.matthiasrobbers:shortbread:1.0.1'
    implementation "com.atlassian.commonmark:commonmark:${commonmark}"
    implementation "com.atlassian.commonmark:commonmark-ext-autolink:${commonmark}"
    implementation "com.atlassian.commonmark:commonmark-ext-gfm-strikethrough:${commonmark}"
    implementation "com.atlassian.commonmark:commonmark-ext-gfm-tables:${commonmark}"
    implementation "com.atlassian.commonmark:commonmark-ext-ins:${commonmark}"
    implementation "com.atlassian.commonmark:commonmark-ext-yaml-front-matter:${commonmark}"
    implementation "com.google.firebase:firebase-analytics:17.2.1"
    implementation "com.google.firebase:firebase-inappmessaging:19.0.2"
    implementation "com.google.firebase:firebase-messaging:20.1.0"
    implementation "com.google.firebase:firebase-database:19.2.0"
    implementation 'com.google.firebase:firebase-perf:19.0.4'
    implementation "com.google.android.gms:play-services-base:17.1.0"
    implementation('com.github.b3er.rxfirebase:firebase-database-kotlin:11.2.0') { transitive = false }
    implementation('com.github.b3er.rxfirebase:firebase-database:11.2.0') { transitive = false }
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') { transitive = true }
    implementation "com.github.miguelbcr:RxBillingService:0.0.3"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
    implementation 'org.jsoup:jsoup:1.12.1'
    implementation "com.evernote:android-state:${state_version}"
    implementation "petrov.kristiyan:colorpicker-library:1.1.4"
    implementation 'com.apollographql.apollo:apollo-rx2-support:1.2.2'
    implementation("com.apollographql.apollo:apollo-runtime:1.2.2")
    implementation 'com.jaredrummler:android-device-names:1.1.9'
    implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.8.2'
    implementation 'com.google.guava:guava:27.0.1-android' /*to be removed*/
    debugImplementation 'com.github.whataa:pandora:2.0.6'
    releaseImplementation 'com.github.whataa:pandora-no-op:2.0.3'

    compileOnly "org.projectlombok:lombok:${lombokVersion}"

    kapt "org.projectlombok:lombok:${lombokVersion}"
    kapt "com.evernote:android-state-processor:${state_version}"
    kapt "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
    kapt 'com.github.matthiasrobbers:shortbread-compiler:1.0.1'
    kapt "io.requery:requery-processor:${requery}"
    kapt "com.github.bumptech.glide:compiler:$glideVersion"
}

apply plugin: 'com.google.gms.google-services'