xref: /aosp_15_r20/external/jetpack-camera-app/data/settings/build.gradle.kts (revision 7e7863dab8204bb545ead586e736dea632e06846)
1*7e7863daSAndroid Build Coastguard Worker /*
<lambda>null2*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 
17*7e7863daSAndroid Build Coastguard Worker plugins {
18*7e7863daSAndroid Build Coastguard Worker     alias(libs.plugins.android.library)
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     alias(libs.plugins.google.protobuf)
23*7e7863daSAndroid Build Coastguard Worker }
24*7e7863daSAndroid Build Coastguard Worker 
<lambda>null25*7e7863daSAndroid Build Coastguard Worker android {
26*7e7863daSAndroid Build Coastguard Worker     namespace = "com.google.jetpackcamera.data.settings"
27*7e7863daSAndroid Build Coastguard Worker     compileSdk = libs.versions.compileSdk.get().toInt()
28*7e7863daSAndroid Build Coastguard Worker     compileSdkPreview = libs.versions.compileSdkPreview.get()
29*7e7863daSAndroid Build Coastguard Worker 
30*7e7863daSAndroid Build Coastguard Worker     defaultConfig {
31*7e7863daSAndroid Build Coastguard Worker         minSdk = libs.versions.minSdk.get().toInt()
32*7e7863daSAndroid Build Coastguard Worker         testOptions.targetSdk = libs.versions.targetSdk.get().toInt()
33*7e7863daSAndroid Build Coastguard Worker         lint.targetSdk = libs.versions.targetSdk.get().toInt()
34*7e7863daSAndroid Build Coastguard Worker 
35*7e7863daSAndroid Build Coastguard Worker         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
36*7e7863daSAndroid Build Coastguard Worker         consumerProguardFiles("consumer-rules.pro")
37*7e7863daSAndroid Build Coastguard Worker     }
38*7e7863daSAndroid Build Coastguard Worker 
39*7e7863daSAndroid Build Coastguard Worker     flavorDimensions += "flavor"
40*7e7863daSAndroid Build Coastguard Worker     productFlavors {
41*7e7863daSAndroid Build Coastguard Worker         create("stable") {
42*7e7863daSAndroid Build Coastguard Worker             dimension = "flavor"
43*7e7863daSAndroid Build Coastguard Worker             isDefault = true
44*7e7863daSAndroid Build Coastguard Worker         }
45*7e7863daSAndroid Build Coastguard Worker 
46*7e7863daSAndroid Build Coastguard Worker         create("preview") {
47*7e7863daSAndroid Build Coastguard Worker             dimension = "flavor"
48*7e7863daSAndroid Build Coastguard Worker             targetSdkPreview = libs.versions.targetSdkPreview.get()
49*7e7863daSAndroid Build Coastguard Worker         }
50*7e7863daSAndroid Build Coastguard Worker     }
51*7e7863daSAndroid Build Coastguard Worker 
52*7e7863daSAndroid Build Coastguard Worker     compileOptions {
53*7e7863daSAndroid Build Coastguard Worker         sourceCompatibility = JavaVersion.VERSION_17
54*7e7863daSAndroid Build Coastguard Worker         targetCompatibility = JavaVersion.VERSION_17
55*7e7863daSAndroid Build Coastguard Worker     }
56*7e7863daSAndroid Build Coastguard Worker     kotlin {
57*7e7863daSAndroid Build Coastguard Worker         jvmToolchain(17)
58*7e7863daSAndroid Build Coastguard Worker     }
59*7e7863daSAndroid Build Coastguard Worker 
60*7e7863daSAndroid Build Coastguard Worker     @Suppress("UnstableApiUsage")
61*7e7863daSAndroid Build Coastguard Worker     testOptions {
62*7e7863daSAndroid Build Coastguard Worker         managedDevices {
63*7e7863daSAndroid Build Coastguard Worker             localDevices {
64*7e7863daSAndroid Build Coastguard Worker                 create("pixel2Api28") {
65*7e7863daSAndroid Build Coastguard Worker                     device = "Pixel 2"
66*7e7863daSAndroid Build Coastguard Worker                     apiLevel = 28
67*7e7863daSAndroid Build Coastguard Worker                 }
68*7e7863daSAndroid Build Coastguard Worker                 create("pixel8Api34") {
69*7e7863daSAndroid Build Coastguard Worker                     device = "Pixel 8"
70*7e7863daSAndroid Build Coastguard Worker                     apiLevel = 34
71*7e7863daSAndroid Build Coastguard Worker                     systemImageSource = "aosp_atd"
72*7e7863daSAndroid Build Coastguard Worker                 }
73*7e7863daSAndroid Build Coastguard Worker             }
74*7e7863daSAndroid Build Coastguard Worker         }
75*7e7863daSAndroid Build Coastguard Worker     }
76*7e7863daSAndroid Build Coastguard Worker }
77*7e7863daSAndroid Build Coastguard Worker 
<lambda>null78*7e7863daSAndroid Build Coastguard Worker dependencies {
79*7e7863daSAndroid Build Coastguard Worker     implementation(libs.kotlinx.coroutines.core)
80*7e7863daSAndroid Build Coastguard Worker 
81*7e7863daSAndroid Build Coastguard Worker     // Hilt
82*7e7863daSAndroid Build Coastguard Worker     implementation(libs.dagger.hilt.android)
83*7e7863daSAndroid Build Coastguard Worker     kapt(libs.dagger.hilt.compiler)
84*7e7863daSAndroid Build Coastguard Worker 
85*7e7863daSAndroid Build Coastguard Worker     // proto datastore
86*7e7863daSAndroid Build Coastguard Worker     implementation(libs.androidx.datastore)
87*7e7863daSAndroid Build Coastguard Worker     implementation(libs.protobuf.kotlin.lite)
88*7e7863daSAndroid Build Coastguard Worker 
89*7e7863daSAndroid Build Coastguard Worker     // Testing
90*7e7863daSAndroid Build Coastguard Worker     testImplementation(libs.junit)
91*7e7863daSAndroid Build Coastguard Worker     testImplementation(libs.truth)
92*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.androidx.espresso.core)
93*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.androidx.junit)
94*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.truth)
95*7e7863daSAndroid Build Coastguard Worker     androidTestImplementation(libs.kotlinx.coroutines.test)
96*7e7863daSAndroid Build Coastguard Worker }
97*7e7863daSAndroid Build Coastguard Worker 
<lambda>null98*7e7863daSAndroid Build Coastguard Worker protobuf {
99*7e7863daSAndroid Build Coastguard Worker     protoc {
100*7e7863daSAndroid Build Coastguard Worker         artifact = "com.google.protobuf:protoc:3.21.12"
101*7e7863daSAndroid Build Coastguard Worker     }
102*7e7863daSAndroid Build Coastguard Worker 
103*7e7863daSAndroid Build Coastguard Worker     generateProtoTasks {
104*7e7863daSAndroid Build Coastguard Worker         all().forEach {task ->
105*7e7863daSAndroid Build Coastguard Worker             task.builtins {
106*7e7863daSAndroid Build Coastguard Worker                 create("java") {
107*7e7863daSAndroid Build Coastguard Worker                     option("lite")
108*7e7863daSAndroid Build Coastguard Worker                 }
109*7e7863daSAndroid Build Coastguard Worker             }
110*7e7863daSAndroid Build Coastguard Worker 
111*7e7863daSAndroid Build Coastguard Worker             task.builtins {
112*7e7863daSAndroid Build Coastguard Worker                 create("kotlin") {
113*7e7863daSAndroid Build Coastguard Worker                     option("lite")
114*7e7863daSAndroid Build Coastguard Worker                 }
115*7e7863daSAndroid Build Coastguard Worker             }
116*7e7863daSAndroid Build Coastguard Worker         }
117*7e7863daSAndroid Build Coastguard Worker     }
118*7e7863daSAndroid Build Coastguard Worker }
119*7e7863daSAndroid Build Coastguard Worker 
120*7e7863daSAndroid Build Coastguard Worker // Allow references to generated code
<lambda>null121*7e7863daSAndroid Build Coastguard Worker kapt {
122*7e7863daSAndroid Build Coastguard Worker     correctErrorTypes = true
123*7e7863daSAndroid Build Coastguard Worker }
124