xref: /aosp_15_r20/external/accompanist/placeholder/build.gradle.kts (revision fa44fe6ae8e729aa3cfe5c03eedbbf98fb44e2c6)
1 /*
2  * Copyright 2023 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  *      https://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 @file:Suppress("UnstableApiUsage")
17 
<lambda>null18 plugins {
19     id(libs.plugins.android.library.get().pluginId)
20     id(libs.plugins.android.kotlin.get().pluginId)
21     id(libs.plugins.jetbrains.dokka.get().pluginId)
22     id(libs.plugins.gradle.metalava.get().pluginId)
23     id(libs.plugins.vanniktech.maven.publish.get().pluginId)
24 }
25 
<lambda>null26 kotlin {
27     explicitApi()
28 }
29 
<lambda>null30 android {
31     compileSdk = 34
32 
33     defaultConfig {
34         minSdk = 21
35         // targetSdkVersion has no effect for libraries. This is only used for the test APK
36         targetSdk = 33
37         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
38     }
39 
40     compileOptions {
41         sourceCompatibility = JavaVersion.VERSION_1_8
42         targetCompatibility = JavaVersion.VERSION_1_8
43     }
44 
45     buildFeatures {
46         buildConfig = false
47         compose = true
48     }
49 
50     composeOptions {
51         kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
52     }
53 
54     lint {
55         textReport = true
56         textOutput = File("stdout")
57         // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks
58         checkReleaseBuilds = false
59         disable += setOf("GradleOverrides")
60     }
61 
62     packaging {
63         // Some of the META-INF files conflict with coroutines-test. Exclude them to enable
64         // our test APK to build (has no effect on our AARs)
65         resources {
66             excludes += listOf("/META-INF/AL2.0", "/META-INF/LGPL2.1")
67         }
68     }
69 
70     testOptions {
71         unitTests {
72             isIncludeAndroidResources = true
73         }
74         unitTests.all {
75             it.useJUnit {
76                 excludeCategories("com.google.accompanist.internal.test.IgnoreOnRobolectric")
77             }
78         }
79         animationsDisabled = true
80     }
81 
82     sourceSets {
83         named("test") {
84             java.srcDirs("src/sharedTest/kotlin")
85             res.srcDirs("src/sharedTest/res")
86         }
87         named("androidTest") {
88             java.srcDirs("src/sharedTest/kotlin")
89             res.srcDirs("src/sharedTest/res")
90         }
91     }
92     namespace = "com.google.accompanist.placeholder"
93 }
94 
<lambda>null95 metalava {
96     sourcePaths.setFrom("src/main")
97     filename.set("api/current.api")
98     reportLintsAsErrors.set(true)
99 }
100 
<lambda>null101 dependencies {
102     implementation(libs.compose.foundation.foundation)
103     implementation(libs.compose.ui.util)
104     implementation(libs.kotlin.coroutines.android)
105 
106     // ======================
107     // Test dependencies
108     // ======================
109 
110     androidTestImplementation(project(":internal-testutils"))
111     testImplementation(project(":internal-testutils"))
112 
113     androidTestImplementation(libs.junit)
114     testImplementation(libs.junit)
115 
116     androidTestImplementation(libs.truth)
117     testImplementation(libs.truth)
118 
119     androidTestImplementation(libs.compose.ui.test.junit4)
120     testImplementation(libs.compose.ui.test.junit4)
121 
122     androidTestImplementation(libs.compose.ui.test.manifest)
123     testImplementation(libs.compose.ui.test.manifest)
124 
125     androidTestImplementation(libs.androidx.test.runner)
126     testImplementation(libs.androidx.test.runner)
127 
128     testImplementation(libs.robolectric)
129 }
130