| /* |
| * 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. |
| */ |
| |
| apply plugin: 'com.android.application' |
| |
| android { |
| compileSdkVersion gradle.ext.aaosLatestSDK |
| |
| defaultConfig { |
| applicationId "com.android.car.media" |
| minSdkVersion 30 // Media requires apis that became public in R. |
| targetSdkVersion gradle.ext.aaosTargetSDK |
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| testInstrumentationRunnerArguments clearPackageData: 'true', coverage: 'true' |
| versionCode gradle.ext.getVersionCode() |
| versionName gradle.ext.getVersionName() |
| } |
| |
| compileOptions { |
| sourceCompatibility JavaVersion.VERSION_1_8 |
| targetCompatibility JavaVersion.VERSION_1_8 |
| } |
| |
| lintOptions { |
| abortOnError false |
| } |
| |
| sourceSets { |
| main { |
| manifest.srcFile 'AndroidManifest.xml' |
| java.srcDirs = ['src'] |
| aidl.srcDirs = ['src'] |
| renderscript.srcDirs = ['src'] |
| res.srcDirs = ['res'] |
| } |
| |
| androidTest{ |
| java.srcDirs += 'tests/instrumenttests/src' |
| } |
| |
| test { |
| java.srcDirs += 'tests/unittests/src' |
| } |
| } |
| |
| signingConfigs { |
| aaos { |
| storeFile file(gradle.ext.aaosCertPath) |
| storePassword 'carapps' |
| keyAlias 'carapps' |
| keyPassword 'carapps' |
| } |
| |
| platform { |
| storeFile file(gradle.ext.platformCertPath) |
| storePassword 'android' |
| keyAlias 'androiddebugkey' |
| keyPassword 'android' |
| } |
| } |
| |
| flavorDimensions "signingkey" |
| productFlavors { |
| aaos { |
| dimension "signingkey" |
| signingConfig signingConfigs.aaos |
| } |
| platform { |
| isDefault true |
| dimension "signingkey" |
| if (file(gradle.ext.platformCertPath).exists()) { |
| signingConfig signingConfigs.platform |
| } |
| } |
| } |
| |
| buildTypes { |
| release { |
| minifyEnabled false |
| } |
| debug { |
| testCoverageEnabled = true |
| signingConfig android.buildTypes.release.signingConfig |
| } |
| } |
| |
| testOptions { |
| unitTests { |
| includeAndroidResources = true |
| } |
| animationsDisabled = true |
| } |
| |
| // This is the gradle equivalent of the libs: ["android.car"] in the Android.bp |
| useLibrary 'android.car' |
| |
| useLibrary 'android.test.runner' |
| useLibrary 'android.test.base' |
| useLibrary 'android.test.mock' |
| } |
| |
| dependencies { |
| implementation "androidx.preference:preference:1.1.1" |
| implementation 'androidx.constraintlayout:constraintlayout:2.1.0' |
| |
| def lifecycle_version = "2.2.0" |
| implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" |
| // Not available in 2.3+ |
| implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" |
| |
| implementation files(gradle.ext.lib_car_system_stubs) |
| |
| implementation "androidx.media:media:1.6.0" |
| |
| 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") |
| |
| //Test libs |
| testImplementation 'org.hamcrest:hamcrest-library:1.3' |
| testImplementation 'androidx.test.espresso:espresso-core:3.3.0' |
| testImplementation 'androidx.test.espresso:espresso-contrib:3.3.0' |
| testImplementation 'com.google.truth:truth:1.1.3' |
| testImplementation 'androidx.test.ext:junit:1.1.3' |
| testImplementation 'junit:junit:4.12' |
| testImplementation 'org.robolectric:robolectric:4.10.3' |
| testImplementation "org.mockito:mockito-core:2.19.0" |
| testImplementation 'androidx.test:runner:1.4.0' |
| testImplementation 'androidx.test:rules:1.4.0' |
| // This is needed to be able to spy certain classes with Mockito |
| // It's major/minor version must match Mockito's. |
| androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.28.1' |
| // Required for instrumented tests |
| testImplementation 'com.android.support:support-annotations:28.0.0' |
| |
| androidTestUtil 'androidx.test:orchestrator:1.1.0' |
| } |
| |
| 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)) |
| } |
| } |
| } |
| } |