apply plugin: 'com.android.application'
apply plugin: 'checkstyle'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "org.mercury_im.messenger"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        disable 'GoogleAppIndexingWarning', 'AllowBackup'
        // Warn about invalidUsername packages instead of failing
        warning 'InvalidPackage'
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

    dataBinding {
        enabled true
    }
}

checkstyle {
    toolVersion = '8.17'
    configFile = rootProject.file('config/checkstyle/checkstyle.xml')
}

task checkstyleMain(type: Checkstyle) {
    source 'src/main/java'
    include '**/*.java'
    exclude '**/gen/**'
    classpath = files()
}

task checkstyleTest(type: Checkstyle) {
    source 'src/test/java'
    include '**/*.java'
    exclude '**/gen/**'
    classpath = files()
}

task checkstyleAndroidTest(type: Checkstyle) {
    source 'src/androidTest/java'
    include '**/*.java'
    exclude '**/gen/**'
    classpath = files()
}

check.configure {
    // dependsOn(checkstyleMain)
    // dependsOn(checkstyleTest)
    // dependsOn(checkstyleAndroidTest)
}

// Dependency versions are located in version.gradle
dependencies {

    // Depend on the core project for XMPP related stuff
    implementation project(":entity")
    implementation project(":domain")
    implementation project(":data")

    implementation "io.requery:requery-android:$requeryVersion"
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61'

    // Dagger 2 for dependency injection
    implementation "com.google.dagger:dagger:$daggerVersion"
    annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"

    compileOnly "org.projectlombok:lombok:$lombokVersion"
    annotationProcessor "org.projectlombok:lombok:$lombokVersion"

    // ViewModel and LiveData
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"
    annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"

    // Android extension for rxJava
    api "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"

    // ButterKnife for View Binding
    implementation "com.jakewharton:butterknife:$butterKnifeVersion"
    annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"

    // support libraries
    implementation "androidx.appcompat:appcompat:$appCompatVersion"
    implementation 'com.google.android.material:material:1.2.0-alpha03'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'

    // circular image viewer for avatars
    implementation 'de.hdodenhof:circleimageview:3.0.1'

    // Android specific classes of Smacks API
    implementation "org.igniterealtime.smack:smack-android-extensions:$smackAndroidExtensionsVersion"

    // Testing - as if...
    testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
    testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
    androidTestImplementation "androidx.test:runner:$andxTestRunnerVersion"
    androidTestImplementation "androidx.test.espresso:espresso-core:$andxTestEspressoVersion"
}
