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