/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion build_versions.compile_sdk
    defaultConfig {
        applicationId "com.example.android.navigationsample"
        minSdkVersion build_versions.min_sdk
        targetSdkVersion build_versions.target_sdk
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }

    // Robolectric
    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }

    sourceSets {
        androidTest {
            java.srcDirs += "src/uiTest/java"
        }
        test {
            java.srcDirs += "src/uiTest/java"
            resources.srcDirs += 'src/uiTest/resources'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation deps.kotlin.stdlib
    implementation deps.app_compat
    implementation deps.material
    implementation deps.constraint_layout
    implementation deps.core_ktx

    implementation deps.lifecycle.viewmodel_ktx

    implementation deps.navigation.fragment_ktx
    implementation deps.navigation.runtime_ktx
    implementation deps.fragment.runtime_ktx

    // "androidx.fragment:fragment-testing" must be scoped to all sourcesets.
    implementation deps.fragment.testing
    // Forcing androidx.test:core version
    implementation deps.atsl.core

    // Espresso and UI Testing
    androidTestImplementation deps.atsl.core
    androidTestImplementation deps.atsl.ext_junit
    androidTestImplementation deps.espresso.core
    androidTestImplementation deps.espresso.contrib
    androidTestImplementation deps.espresso.intents
    androidTestImplementation deps.navigation.testing
    androidTestImplementation deps.truth

    // Host-side tests
    testImplementation deps.atsl.core
    testImplementation deps.atsl.ext_junit
    testImplementation deps.robolectric
    // Espresso API running in Robolectric
    testImplementation deps.espresso.core
    testImplementation deps.espresso.contrib
    testImplementation deps.espresso.intents
    testImplementation deps.navigation.testing
    testImplementation deps.truth
}
