blob: 19e6693293bbbfa9ec82eb34fed7f541bca929ab [file] [log] [blame]
Sergey Vasilinets86b16e22018-07-23 13:42:25 -07001/*
2 * Copyright 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Sergey Vasilinets8df99e42021-08-24 00:27:51 +010017
Aurimas Liutikas75e93a02019-05-28 16:31:38 -070018import androidx.build.Publish
Sergey Vasilinets5c60b722021-10-08 17:05:47 +010019import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
Sergey Vasilinets86b16e22018-07-23 13:42:25 -070020
21plugins {
Aurimas Liutikascdb9f9f2019-04-08 12:07:49 +010022 id("AndroidXPlugin")
23 id("com.android.library")
Sergey Vasilinets119333c2018-12-05 16:58:58 +000024 id("kotlin-android")
25}
26
27android {
Sergey Vasilinets645511d2019-06-07 14:51:53 +010028 buildTypes.all {
Jim Sproch9e38b4f2021-01-06 14:21:06 -080029 consumerProguardFiles("proguard-rules.pro")
Sergey Vasilinets645511d2019-06-07 14:51:53 +010030 }
Aurimas Liutikasdcfa0352022-03-14 16:05:33 -070031 namespace "androidx.lifecycle.viewmodel.savedstate"
Sergey Vasilinets86b16e22018-07-23 13:42:25 -070032}
33
34dependencies {
Sergey Vasilinetseced0492019-03-11 13:02:04 +000035 api("androidx.annotation:annotation:1.0.0")
Jeremy Woods77f028b2022-01-24 14:32:32 -080036 api("androidx.core:core-ktx:1.2.0")
Ian Lake29973ff2022-03-18 22:16:45 +000037 api(projectOrArtifact(":savedstate:savedstate"))
Dustin Lam511e5d72021-01-29 23:13:09 +000038 api(projectOrArtifact(":lifecycle:lifecycle-livedata-core"))
39 api(projectOrArtifact(":lifecycle:lifecycle-viewmodel"))
Sergey Vasilinets5c60b722021-10-08 17:05:47 +010040 api(libs.kotlinStdlib)
Jeremy Woods08a32ea2022-02-04 13:48:49 -080041 api(libs.kotlinCoroutinesAndroid)
Sergey Vasilinets86b16e22018-07-23 13:42:25 -070042
Dustin Lam511e5d72021-01-29 23:13:09 +000043 androidTestImplementation projectOrArtifact(":lifecycle:lifecycle-runtime")
44 androidTestImplementation projectOrArtifact(":lifecycle:lifecycle-livedata-core")
Sergey Vasilinets15d5a9d2021-06-25 14:30:22 +010045 androidTestImplementation ("androidx.fragment:fragment:1.3.0")
46 androidTestImplementation project(":internal-testutils-runtime")
Aurimas Liutikasbc1dbeb2021-05-04 13:36:59 -070047 androidTestImplementation(libs.truth)
48 androidTestImplementation(libs.kotlinStdlib)
49 androidTestImplementation(libs.testExtJunit)
50 androidTestImplementation(libs.testCore)
51 androidTestImplementation(libs.testRunner)
52 androidTestImplementation(libs.testRules)
Sergey Vasilinets86b16e22018-07-23 13:42:25 -070053}
54
Simon Schiller4cc61bc2021-01-23 10:30:45 +000055//used by testImplementation safe-args-generator
56android.libraryVariants.all { variant ->
57 def name = variant.name
58 def suffix = name.capitalize()
59 project.tasks.register("jar${suffix}", Copy).configure {
60 dependsOn ("assemble$suffix")
61 from(zipTree("${project.buildDir}/outputs/aar/lifecycle-viewmodel-savedstate-${name}.aar")) {
62 include "classes.jar"
63 }
64 destinationDir new File(project.buildDir, "libJar")
65 }
66}
67
Aurimas Liutikas2ad31612019-04-01 04:23:03 -070068androidx {
Sergey Vasilinets86b16e22018-07-23 13:42:25 -070069 name = "Android Lifecycle ViewModel with SavedState"
Aurimas Liutikas75e93a02019-05-28 16:31:38 -070070 publish = Publish.SNAPSHOT_AND_RELEASE
Sergey Vasilinets86b16e22018-07-23 13:42:25 -070071 mavenGroup = LibraryGroups.LIFECYCLE
72 inceptionYear = "2018"
73 description = "Android Lifecycle ViewModel"
Sergey Vasilinets86b16e22018-07-23 13:42:25 -070074}
Sergey Vasilinets5c60b722021-10-08 17:05:47 +010075
76tasks.withType(KotlinCompile).configureEach {
77 kotlinOptions {
78 freeCompilerArgs += [
79 "-Xjvm-default=all",
80 ]
81 }
82}