1 /* 2 * Copyright (C) 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 * 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 <lambda>null17plugins { 18 alias(libs.plugins.android.library) 19 alias(libs.plugins.kotlin.android) 20 alias(libs.plugins.kotlin.kapt) 21 alias(libs.plugins.dagger.hilt.android) 22 } 23 <lambda>null24android { 25 namespace = "com.google.jetpackcamera.settings" 26 compileSdk = libs.versions.compileSdk.get().toInt() 27 compileSdkPreview = libs.versions.compileSdkPreview.get() 28 29 defaultConfig { 30 minSdk = libs.versions.minSdk.get().toInt() 31 testOptions.targetSdk = libs.versions.targetSdk.get().toInt() 32 lint.targetSdk = libs.versions.targetSdk.get().toInt() 33 34 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 35 } 36 37 flavorDimensions += "flavor" 38 productFlavors { 39 create("stable") { 40 dimension = "flavor" 41 isDefault = true 42 } 43 44 create("preview") { 45 dimension = "flavor" 46 targetSdkPreview = libs.versions.targetSdkPreview.get() 47 } 48 } 49 50 compileOptions { 51 sourceCompatibility = JavaVersion.VERSION_17 52 targetCompatibility = JavaVersion.VERSION_17 53 } 54 kotlin { 55 jvmToolchain(17) 56 } 57 buildFeatures { 58 buildConfig = true 59 compose = true 60 } 61 composeOptions { 62 kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() 63 } 64 65 @Suppress("UnstableApiUsage") 66 testOptions { 67 managedDevices { 68 localDevices { 69 create("pixel2Api28") { 70 device = "Pixel 2" 71 apiLevel = 28 72 } 73 create("pixel8Api34") { 74 device = "Pixel 8" 75 apiLevel = 34 76 systemImageSource = "aosp_atd" 77 } 78 } 79 } 80 } 81 } 82 <lambda>null83dependencies { 84 // Compose 85 val composeBom = platform(libs.compose.bom) 86 implementation(composeBom) 87 androidTestImplementation(composeBom) 88 89 // Compose - Material Design 3 90 implementation(libs.compose.material3) 91 92 // Compose - Android Studio Preview support 93 implementation(libs.compose.ui.tooling.preview) 94 debugImplementation(libs.compose.ui.tooling) 95 96 // Compose - Integration with ViewModels with Navigation and Hilt 97 implementation(libs.hilt.navigation.compose) 98 99 // Compose - Testing 100 androidTestImplementation(libs.compose.junit) 101 102 // Testing 103 testImplementation(libs.junit) 104 testImplementation(libs.mockito.core) 105 testImplementation(libs.kotlinx.coroutines.test) 106 androidTestImplementation(libs.androidx.junit) 107 androidTestImplementation(libs.androidx.espresso.core) 108 androidTestImplementation(libs.truth) 109 110 implementation(libs.androidx.core.ktx) 111 112 // Futures 113 implementation(libs.futures.ktx) 114 115 // Hilt 116 implementation(libs.dagger.hilt.android) 117 kapt(libs.dagger.hilt.compiler) 118 119 // Proto Datastore 120 implementation(libs.androidx.datastore) 121 implementation(libs.protobuf.kotlin.lite) 122 123 implementation(project(":data:settings")) 124 } 125 126 // Allow references to generated code 127 kapt { 128 correctErrorTypes = true 129 }