/*
 * Copyright (C) 2021 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.
 */

// Library-level build file

apply plugin: 'com.android.library'
apply plugin: 'jacoco'

android {
    compileSdkVersion 30

    defaultConfig {
        minSdkVersion 28
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        testApplicationId "com.android.car.rotary.test"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
        }
        animationsDisabled = true
    }

    buildTypes {
        debug {
            testCoverageEnabled = true
        }
    }

    project.gradle.taskGraph.whenReady {
        connectedDebugAndroidTest {
            ignoreFailures = true
        }
    }

    // This is the gradle equivalent of the libs: ["android.car"] in the Android.bp
    useLibrary 'android.car'

    useLibrary 'android.test.runner'
    useLibrary 'android.test.base'
    useLibrary 'android.test.mock'
}

dependencies {
    api 'androidx.annotation:annotation:1.2.0'
    api 'androidx.recyclerview:recyclerview:1.2.0'

    // The tests use a CarUiRecyclerView
    androidTestImplementation project(':car-ui-lib')
    androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
    androidTestImplementation "com.google.truth:truth:1.1.2"
    androidTestImplementation "androidx.test.ext:junit:1.1.2"
    androidTestImplementation "org.mockito:mockito-core:2.19.0"
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    // This is needed to be able to spy certain classes with Mockito
    // It's major/minor version must match Mockito's.
    androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.19.0'
    // Required for instrumented tests
    androidTestImplementation 'com.android.support:support-annotations:28.0.0'
}
