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
17plugins {
18    id 'com.android.library'
19    id "com.google.protobuf"
20    id 'kotlin-android'
21    id 'aconfig'
22}
23
24aconfig {
25    aconfigDeclaration {
26        packageName.set("com.android.car.carlauncher")
27        srcFile.setFrom(files("../../../app/car_launcher_flags.aconfig"))
28    }
29}
30
31android {
32    namespace 'com.android.car.carlauncher'
33    compileSdk gradle.ext.aaosTargetSDK
34
35    defaultConfig {
36        minSdk gradle.ext.aaosLatestSDK
37        targetSdk gradle.ext.aaosLatestSDK
38        versionCode gradle.ext.getVersionCode()
39        versionName gradle.ext.getVersionName()
40
41        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
42    }
43
44    sourceSets {
45        main {
46            manifest.srcFile 'AndroidManifest.xml'
47            res.srcDirs = ['res']
48            java.srcDirs = ['src']
49            java {
50                srcDirs += 'build/generated/source/proto/java'
51            }
52            kotlin {
53                srcDirs += 'build/generated/source/proto/kotlin'
54            }
55            proto {
56                srcDir 'src/com/android/car/carlauncher/proto' // default value
57            }
58        }
59
60        test {
61            java.srcDirs = ['robotests/src']
62            res.srcDirs   = ['robotests/res']
63        }
64
65    }
66
67    testOptions {
68        unitTests {
69            includeAndroidResources = true
70            returnDefaultValues = true
71        }
72    }
73
74    compileOptions {
75        sourceCompatibility JavaVersion.VERSION_1_8
76        targetCompatibility JavaVersion.VERSION_1_8
77    }
78
79    kotlinOptions {
80        jvmTarget = '1.8'
81    }
82
83    lintOptions {
84        disable 'PrivateResource'
85    }
86}
87
88dependencies {
89    compileOnly files(gradle.ext.lib_car_system_stubs)
90    compileOnly files(gradle.ext.lib_car_ui_lib_oem_apis)
91    implementation project(":libs:hidden-apis-compat:hidden-apis-disabled")
92    implementation project(":libs:car-launcher-common")
93    implementation project(":libs:car-apps-common")
94    implementation project(":libs:car-media-common")
95    implementation project(":libs:car-ui-lib")
96    implementation project(":docklib-util")
97    implementation 'androidx.core:core-ktx:1.12.0'
98    api 'androidx.annotation:annotation:1.7.1'
99    implementation 'androidx.appcompat:appcompat:1.6.1'
100    implementation 'com.google.android.material:material:1.11.0'
101    implementation 'com.google.guava:guava:31.0.1-jre'
102    implementation  "androidx.datastore:datastore:1.0.0"
103    implementation 'androidx.preference:preference-ktx:1.2.1'
104    implementation 'androidx.recyclerview:recyclerview:1.3.2'
105    implementation('com.google.protobuf:protobuf-javalite:3.25.1')
106    implementation 'androidx.media:media:1.7.0'
107    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0'
108    implementation fileTree(dir: 'libs', include: ['*.jar'])
109
110    //Test dependencies
111    testImplementation files(gradle.ext.lib_car_system_stubs)
112    testImplementation files(gradle.ext.lib_car_test_api)
113    testImplementation 'junit:junit:4.13.2'
114    testImplementation 'androidx.test:core-ktx:1.5.0'
115
116    testImplementation 'org.robolectric:robolectric:4.11.1'
117
118    testImplementation "org.mockito:mockito-core:5.8.0"
119    testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
120
121    testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3"
122
123}
124
125protobuf {
126    protoc {
127        artifact = "com.google.protobuf:protoc:3.25.1"
128    }
129
130    // Generates the java Protobuf-lite code for the Protobufs in this project. See
131    // https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
132    // for more information.
133    generateProtoTasks {
134        all().each { task ->
135            task.builtins {
136                java {
137                    option 'lite'
138                }
139            }
140        }
141    }
142}
143
144java {
145    sourceCompatibility = JavaVersion.VERSION_1_8
146    targetCompatibility = JavaVersion.VERSION_1_8
147}
148