/*
 * Copyright (c) 2023 Christian Kierdorf
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the “Software”),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 */
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace = 'de.schliweb.bluesharpbendingapp'
    compileSdk = 35

    defaultConfig {
        applicationId "de.schliweb.bluesharpbendingapp"
        minSdk = 28
        targetSdk = 35
        versionCode = 72
        versionName = project.version.toString()

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    dependenciesInfo {
        // Disables the inclusion of dependency metadata in the APK,
        // required for F-Droid to comply with its focus on privacy and transparency.
        // Dependency metadata is unnecessary and could expose additional information.
        includeInApk = false
        // Disables the inclusion of dependency metadata in Android App Bundles as well.
        includeInBundle = false
    }

    buildTypes {
        release {
            minifyEnabled = true
            shrinkResources = true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    buildFeatures {
        viewBinding = true
    }

    testOptions {
        unitTests.returnDefaultValues = true
        unitTests.includeAndroidResources = true
    }
    kotlinOptions {
        jvmTarget = '17'
    }


}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.7.1'
    implementation 'com.google.android.material:material:1.13.0-rc01'
    implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.9.3'
    implementation 'androidx.navigation:navigation-ui-ktx:2.9.3'
    implementation 'androidx.core:core-splashscreen:1.0.1'
    implementation 'androidx.activity:activity-ktx:1.10.1'
    // Dependency Injection with Dagger
    implementation "com.google.dagger:dagger:${daggerVersion}"
    annotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}"
    implementation(project(":base"))
    // SLF4J API and binding to java.util.logging so logs go to Logcat
    implementation "org.slf4j:slf4j-api:${slf4jVersion}"
    implementation "org.slf4j:slf4j-jdk14:${slf4jVersion}"
    compileOnly "org.projectlombok:lombok:${lombokVersion}"
    annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
    implementation 'androidx.core:core-ktx:1.16.0'
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'androidx.test:core:1.6.1'
    testImplementation 'org.robolectric:robolectric:4.13'
    debugImplementation "androidx.fragment:fragment-testing:1.8.8"
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
    androidTestImplementation 'androidx.test:runner:1.6.2'
    androidTestImplementation 'androidx.test:rules:1.6.1'
    debugImplementation 'androidx.test:core:1.6.1'
    androidTestImplementation 'org.mockito:mockito-android:5.14.2'
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.9.25"))
}

android.buildTypes.release.ndk.debugSymbolLevel = 'FULL'

tasks.withType(Test).configureEach {
    testLogging {
        events "passed", "skipped", "failed"
    }
}

tasks.register("runAllTests") {
    dependsOn "test", "connectedAndroidTest"
}
