1/* 2 * Copyright (C) 2024 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 'kotlin-android' 20 id "com.google.protobuf" 21} 22 23android { 24 namespace 'com.android.car.carlaunchercommon' 25 compileSdk gradle.ext.aaosTargetSDK 26 27 defaultConfig { 28 minSdk gradle.ext.aaosLatestSDK 29 targetSdk gradle.ext.aaosLatestSDK 30 versionCode gradle.ext.getVersionCode() 31 versionName gradle.ext.getVersionName() 32 33 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 34 } 35 36 kotlinOptions { 37 jvmTarget = '1.8' 38 } 39 40 sourceSets { 41 main { 42 manifest.srcFile 'AndroidManifest.xml' 43 res.srcDirs = ['res'] 44 java.srcDirs = ['src'] 45 } 46 47 androidTest { 48 java.srcDirs += 'tests/src' 49 } 50 } 51 52 testOptions { 53 unitTests { 54 includeAndroidResources = true 55 returnDefaultValues = true 56 } 57 } 58 59 compileOptions { 60 sourceCompatibility JavaVersion.VERSION_1_8 61 targetCompatibility JavaVersion.VERSION_1_8 62 } 63 64 lintOptions { 65 disable 'PrivateResource' 66 } 67} 68 69dependencies { 70 compileOnly files(gradle.ext.lib_car_system_stubs) 71 compileOnly files(gradle.ext.lib_system_stubs) 72 // Verify that the code should fail on runtime with hidden api access 73 compileOnly project(":libs:hidden-apis-compat:hidden-apis-disabled") 74 implementation project(":libs:car-ui-lib") 75 implementation 'androidx.annotation:annotation:1.7.1' 76 implementation('com.google.protobuf:protobuf-javalite:3.25.1') 77 78 //Android Test dependencies 79 androidTestCompileOnly files(gradle.ext.lib_system_stubs) 80 androidTestImplementation files(gradle.ext.lib_car_system_stubs) 81 androidTestImplementation project(":libs:hidden-apis-compat:hidden-apis-disabled") 82 androidTestImplementation 'junit:junit:4.13.2' 83 androidTestImplementation "org.mockito:mockito-android:5.10.0" 84 androidTestImplementation "org.mockito:mockito-core:5.10.0" 85 androidTestImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0" 86 androidTestImplementation "androidx.test:rules:1.5.0" 87 androidTestImplementation 'androidx.test:runner:1.5.2' 88 androidTestImplementation 'androidx.test.ext:junit:1.1.5' 89 androidTestImplementation "com.google.truth:truth:1.3.0" 90} 91 92protobuf { 93 protoc { 94 artifact = "com.google.protobuf:protoc:3.25.1" 95 } 96 97 // Generates the java Protobuf-lite code for the Protobufs in this project. See 98 // https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation 99 // for more information. 100 generateProtoTasks { 101 all().each { task -> 102 task.builtins { 103 java { 104 option 'lite' 105 } 106 } 107 } 108 } 109} 110 111java { 112 sourceCompatibility = JavaVersion.VERSION_1_8 113 targetCompatibility = JavaVersion.VERSION_1_8 114} 115