/*
 * Copyright 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.KotlinTarget
import androidx.build.LibraryType

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

androidXMultiplatform {
    android()

    sourceSets {
        commonMain {
            dependencies {
                implementation(libs.kotlinStdlib)
                api("androidx.compose.foundation:foundation:1.5.0")
                api(project(":paging:paging-common"))
                api("androidx.compose.runtime:runtime:1.5.0")
            }
        }

        jvmMain {
            dependsOn(commonMain)
        }

        androidMain {
            dependsOn(jvmMain)
        }

        commonTest {
            dependencies {
                implementation(project(":compose:ui:ui-tooling"))
                implementation(project(":compose:test-utils"))
                implementation(project(":internal-testutils-paging"))
            }
        }

        jvmTest {
            dependsOn(commonTest)
            dependencies {
                implementation(project(":compose:ui:ui-test-junit4"))
            }
        }

        androidInstrumentedTest {
            dependsOn(jvmTest)
            dependencies {
                implementation(libs.testRunner)
                implementation(libs.junit)
                implementation(libs.truth)
            }
        }
    }
}

androidx {
    name = "Paging-Compose"
    type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    inceptionYear = "2020"
    description = "Compose integration with Paging"
    legacyDisableKotlinStrictApiMode = true
    kotlinTarget = KotlinTarget.KOTLIN_1_9
    samples(project(":paging:paging-compose:paging-compose-samples"))
}

android {
    compileSdk = 35
    namespace = "androidx.paging.compose"
    // TODO(b/313699418): need to update compose.runtime version to 1.6.0+
    experimentalProperties["android.lint.useK2Uast"] = false
}
