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.application) 19 alias(libs.plugins.kotlin.android) 20 alias(libs.plugins.kotlin.kapt) 21 alias(libs.plugins.dagger.hilt.android) 22 } 23 <lambda>null24android { 25 compileSdk = libs.versions.compileSdk.get().toInt() 26 compileSdkPreview = libs.versions.compileSdkPreview.get() 27 28 namespace = "com.google.jetpackcamera" 29 30 defaultConfig { 31 applicationId = "com.google.jetpackcamera" 32 minSdk = libs.versions.minSdk.get().toInt() 33 targetSdk = libs.versions.targetSdk.get().toInt() 34 versionCode = 1 35 versionName = "0.1.0" 36 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 37 } 38 39 buildTypes { 40 getByName("debug") { 41 signingConfig = signingConfigs.getByName("debug") 42 } 43 getByName("release") { 44 isMinifyEnabled = true 45 proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) 46 } 47 create("benchmark") { 48 initWith(buildTypes.getByName("release")) 49 signingConfig = signingConfigs.getByName("debug") 50 matchingFallbacks += listOf("release") 51 } 52 } 53 54 flavorDimensions += "flavor" 55 productFlavors { 56 create("stable") { 57 dimension = "flavor" 58 isDefault = true 59 } 60 61 create("preview") { 62 dimension = "flavor" 63 targetSdkPreview = libs.versions.targetSdkPreview.get() 64 } 65 } 66 67 compileOptions { 68 sourceCompatibility = JavaVersion.VERSION_17 69 targetCompatibility = JavaVersion.VERSION_17 70 } 71 kotlin { 72 jvmToolchain(17) 73 } 74 buildFeatures { 75 buildConfig = true 76 compose = true 77 } 78 composeOptions { 79 kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() 80 } 81 packaging { 82 resources { 83 excludes += "/META-INF/{AL2.0,LGPL2.1}" 84 } 85 } 86 @Suppress("UnstableApiUsage") 87 testOptions { 88 managedDevices { 89 localDevices { 90 create("pixel2Api28") { 91 device = "Pixel 2" 92 apiLevel = 28 93 } 94 create("pixel8Api34") { 95 device = "Pixel 8" 96 apiLevel = 34 97 systemImageSource = "aosp_atd" 98 } 99 } 100 } 101 } 102 103 kotlinOptions { 104 freeCompilerArgs += "-Xcontext-receivers" 105 } 106 } 107 <lambda>null108dependencies { 109 implementation(libs.androidx.tracing) 110 implementation(project(":core:common")) 111 // Compose 112 val composeBom = platform(libs.compose.bom) 113 implementation(composeBom) 114 androidTestImplementation(composeBom) 115 116 // Compose - Material Design 3 117 implementation(libs.compose.material3) 118 implementation(libs.compose.material.icons.extended) 119 120 // Compose - Android Studio Preview support 121 implementation(libs.compose.ui.tooling.preview) 122 debugImplementation(libs.compose.ui.tooling) 123 124 // Compose - Integration with ViewModels 125 implementation(libs.androidx.lifecycle.viewmodel.compose) 126 implementation(libs.androidx.lifecycle.runtime.compose) 127 128 // Compose - Integration with Activities 129 implementation(libs.androidx.activity.compose) 130 131 // Compose - Testing 132 androidTestImplementation(libs.compose.junit) 133 134 // Testing 135 testImplementation(libs.junit) 136 androidTestImplementation(libs.androidx.junit) 137 androidTestImplementation(libs.androidx.espresso.core) 138 androidTestImplementation(libs.androidx.rules) 139 androidTestImplementation(libs.androidx.uiautomator) 140 androidTestImplementation(libs.truth) 141 142 implementation(libs.androidx.core.ktx) 143 implementation(libs.androidx.lifecycle.runtime.compose) 144 145 // Hilt 146 implementation(libs.dagger.hilt.android) 147 kapt(libs.dagger.hilt.compiler) 148 149 // Accompanist - Permissions 150 implementation(libs.accompanist.permissions) 151 152 // Jetpack Navigation 153 implementation(libs.androidx.navigation.compose) 154 155 // Access Settings data 156 implementation(project(":data:settings")) 157 158 // Camera Preview 159 implementation(project(":feature:preview")) 160 161 // Settings Screen 162 implementation(project(":feature:settings")) 163 164 // Permissions Screen 165 implementation(project(":feature:permissions")) 166 167 // benchmark 168 implementation(libs.androidx.profileinstaller) 169 170 } 171 172 // Allow references to generated code 173 kapt { 174 correctErrorTypes = true 175 }