• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>null17 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 }
23 
<lambda>null24 android {
25     namespace = "com.google.jetpackcamera.core.camera"
26     compileSdk = libs.versions.compileSdk.get().toInt()
27 
28     defaultConfig {
29         minSdk = libs.versions.minSdk.get().toInt()
30         testOptions.targetSdk = libs.versions.targetSdk.get().toInt()
31         lint.targetSdk = libs.versions.targetSdk.get().toInt()
32 
33         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
34 
35         @Suppress("UnstableApiUsage")
36         externalNativeBuild {
37             val versionScript = file("src/main/cpp/jni.lds").absolutePath
38             cmake {
39                 cppFlags += listOf(
40                     "-std=c++17",
41                     "-O3",
42                     "-flto",
43                     "-fPIC",
44                     "-fno-exceptions",
45                     "-fno-rtti",
46                     "-fomit-frame-pointer",
47                     "-fdata-sections",
48                     "-ffunction-sections"
49                 )
50                 arguments += listOf(
51                     "-DCMAKE_VERBOSE_MAKEFILE=ON",
52                     "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--gc-sections " +
53                         "-Wl,--version-script=${versionScript}"
54                 )
55             }
56         }
57     }
58 
59     externalNativeBuild {
60         cmake {
61             version = libs.versions.cmake.get()
62             path = file("src/main/cpp/CMakeLists.txt")
63         }
64     }
65 
66     flavorDimensions += "flavor"
67     productFlavors {
68         create("stable") {
69             dimension = "flavor"
70             isDefault = true
71         }
72     }
73 
74     @Suppress("UnstableApiUsage")
75     testOptions {
76         managedDevices {
77             localDevices {
78                 create("pixel2Api28") {
79                     device = "Pixel 2"
80                     apiLevel = 28
81                 }
82                 create("pixel8Api34") {
83                     device = "Pixel 8"
84                     apiLevel = 34
85                     systemImageSource = "aosp_atd"
86                 }
87             }
88         }
89     }
90 
91     compileOptions {
92         sourceCompatibility = JavaVersion.VERSION_17
93         targetCompatibility = JavaVersion.VERSION_17
94     }
95     kotlin {
96         jvmToolchain(17)
97     }
98 
99     kotlinOptions {
100         freeCompilerArgs += "-Xcontext-receivers"
101     }
102 }
103 
<lambda>null104 dependencies {
105     // Testing
106     testImplementation(libs.junit)
107     testImplementation(libs.truth)
108     testImplementation(libs.kotlinx.coroutines.test)
109     testImplementation(libs.mockito.core)
110     androidTestImplementation(libs.androidx.junit)
111     androidTestImplementation(libs.androidx.espresso.core)
112     androidTestImplementation(libs.androidx.rules)
113     androidTestImplementation(libs.kotlinx.coroutines.test)
114     androidTestImplementation(libs.truth)
115 
116     // Futures
117     implementation(libs.futures.ktx)
118 
119     // LiveData
120     implementation(libs.androidx.lifecycle.livedata)
121 
122     // CameraX
123     implementation(libs.camera.core)
124     implementation(libs.camera.camera2)
125     implementation(libs.camera.lifecycle)
126     implementation(libs.camera.video)
127 
128     // Hilt
129     implementation(libs.dagger.hilt.android)
130     kapt(libs.dagger.hilt.compiler)
131 
132     // Tracing
133     implementation(libs.androidx.tracing)
134     implementation(libs.kotlinx.atomicfu)
135 
136     // Graphics libraries
137     implementation(libs.androidx.graphics.core)
138 
139     // Project dependencies
140     implementation(project(":data:settings"))
141     implementation(project(":core:common"))
142 }
143 
144 // Allow references to generated code
<lambda>null145 kapt {
146     correctErrorTypes = true
147 }
148