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// Top-level build file where you can add configuration options common to all sub-projects/modules. 17buildscript { 18 19 gradle.ext.aaosLatestSDK = 34 20 gradle.ext.aaosTargetSDK = 34 21 22 gradle.ext.repoRootPath = rootDir.parentFile.parentFile.parentFile.parent 23 gradle.ext.prebuiltSdkPath = gradle.ext.repoRootPath + "/prebuilts/sdk/" 24 gradle.ext.lib_car_system_stubs = gradle.ext.prebuiltSdkPath + gradle.ext.aaosLatestSDK + "/system/android.car-system-stubs.jar" 25 gradle.ext.lib_car_apps_common_aar = gradle.ext.prebuiltSdkPath + "current/aaos-libs/car-apps-common.aar" 26 gradle.ext.lib_car_media_common_aar = gradle.ext.prebuiltSdkPath + "current/aaos-libs/car-media-common.aar" 27 gradle.ext.lib_car_ui_lib_aar = gradle.ext.prebuiltSdkPath + "current/aaos-libs/car-ui-lib.aar" 28 gradle.ext.lib_car_ui_lib_oem_apis = gradle.ext.prebuiltSdkPath + "current/aaos-libs/car-ui-lib-oem-apis.jar" 29 gradle.ext.lib_system_stubs = gradle.ext.prebuiltSdkPath + gradle.ext.aaosLatestSDK + "/system/android.jar" 30 gradle.ext.lib_car_test_api = gradle.ext.prebuiltSdkPath + gradle.ext.aaosLatestSDK + "/system/android.car.testapi.jar" 31 gradle.ext.debugCertPath = gradle.ext.repoRootPath + "/packages/apps/Car/Launcher/libs/appgrid/keys/com_android_car_launcher_test.jks" 32 gradle.ext.soongBash = gradle.ext.repoRootPath + "/build/soong/soong_ui.bash" 33 gradle.ext.platformSdkVersion = "35" // Change this to the most recent android API level. 34 35 if (file(gradle.ext.soongBash).exists()) { 36 def soongPlatformSdkVersion = (gradle.ext.soongBash + " --dumpvar-mode PLATFORM_SDK_VERSION").execute().text.trim() 37 if (!soongPlatformSdkVersion.isEmpty()) { 38 gradle.ext.platformSdkVersion = soongPlatformSdkVersion 39 } 40 } 41 42 gradle.ext.getVersionCode = { -> 43 def code = project.hasProperty('versionCode') ? versionCode.toInteger() : gradle.ext.platformSdkVersion.toInteger() 44 println "VersionCode is set to $code" 45 return code 46 } 47 gradle.ext.getVersionName = { -> 48 def name = project.hasProperty('versionName') ? versionName : gradle.ext.platformSdkVersion 49 println "VersionName is set to $name" 50 return name 51 } 52} 53 54plugins { 55 // TODO b/324426571: The version for com.android.application and com.android.library is 8.1.2 56 id 'com.android.application' apply false 57 id 'com.android.library' apply false 58 id 'org.jetbrains.kotlin.android' version '1.8.21' apply false 59 id 'com.google.protobuf' version '0.9.1' apply false 60} 61 62allprojects { 63 tasks.withType(JavaCompile).tap { 64 configureEach { 65 // Compile with prebuilt android.jar. 66 options.compilerArgs.add('-Xbootclasspath/p:/' + gradle.ext.lib_system_stubs) 67 // TODO: just pass -Xlint, to enable all the supported types of warnings. 68 options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" 69 } 70 } 71 ext.ANDROID_TOP = gradle.ext.repoRootPath 72} 73