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>null18plugins { 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>null26kotlin { 27 explicitApi() 28 } 29 <lambda>null30android { 31 namespace = "com.google.accompanist.adaptive" 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 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 40 } 41 42 compileOptions { 43 sourceCompatibility = JavaVersion.VERSION_1_8 44 targetCompatibility = JavaVersion.VERSION_1_8 45 } 46 47 buildFeatures { 48 buildConfig = false 49 compose = true 50 } 51 52 composeOptions { 53 kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() 54 } 55 56 lint { 57 textReport = true 58 textOutput = File("stdout") 59 // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks 60 checkReleaseBuilds = false 61 } 62 63 packagingOptions { 64 // Some of the META-INF files conflict with coroutines-test. Exclude them to enable 65 // our test APK to build (has no effect on our AARs) 66 resources { 67 excludes += listOf("/META-INF/AL2.0", "/META-INF/LGPL2.1") 68 } 69 } 70 71 testOptions { 72 unitTests { 73 isIncludeAndroidResources = true 74 } 75 animationsDisabled = true 76 } 77 78 sourceSets { 79 named("test") { 80 java.srcDirs("src/sharedTest/kotlin") 81 res.srcDirs("src/sharedTest/res") 82 } 83 named("androidTest") { 84 java.srcDirs("src/sharedTest/kotlin") 85 res.srcDirs("src/sharedTest/res") 86 } 87 } 88 } 89 <lambda>null90metalava { 91 sourcePaths.setFrom("src/main") 92 filename.set("api/current.api") 93 reportLintsAsErrors.set(true) 94 } 95 <lambda>null96dependencies { 97 api(libs.compose.foundation.foundation) 98 api(libs.compose.ui.ui) 99 api(libs.androidx.window) 100 101 implementation(libs.kotlin.coroutines.android) 102 implementation(libs.compose.ui.util) 103 104 // ====================== 105 // Test dependencies 106 // ====================== 107 108 androidTestImplementation(project(":internal-testutils")) 109 testImplementation(project(":internal-testutils")) 110 111 androidTestImplementation(project(":testharness")) 112 testImplementation(project(":testharness")) 113 114 androidTestImplementation(libs.junit) 115 testImplementation(libs.junit) 116 117 androidTestImplementation(libs.truth) 118 testImplementation(libs.truth) 119 120 androidTestImplementation(libs.compose.ui.test.junit4) 121 testImplementation(libs.compose.ui.test.junit4) 122 123 androidTestImplementation(libs.compose.ui.test.manifest) 124 testImplementation(libs.compose.ui.test.manifest) 125 126 androidTestImplementation(libs.androidx.test.runner) 127 testImplementation(libs.androidx.test.runner) 128 129 androidTestImplementation(libs.androidx.window.testing) 130 testImplementation(libs.androidx.window.testing) 131 132 testImplementation(libs.robolectric) 133 } 134