/*
 * 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 androidx.build.PlatformIdentifier
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType

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

androidXMultiplatform {
    android()
    jvmStubs()
    linuxX64Stubs()

    defaultPlatform(PlatformIdentifier.ANDROID)

    sourceSets {
        commonMain {
            dependencies {
                api(project(":lifecycle:lifecycle-runtime"))
                api("androidx.annotation:annotation:1.8.1")
                api("androidx.compose.runtime:runtime:1.7.1")
            }
        }

        androidMain {
            dependsOn(commonMain)
            dependencies {
                // Although this artifact is empty, it ensures that upgrading
                // `lifecycle-runtime-compose` also updates `lifecycle-runtime-ktx`
                // in cases where our constraints fail (e.g., internally in AndroidX
                // when using project dependencies).
                api(project(":lifecycle:lifecycle-runtime-ktx"))
            }
        }

        androidInstrumentedTest {
            dependencies {
                implementation(project(":lifecycle:lifecycle-runtime-testing"))
                implementation(project(":compose:ui:ui-test"))
                implementation(project(":compose:test-utils"))
                implementation(libs.testRules)
                implementation(libs.testRunner)
                implementation(libs.kotlinTest)
                implementation(project(":kruth:kruth"))
            }
        }

        nonAndroidMain {
            dependsOn(commonMain)
        }

        jvmStubsMain {
            dependsOn(nonAndroidMain)
        }

        linuxx64StubsMain {
            dependsOn(nonAndroidMain)
        }
    }
}

androidx {
    name = "Lifecycle Runtime Compose"
    type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    inceptionYear = "2021"
    description = "Compose integration with Lifecycle"
    samples(project(":lifecycle:lifecycle-runtime-compose:lifecycle-runtime-compose-samples"))
}

android {
    compileSdk 35

    buildTypes.configureEach {
        consumerProguardFiles "proguard-rules.pro"
    }

    namespace "androidx.lifecycle.runtime.compose"
}
