xref: /aosp_15_r20/external/jetpack-camera-app/app/build.gradle.kts (revision 7e7863dab8204bb545ead586e736dea632e06846)
1*7e7863daSAndroid Build Coastguard Worker /*
2*7e7863daSAndroid Build Coastguard Worker  * Copyright (C) 2023 The Android Open Source Project
3*7e7863daSAndroid Build Coastguard Worker  *
4*7e7863daSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*7e7863daSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*7e7863daSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*7e7863daSAndroid Build Coastguard Worker  *
8*7e7863daSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*7e7863daSAndroid Build Coastguard Worker  *
10*7e7863daSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*7e7863daSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*7e7863daSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*7e7863daSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*7e7863daSAndroid Build Coastguard Worker  * limitations under the License.
15*7e7863daSAndroid Build Coastguard Worker  */
16*7e7863daSAndroid Build Coastguard Worker 
<lambda>null17*7e7863daSAndroid Build Coastguard Worker plugins {
18*7e7863daSAndroid Build Coastguard Worker     alias(libs.plugins.android.application)
19*7e7863daSAndroid Build Coastguard Worker     alias(libs.plugins.kotlin.android)
20*7e7863daSAndroid Build Coastguard Worker     alias(libs.plugins.kotlin.kapt)
21*7e7863daSAndroid Build Coastguard Worker     alias(libs.plugins.dagger.hilt.android)
22*7e7863daSAndroid Build Coastguard Worker }
23*7e7863daSAndroid Build Coastguard Worker 
<lambda>null24*7e7863daSAndroid Build Coastguard Worker android {
25*7e7863daSAndroid Build Coastguard Worker     compileSdk = libs.versions.compileSdk.get().toInt()
26*7e7863daSAndroid Build Coastguard Worker     compileSdkPreview = libs.versions.compileSdkPreview.get()
27*7e7863daSAndroid Build Coastguard Worker 
28*7e7863daSAndroid Build Coastguard Worker     namespace = "com.google.jetpackcamera"
29*7e7863daSAndroid Build Coastguard Worker 
30*7e7863daSAndroid Build Coastguard Worker     defaultConfig {
31*7e7863daSAndroid Build Coastguard Worker         applicationId = "com.google.jetpackcamera"
32*7e7863daSAndroid Build Coastguard Worker         minSdk = libs.versions.minSdk.get().toInt()
33*7e7863daSAndroid Build Coastguard Worker         targetSdk = libs.versions.targetSdk.get().toInt()
34*7e7863daSAndroid Build Coastguard Worker         versionCode = 1
35*7e7863daSAndroid Build Coastguard Worker         versionName = "0.1.0"
36*7e7863daSAndroid Build Coastguard Worker         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
37*7e7863daSAndroid Build Coastguard Worker     }
38*7e7863daSAndroid Build Coastguard Worker 
39*7e7863daSAndroid Build Coastguard Worker     buildTypes {
40*7e7863daSAndroid Build Coastguard Worker         getByName("debug") {
41*7e7863daSAndroid Build Coastguard Worker             signingConfig = signingConfigs.getByName("debug")
42*7e7863daSAndroid Build Coastguard Worker         }
43*7e7863daSAndroid Build Coastguard Worker         getByName("release") {
44*7e7863daSAndroid Build Coastguard Worker             isMinifyEnabled = true
45*7e7863daSAndroid Build Coastguard Worker             proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
46*7e7863daSAndroid Build Coastguard Worker         }
47*7e7863daSAndroid Build Coastguard Worker         create("benchmark") {
48*7e7863daSAndroid Build Coastguard Worker             initWith(buildTypes.getByName("release"))
49*7e7863daSAndroid Build Coastguard Worker             signingConfig = signingConfigs.getByName("debug")
50*7e7863daSAndroid Build Coastguard Worker             matchingFallbacks += listOf("release")
51*7e7863daSAndroid Build Coastguard Worker         }
52*7e7863daSAndroid Build Coastguard Worker     }
53*7e7863daSAndroid Build Coastguard Worker 
54*7e7863daSAndroid Build Coastguard Worker     flavorDimensions += "flavor"
55*7e7863daSAndroid Build Coastguard Worker     productFlavors {
56*7e7863daSAndroid Build Coastguard Worker         create("stable") {
57*7e7863daSAndroid Build Coastguard Worker             dimension = "flavor"
58*7e7863daSAndroid Build Coastguard Worker             isDefault = true
59*7e7863daSAndroid Build Coastguard Worker         }
60*7e7863daSAndroid Build Coastguard Worker 
61*7e7863daSAndroid Build Coastguard Worker         create("preview") {
62*7e7863daSAndroid Build Coastguard Worker             dimension = "flavor"
63*7e7863daSAndroid Build Coastguard Worker             targetSdkPreview = libs.versions.targetSdkPreview.get()
64*7e7863daSAndroid Build Coastguard Worker         }
65*7e7863daSAndroid Build Coastguard Worker     }
66*7e7863daSAndroid Build Coastguard Worker 
67*7e7863daSAndroid Build Coastguard Worker     compileOptions {
68*7e7863daSAndroid Build Coastguard Worker         sourceCompatibility = JavaVersion.VERSION_17
69*7e7863daSAndroid Build Coastguard Worker         targetCompatibility = JavaVersion.VERSION_17
70*7e7863daSAndroid Build Coastguard Worker     }
71*7e7863daSAndroid Build Coastguard Worker     kotlin {
72*7e7863daSAndroid Build Coastguard Worker         jvmToolchain(17)
73*7e7863daSAndroid Build Coastguard Worker     }
74*7e7863daSAndroid Build Coastguard Worker     buildFeatures {
75*7e7863daSAndroid Build Coastguard Worker         buildConfig = true
76*7e7863daSAndroid Build Coastguard Worker         compose = true
77*7e7863daSAndroid Build Coastguard Worker     }
78*7e7863daSAndroid Build Coastguard Worker     composeOptions {
79*7e7863daSAndroid Build Coastguard Worker         kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
80*7e7863daSAndroid Build Coastguard Worker     }
81*7e7863daSAndroid Build Coastguard Worker     packaging {
82*7e7863daSAndroid Build Coastguard Worker         resources {
83*7e7863daSAndroid Build Coastguard Worker             excludes += "/META-INF/{AL2.0,LGPL2.1}"
84*7e7863daSAndroid Build Coastguard Worker         }
85*7e7863daSAndroid Build Coastguard Worker     }
86*7e7863daSAndroid Build Coastguard Worker     @Suppress("UnstableApiUsage")
87*7e7863daSAndroid Build Coastguard Worker     testOptions {
88*7e7863daSAndroid Build Coastguard Worker         managedDevices {
89*7e7863daSAndroid Build Coastguard Worker             localDevices {
90*7e7863daSAndroid Build Coastguard Worker                 create("pixel2Api28") {
91*7e7863daSAndroid Build Coastguard Worker                     device = "Pixel 2"
92*7e7863daSAndroid Build Coastguard Worker                     apiLevel = 28
93*7e7863daSAndroid Build Coastguard Worker                 }
94*7e7863daSAndroid Build Coastguard Worker                 create("pixel8Api34") {
95*7e7863daSAndroid Build Coastguard Worker                     device = "Pixel 8"
96*7e7863daSAndroid Build Coastguard Worker                     apiLevel = 34
97*7e7863daSAndroid Build Coastguard Worker                     systemImageSource = "aosp_atd"
98*7e7863daSAndroid Build Coastguard Worker                 }
99*7e7863daSAndroid Build Coastguard Worker             }
100*7e7863daSAndroid Build Coastguard Worker         }
101*7e7863daSAndroid Build Coastguard Worker     }
102*7e7863daSAndroid Build Coastguard Worker 
103*7e7863daSAndroid Build Coastguard Worker     kotlinOptions {
104*7e7863daSAndroid Build Coastguard Worker         freeCompilerArgs += "-Xcontext-receivers"
105*7e7863daSAndroid Build Coastguard Worker     }
106*7e7863daSAndroid Build Coastguard Worker }
107*7e7863daSAndroid Build Coastguard Worker 
<lambda>null108*7e7863daSAndroid Build Coastguard Worker dependencies {
109*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.tracing)
110*7e7863daSAndroid Build Coastguard Worker     implementation(project(":core:common"))
111*7e7863daSAndroid Build Coastguard Worker     // Compose
112*7e7863daSAndroid Build Coastguard Worker     val composeBom = platform(libs.compose.bom)
113*7e7863daSAndroid Build Coastguard Worker     implementation(composeBom)
114*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(composeBom)
115*7e7863daSAndroid Build Coastguard Worker 
116*7e7863daSAndroid Build Coastguard Worker     // Compose - Material Design 3
117*7e7863daSAndroid Build Coastguard Worker     implementation(libs.compose.material3)
118*7e7863daSAndroid Build Coastguard Worker     implementation(libs.compose.material.icons.extended)
119*7e7863daSAndroid Build Coastguard Worker 
120*7e7863daSAndroid Build Coastguard Worker     // Compose - Android Studio Preview support
121*7e7863daSAndroid Build Coastguard Worker     implementation(libs.compose.ui.tooling.preview)
122*7e7863daSAndroid Build Coastguard Worker     debugImplementation(libs.compose.ui.tooling)
123*7e7863daSAndroid Build Coastguard Worker 
124*7e7863daSAndroid Build Coastguard Worker     // Compose - Integration with ViewModels
125*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.lifecycle.viewmodel.compose)
126*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.lifecycle.runtime.compose)
127*7e7863daSAndroid Build Coastguard Worker 
128*7e7863daSAndroid Build Coastguard Worker     // Compose - Integration with Activities
129*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.activity.compose)
130*7e7863daSAndroid Build Coastguard Worker 
131*7e7863daSAndroid Build Coastguard Worker     // Compose - Testing
132*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.compose.junit)
133*7e7863daSAndroid Build Coastguard Worker 
134*7e7863daSAndroid Build Coastguard Worker     // Testing
135*7e7863daSAndroid Build Coastguard Worker     testImplementation(libs.junit)
136*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.androidx.junit)
137*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.androidx.espresso.core)
138*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.androidx.rules)
139*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.androidx.uiautomator)
140*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.truth)
141*7e7863daSAndroid Build Coastguard Worker 
142*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.core.ktx)
143*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.lifecycle.runtime.compose)
144*7e7863daSAndroid Build Coastguard Worker 
145*7e7863daSAndroid Build Coastguard Worker     // Hilt
146*7e7863daSAndroid Build Coastguard Worker     implementation(libs.dagger.hilt.android)
147*7e7863daSAndroid Build Coastguard Worker     kapt(libs.dagger.hilt.compiler)
148*7e7863daSAndroid Build Coastguard Worker 
149*7e7863daSAndroid Build Coastguard Worker     // Accompanist - Permissions
150*7e7863daSAndroid Build Coastguard Worker     implementation(libs.accompanist.permissions)
151*7e7863daSAndroid Build Coastguard Worker 
152*7e7863daSAndroid Build Coastguard Worker     // Jetpack Navigation
153*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.navigation.compose)
154*7e7863daSAndroid Build Coastguard Worker 
155*7e7863daSAndroid Build Coastguard Worker     // Access Settings data
156*7e7863daSAndroid Build Coastguard Worker     implementation(project(":data:settings"))
157*7e7863daSAndroid Build Coastguard Worker 
158*7e7863daSAndroid Build Coastguard Worker     // Camera Preview
159*7e7863daSAndroid Build Coastguard Worker     implementation(project(":feature:preview"))
160*7e7863daSAndroid Build Coastguard Worker 
161*7e7863daSAndroid Build Coastguard Worker     // Settings Screen
162*7e7863daSAndroid Build Coastguard Worker     implementation(project(":feature:settings"))
163*7e7863daSAndroid Build Coastguard Worker 
164*7e7863daSAndroid Build Coastguard Worker     // Permissions Screen
165*7e7863daSAndroid Build Coastguard Worker     implementation(project(":feature:permissions"))
166*7e7863daSAndroid Build Coastguard Worker 
167*7e7863daSAndroid Build Coastguard Worker     // benchmark
168*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.profileinstaller)
169*7e7863daSAndroid Build Coastguard Worker 
170*7e7863daSAndroid Build Coastguard Worker }
171*7e7863daSAndroid Build Coastguard Worker 
172*7e7863daSAndroid Build Coastguard Worker // Allow references to generated code
173*7e7863daSAndroid Build Coastguard Worker kapt {
174*7e7863daSAndroid Build Coastguard Worker     correctErrorTypes = true
175*7e7863daSAndroid Build Coastguard Worker }