blob: 99d4ebe2d60caeee229e7ee637cd792e8b565de2 [file] [edit]
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id 'com.android.application'
id 'aaosApps.buildLogic'
}
android {
namespace "com.android.car.media"
defaultConfig {
applicationId "com.android.car.media"
minSdkVersion 30 // Media requires apis that became public in R.
targetSdkVersion 34
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true', coverage: 'true'
}
lintOptions {
abortOnError false
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
androidTest{
java.srcDirs += 'tests/instrumenttests/src'
}
test {
java.srcDirs += 'tests/unittests/src'
}
}
signingConfigs {
platformGoogle {
storeFile file(gradle.ext.platformGoogleCertPath)
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
platformAosp {
storeFile file(gradle.ext.platformAospCertPath)
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
flavorDimensions "signingkey"
productFlavors {
if (file(gradle.ext.platformGoogleCertPath).exists()) {
platformGoogle {
isDefault true
dimension "signingkey"
signingConfig signingConfigs.platformGoogle
}
}
platformAosp {
dimension "signingkey"
signingConfig signingConfigs.platformAosp
}
}
buildTypes {
release {
minifyEnabled false
}
debug {
testCoverageEnabled = true
signingConfig android.buildTypes.release.signingConfig
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
animationsDisabled = true
}
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
}
dependencies {
implementation libs.androidx.preference
implementation libs.androidx.constraintlayout
implementation libs.androidx.lifecycle.common.java8
implementation libs.androidx.media
implementation libs.androidx.car.app
implementation files(gradle.ext.lib_car_system_stubs)
api project(':oem-token-lib')
implementation project(":car-ui-lib")
implementation project(":car-apps-common")
implementation project(":car-media-common")
implementation project(":car-media-extensions")
implementation project(":car-uxr-client-lib")
implementation libs.androidx.lifecycle.service
//Test libs
testImplementation libs.hamcrest.library
testImplementation libs.androidx.espresso.core
testImplementation libs.androidx.espresso.contrib
testImplementation libs.google.truth
testImplementation libs.androidx.junit
testImplementation libs.junit
testImplementation libs.robolectric
testImplementation libs.mockito.core
testImplementation libs.androidx.test.runner
testImplementation libs.androidx.test.rules
// This is needed to be able to spy certain classes with Mockito
// It's major/minor version must match Mockito's.
androidTestImplementation libs.dexmaker.mockito.inline
// Required for instrumented tests
testImplementation libs.androidx.annotation
androidTestUtil libs.androidx.orchestrator
}
android.aaptOptions.additionalParameters "-I", "${projectDir}/../libs/car-ui-lib/oem-tokens/shared-lib/prebuilt/token-shared-lib.apk"
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}