/*
 * Copyright 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")
}

android {
    compileSdk = 35
    namespace = "androidx.appsearch.debugview"
}

dependencies {
    api(libs.jspecify)
    implementation(project(":appsearch:appsearch"))
    implementation(project(":appsearch:appsearch-local-storage"))
    implementation(project(":appsearch:appsearch-platform-storage"))
    implementation("androidx.concurrent:concurrent-futures:1.0.0")
    implementation("androidx.constraintlayout:constraintlayout:2.2.0-beta01")
    implementation("androidx.core:core:1.5.0")
    implementation("androidx.fragment:fragment:1.3.0")
    implementation("androidx.legacy:legacy-support-v4:1.0.0")
    implementation("androidx.lifecycle:lifecycle-livedata:2.0.0")
    implementation("com.google.android.material:material:1.0.0")
    implementation(libs.guavaAndroid)
}

androidx {
    name = "AppSearch Debug View"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2021"
    description = "A support library for AndroidX AppSearch that contains activities and views " +
            "for debugging an application's integration with AppSearch."
    doNotDocumentReason = "No public API"
}
