/*
 * Copyright (C) 2020 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("kotlin-android")
}

android {
    buildTypes.configureEach {
        consumerProguardFiles "proguard-rules.pro"
    }
    namespace = "androidx.startup"
}

dependencies {
    api(libs.jspecify)
    // Ideally startup would depend on profileinstaller so startup gets the benefit of its
    // baseline profile rules, but profileinstaller calls startup APIs, so we have to avoid
    // the circular dependency

    implementation("androidx.annotation:annotation:1.8.1")
    implementation("androidx.tracing:tracing:1.0.0")
    lintPublish(project(":startup:startup-runtime-lint"))
    androidTestImplementation(libs.kotlinStdlib)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.espressoCore)
    androidTestImplementation(libs.mockitoCore)
    androidTestImplementation(libs.dexmakerMockito)
    testImplementation(libs.junit)
}

androidx {
    name = "Startup Runtime"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2020"
    description = "Android App Startup Runtime"
    legacyDisableKotlinStrictApiMode = true
}
