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