| Sergey Vasilinets | 86b16e2 | 2018-07-23 13:42:25 -0700 | [diff] [blame] | 1 | /* |
| 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 Vasilinets | 8df99e4 | 2021-08-24 00:27:51 +0100 | [diff] [blame] | 17 | |
| Aurimas Liutikas | 75e93a0 | 2019-05-28 16:31:38 -0700 | [diff] [blame] | 18 | import androidx.build.Publish |
| Sergey Vasilinets | 5c60b72 | 2021-10-08 17:05:47 +0100 | [diff] [blame] | 19 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| Sergey Vasilinets | 86b16e2 | 2018-07-23 13:42:25 -0700 | [diff] [blame] | 20 | |
| 21 | plugins { |
| Aurimas Liutikas | cdb9f9f | 2019-04-08 12:07:49 +0100 | [diff] [blame] | 22 | id("AndroidXPlugin") |
| 23 | id("com.android.library") |
| Sergey Vasilinets | 119333c | 2018-12-05 16:58:58 +0000 | [diff] [blame] | 24 | id("kotlin-android") |
| 25 | } |
| 26 | |
| 27 | android { |
| Sergey Vasilinets | 645511d | 2019-06-07 14:51:53 +0100 | [diff] [blame] | 28 | buildTypes.all { |
| Jim Sproch | 9e38b4f | 2021-01-06 14:21:06 -0800 | [diff] [blame] | 29 | consumerProguardFiles("proguard-rules.pro") |
| Sergey Vasilinets | 645511d | 2019-06-07 14:51:53 +0100 | [diff] [blame] | 30 | } |
| Aurimas Liutikas | dcfa035 | 2022-03-14 16:05:33 -0700 | [diff] [blame] | 31 | namespace "androidx.lifecycle.viewmodel.savedstate" |
| Sergey Vasilinets | 86b16e2 | 2018-07-23 13:42:25 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | dependencies { |
| Sergey Vasilinets | eced049 | 2019-03-11 13:02:04 +0000 | [diff] [blame] | 35 | api("androidx.annotation:annotation:1.0.0") |
| Jeremy Woods | 77f028b | 2022-01-24 14:32:32 -0800 | [diff] [blame] | 36 | api("androidx.core:core-ktx:1.2.0") |
| Ian Lake | 29973ff | 2022-03-18 22:16:45 +0000 | [diff] [blame^] | 37 | api(projectOrArtifact(":savedstate:savedstate")) |
| Dustin Lam | 511e5d7 | 2021-01-29 23:13:09 +0000 | [diff] [blame] | 38 | api(projectOrArtifact(":lifecycle:lifecycle-livedata-core")) |
| 39 | api(projectOrArtifact(":lifecycle:lifecycle-viewmodel")) |
| Sergey Vasilinets | 5c60b72 | 2021-10-08 17:05:47 +0100 | [diff] [blame] | 40 | api(libs.kotlinStdlib) |
| Jeremy Woods | 08a32ea | 2022-02-04 13:48:49 -0800 | [diff] [blame] | 41 | api(libs.kotlinCoroutinesAndroid) |
| Sergey Vasilinets | 86b16e2 | 2018-07-23 13:42:25 -0700 | [diff] [blame] | 42 | |
| Dustin Lam | 511e5d7 | 2021-01-29 23:13:09 +0000 | [diff] [blame] | 43 | androidTestImplementation projectOrArtifact(":lifecycle:lifecycle-runtime") |
| 44 | androidTestImplementation projectOrArtifact(":lifecycle:lifecycle-livedata-core") |
| Sergey Vasilinets | 15d5a9d | 2021-06-25 14:30:22 +0100 | [diff] [blame] | 45 | androidTestImplementation ("androidx.fragment:fragment:1.3.0") |
| 46 | androidTestImplementation project(":internal-testutils-runtime") |
| Aurimas Liutikas | bc1dbeb | 2021-05-04 13:36:59 -0700 | [diff] [blame] | 47 | androidTestImplementation(libs.truth) |
| 48 | androidTestImplementation(libs.kotlinStdlib) |
| 49 | androidTestImplementation(libs.testExtJunit) |
| 50 | androidTestImplementation(libs.testCore) |
| 51 | androidTestImplementation(libs.testRunner) |
| 52 | androidTestImplementation(libs.testRules) |
| Sergey Vasilinets | 86b16e2 | 2018-07-23 13:42:25 -0700 | [diff] [blame] | 53 | } |
| 54 | |
| Simon Schiller | 4cc61bc | 2021-01-23 10:30:45 +0000 | [diff] [blame] | 55 | //used by testImplementation safe-args-generator |
| 56 | android.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 Liutikas | 2ad3161 | 2019-04-01 04:23:03 -0700 | [diff] [blame] | 68 | androidx { |
| Sergey Vasilinets | 86b16e2 | 2018-07-23 13:42:25 -0700 | [diff] [blame] | 69 | name = "Android Lifecycle ViewModel with SavedState" |
| Aurimas Liutikas | 75e93a0 | 2019-05-28 16:31:38 -0700 | [diff] [blame] | 70 | publish = Publish.SNAPSHOT_AND_RELEASE |
| Sergey Vasilinets | 86b16e2 | 2018-07-23 13:42:25 -0700 | [diff] [blame] | 71 | mavenGroup = LibraryGroups.LIFECYCLE |
| 72 | inceptionYear = "2018" |
| 73 | description = "Android Lifecycle ViewModel" |
| Sergey Vasilinets | 86b16e2 | 2018-07-23 13:42:25 -0700 | [diff] [blame] | 74 | } |
| Sergey Vasilinets | 5c60b72 | 2021-10-08 17:05:47 +0100 | [diff] [blame] | 75 | |
| 76 | tasks.withType(KotlinCompile).configureEach { |
| 77 | kotlinOptions { |
| 78 | freeCompilerArgs += [ |
| 79 | "-Xjvm-default=all", |
| 80 | ] |
| 81 | } |
| 82 | } |