xref: /aosp_15_r20/external/accompanist/permissions/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     namespace = "com.google.accompanist.permissions"
32 
33     compileSdk = 34
34 
35     defaultConfig {
36         minSdk = 21
37         // targetSdkVersion has no effect for libraries. This is only used for the test APK
38         targetSdk = 33
39 
40         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
41 
42         // The following argument makes the Android Test Orchestrator run its
43         // "pm clear" command after each test invocation. This command ensures
44         // that the app's state is completely cleared between tests.
45         testInstrumentationRunnerArguments["clearPackageData"] = "true"
46     }
47 
48     compileOptions {
49         sourceCompatibility = JavaVersion.VERSION_1_8
50         targetCompatibility = JavaVersion.VERSION_1_8
51     }
52 
53     buildFeatures {
54         buildConfig = false
55         compose = true
56     }
57 
58     composeOptions {
59         kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
60     }
61 
62     lint {
63         textReport = true
64         textOutput = File("stdout")
65         // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks
66         checkReleaseBuilds = false
67         disable += setOf("GradleOverrides")
68     }
69 
70     testOptions {
71         unitTests {
72             isIncludeAndroidResources = true
73         }
74         animationsDisabled = true
75         execution = "ANDROIDX_TEST_ORCHESTRATOR"
76     }
77 
78     packaging {
79         // Exclude license files to enable our test APK to build (has no effect on our AARs)
80         resources {
81             excludes += listOf("/META-INF/AL2.0", "/META-INF/LGPL2.1")
82         }
83     }
84 }
85 
<lambda>null86 metalava {
87     sourcePaths.setFrom("src/main")
88     filename.set("api/current.api")
89     reportLintsAsErrors.set(true)
90 }
91 
<lambda>null92 dependencies {
93     implementation(libs.androidx.activity.compose)
94     implementation(libs.compose.foundation.foundation)
95     implementation(libs.kotlin.coroutines.android)
96 
97     lintChecks(project(":permissions-lint"))
98     lintPublish(project(":permissions-lint"))
99 
100     // ======================
101     // Test dependencies
102     // ======================
103 
104     androidTestUtil(libs.androidx.test.orchestrator)
105 
106     androidTestImplementation(project(":internal-testutils"))
107     androidTestImplementation(libs.androidx.activity.compose)
108     androidTestImplementation(libs.compose.material.material)
109 
110     androidTestImplementation(libs.junit)
111     androidTestImplementation(libs.truth)
112 
113     androidTestImplementation(libs.compose.ui.test.junit4)
114     androidTestImplementation(libs.compose.ui.test.manifest)
115     androidTestImplementation(libs.compose.foundation.foundation)
116     androidTestImplementation(libs.androidx.test.runner)
117     androidTestImplementation(libs.androidx.test.rules)
118     androidTestImplementation(libs.androidx.test.uiAutomator)
119 }
120