/*
 * 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.
 */

/**
 * This file was created using the `create_project.py` script located in the
 * `<AndroidX root>/development/project-creator` directory.
 *
 * Please use that script when creating a new project, rather than copying an existing project and
 * modifying its settings.
 */
import androidx.build.LibraryType

plugins {
    id("AndroidXPlugin")
    id("com.android.library")
    id("org.jetbrains.kotlin.android")
    id("androidx.stableaidl")
}

dependencies {
    api(libs.jspecify)
    api(libs.kotlinStdlib)
    implementation(libs.kotlinCoroutinesCore)
    api("androidx.annotation:annotation:1.8.1")
    implementation(libs.guavaListenableFuture)
    implementation(libs.guavaAndroid)
    implementation("androidx.core:core-ktx:1.7.0")
    implementation("androidx.concurrent:concurrent-futures-ktx:1.1.0")
    implementation(project(":health:health-services-client-proto"))

    testImplementation(libs.junit)
    testImplementation(libs.kotlinReflect)
    testImplementation(libs.robolectric)
    testImplementation(libs.testCore)
    testImplementation(libs.truth)
    testImplementation(libs.kotlinTest)
    testImplementation(libs.kotlinCoroutinesTest)
    testImplementation(libs.kotlinTest)
}

android {
    defaultConfig {
        minSdk = 30
    }
    buildFeatures {
        aidl = true
    }
    buildTypes.configureEach {
        consumerProguardFiles("proguard-rules.pro")

        stableAidl {
            version = 1
        }
    }
    namespace = "androidx.health.services.client"
}

androidx {
    name = "Health Services Client"
    type = LibraryType.PUBLISHED_LIBRARY
    mavenVersion = LibraryVersions.HEALTH_SERVICES_CLIENT
    inceptionYear = "2021"
    description = "This library helps developers create performant health applications in a platform agnostic way"
    legacyDisableKotlinStrictApiMode = true
}
