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.feature.preview" 26 compileSdk = libs.versions.compileSdk.get().toInt() 27 28 defaultConfig { 29 minSdk = libs.versions.minSdk.get().toInt() 30 testOptions.targetSdk = libs.versions.targetSdk.get().toInt() 31 lint.targetSdk = libs.versions.targetSdk.get().toInt() 32 33 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 34 } 35 36 flavorDimensions += "flavor" 37 productFlavors { 38 create("stable") { 39 dimension = "flavor" 40 isDefault = true 41 } 42 } 43 44 compileOptions { 45 sourceCompatibility = JavaVersion.VERSION_17 46 targetCompatibility = JavaVersion.VERSION_17 47 } 48 kotlin { 49 jvmToolchain(17) 50 } 51 buildFeatures { 52 buildConfig = true 53 compose = true 54 } 55 composeOptions { 56 kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() 57 } 58 59 @Suppress("UnstableApiUsage") 60 testOptions { 61 unitTests { 62 isReturnDefaultValues = true 63 isIncludeAndroidResources = true 64 } 65 managedDevices { 66 localDevices { 67 create("pixel2Api28") { 68 device = "Pixel 2" 69 apiLevel = 28 70 } 71 create("pixel8Api34") { 72 device = "Pixel 8" 73 apiLevel = 34 74 systemImageSource = "aosp_atd" 75 } 76 } 77 } 78 } 79 80 kotlinOptions { 81 freeCompilerArgs += "-Xcontext-receivers" 82 } 83 } 84 <lambda>null85dependencies { 86 // Reflect 87 implementation(libs.kotlin.reflect) 88 // Compose 89 val composeBom = platform(libs.compose.bom) 90 implementation(composeBom) 91 androidTestImplementation(composeBom) 92 93 // Compose - Material Design 3 94 implementation(libs.compose.material3) 95 implementation(libs.compose.material.icons.extended) 96 97 // Compose - Android Studio Preview support 98 implementation(libs.compose.ui.tooling.preview) 99 debugImplementation(libs.compose.ui.tooling) 100 101 // Compose - Integration with ViewModels with Navigation and Hilt 102 implementation(libs.hilt.navigation.compose) 103 104 // Compose - Lifecycle utilities 105 implementation(libs.androidx.lifecycle.viewmodel.compose) 106 implementation(libs.androidx.lifecycle.runtime.compose) 107 108 // Compose - Testing 109 androidTestImplementation(libs.compose.junit) 110 debugImplementation(libs.compose.test.manifest) 111 // noinspection TestManifestGradleConfiguration: required for release build unit tests 112 testImplementation(libs.compose.test.manifest) 113 testImplementation(libs.compose.junit) 114 115 // Testing 116 testImplementation(libs.junit) 117 testImplementation(libs.truth) 118 testImplementation(libs.mockito.core) 119 testImplementation(libs.kotlinx.coroutines.test) 120 testImplementation(libs.robolectric) 121 debugImplementation(libs.androidx.test.monitor) 122 implementation(libs.androidx.junit) 123 androidTestImplementation(libs.androidx.junit) 124 androidTestImplementation(libs.androidx.espresso.core) 125 126 // Futures 127 implementation(libs.futures.ktx) 128 129 // CameraX 130 implementation(libs.camera.core) 131 implementation(libs.camera.compose) 132 133 // Hilt 134 implementation(libs.dagger.hilt.android) 135 kapt(libs.dagger.hilt.compiler) 136 137 //Tracing 138 implementation(libs.androidx.tracing) 139 140 implementation(libs.kotlinx.atomicfu) 141 142 // Project dependencies 143 implementation(project(":data:settings")) 144 implementation(project(":core:camera")) 145 implementation(project(":core:common")) 146 testImplementation(project(":core:common")) 147 } 148 149 // Allow references to generated code 150 kapt { 151 correctErrorTypes = true 152 }