blob: cf8f78a8febe5e588fb14c67e602a9de8ca86d79 [file] [log] [blame]
/*
* 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.
*/
import androidx.build.AndroidXComposePlugin
import androidx.build.LibraryType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
id("AndroidXComposePlugin")
id("com.android.library")
}
AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
dependencies {
if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
/* When updating dependencies, make sure to make the an an analogous update in the
corresponding block below */
api project(":compose:runtime:runtime")
api "androidx.annotation:annotation:1.1.0"
implementation(libs.kotlinStdlib)
testImplementation(libs.junit)
testImplementation(libs.truth)
testImplementation(libs.testCore)
testImplementation(libs.testRules)
androidTestImplementation projectOrArtifact(':compose:ui:ui')
androidTestImplementation projectOrArtifact(":compose:ui:ui-test-junit4")
androidTestImplementation projectOrArtifact(":compose:test-utils")
androidTestImplementation "androidx.fragment:fragment:1.3.0"
androidTestImplementation projectOrArtifact(":activity:activity-compose")
androidTestImplementation(libs.testUiautomator)
androidTestImplementation(libs.testCore)
androidTestImplementation(libs.testRules)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.espressoCore)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.truth)
androidTestImplementation(libs.dexmakerMockito)
androidTestImplementation(libs.mockitoCore)
lintPublish(project(":compose:runtime:runtime-saveable-lint"))
samples(projectOrArtifact(":compose:runtime:runtime-saveable:runtime-saveable-samples"))
}
}
if(AndroidXComposePlugin.isMultiplatformEnabled(project)) {
androidXComposeMultiplatform {
android()
desktop()
}
kotlin {
/* When updating dependencies, make sure to make the an an analogous update in the
corresponding block above */
sourceSets {
commonMain.dependencies {
implementation(libs.kotlinStdlibCommon)
api project(":compose:runtime:runtime")
}
androidMain.dependencies {
implementation(libs.kotlinStdlib)
api "androidx.annotation:annotation:1.1.0"
}
// TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
// need to add Robolectric (which must be kept out of androidAndroidTest), use a top
// level dependencies block instead:
// `dependencies { testImplementation(libs.robolectric) }`
androidTest.dependencies {
implementation(libs.testRules)
implementation(libs.testRunner)
implementation(libs.junit)
implementation(libs.truth)
}
androidAndroidTest.dependencies {
implementation project(':compose:ui:ui')
implementation project(":compose:ui:ui-test-junit4")
implementation project(":compose:test-utils")
implementation "androidx.fragment:fragment:1.3.0"
implementation "androidx.activity:activity-compose:1.3.1"
implementation(libs.testUiautomator)
implementation(libs.testCore)
implementation(libs.testRules)
implementation(libs.testRunner)
implementation(libs.espressoCore)
implementation(libs.junit)
implementation(libs.truth)
implementation(libs.dexmakerMockito)
implementation(libs.mockitoCore)
}
}
}
dependencies {
samples(projectOrArtifact(":compose:runtime:runtime-saveable:runtime-saveable-samples"))
}
}
androidx {
name = "Compose Saveable"
type = LibraryType.PUBLISHED_LIBRARY
mavenGroup = LibraryGroups.COMPOSE_RUNTIME
inceptionYear = "2020"
description = "Compose components that allow saving and restoring the local ui state"
legacyDisableKotlinStrictApiMode = true
}
android {
namespace "androidx.compose.runtime.saveable"
}
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
"-Xjvm-default=all",
]
}
}