/*
 * Copyright 2022 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    id("AndroidXPlugin")
    id("com.android.library")
    id("kotlin-android")
}

dependencies {
    api(project(":fragment:fragment-ktx"))
    api("androidx.lifecycle:lifecycle-viewmodel:2.6.1")
    implementation("androidx.activity:activity-ktx:1.8.1")
    implementation("androidx.activity:activity:1.8.1")
    api(libs.kotlinStdlib)

    lintPublish(project(":fragment:fragment-testing-manifest-lint"))
}

androidx {
    name = "Fragment Testing Manifest dependency"
    type = LibraryType.PUBLISHED_TEST_LIBRARY
    inceptionYear = "2022"
    description = "Fragment testing library that should be added as a debugImplementation dependency to add properties to the debug manifest necessary for testing an application"
    legacyDisableKotlinStrictApiMode = true
    doNotDocumentReason = "No public API"
}

android {
    namespace = "androidx.fragment.testing.manifest"
}

tasks.withType(KotlinCompile).configureEach {
    kotlinOptions {
        freeCompilerArgs += [
                "-Xjvm-default=all",
        ]
    }
}
