blob: 72fb9ec897bc614110b72f5cff959cbecd3af998 [file] [log] [blame]
/*
* Copyright (C) 2023 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 {
alias(libs.plugins.android.test)
alias(libs.plugins.kotlin.android)
}
android {
namespace = "com.google.jetpackcamera.benchmark"
compileSdk = libs.versions.compileSdk.get().toInt()
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
defaultConfig {
//Our app has a minSDK of 21, but in order for the benchmark tool to function, it must be 23
minSdk = 23
targetSdk = libs.versions.targetSdk.get().toInt()
// allows the benchmark to be run on an emulator
testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] =
"EMULATOR,LOW-BATTERY,NOT-PROFILEABLE"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
// This benchmark buildType is used for benchmarking, and should function like your
// release build (for example, with minification on). It"s signed with a debug key
// for easy local/CI testing.
create("benchmark") {
isDebuggable = true
signingConfig = getByName("debug").signingConfig
matchingFallbacks += listOf("release")
}
}
targetProjectPath = ":app"
// required for benchmark:
// self instrumentation required for the tests to be able to compile, start, or kill the app
// ensures test and app processes are separate
// see https://source.android.com/docs/core/tests/development/instr-self-e2e
experimentalProperties["android.experimental.self-instrumenting"] = true
}
dependencies {
implementation(libs.androidx.junit)
implementation(libs.androidx.benchmark.macro.junit4)
}
androidComponents {
beforeVariants(selector().all()) {
it.enable = it.buildType == "benchmark"
}
}