1/*
2 * Copyright (C) 2020 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
17/**
18 * This file was created using the `create_project.py` script located in the
19 * `<AndroidX root>/development/project-creator` directory.
20 *
21 * Please use that script when creating a new project, rather than copying an existing project and
22 * modifying its settings.
23 */
24
25import androidx.build.SoftwareType
26import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
27
28plugins {
29    id("AndroidXPlugin")
30    id("com.android.library")
31    id("org.jetbrains.kotlin.android")
32}
33
34android {
35    defaultConfig {
36        minSdk = 23
37
38        // The package name is passed to the app as an instrumentation runner argument.
39        // Set default target package at runtime. This could also be set by baseline profile
40        // gradle plugin, but that's not used here.
41        testInstrumentationRunnerArguments["androidx.benchmark.targetPackageName"] =
42                "androidx.benchmark.integration.macrobenchmark.target"
43
44        // We don't care about perf from these correctness tests, so suppress
45        // anything that may otherwise block these tests
46        testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] =
47                "CODE-COVERAGE,DEBUGGABLE,EMULATOR,LOW-BATTERY,UNLOCKED"
48        // these extra payload values are used in test.
49        testInstrumentationRunnerArguments["androidx.benchmark.output.payload.simpleValue"] =
50                "simple_value"
51    }
52    namespace = "androidx.benchmark.macro.junit4"
53}
54
55dependencies {
56    api(libs.junit)
57    api(libs.kotlinStdlib)
58    api("androidx.annotation:annotation:1.8.1")
59    api(project(":benchmark:benchmark-macro"))
60    api("androidx.test.uiautomator:uiautomator:2.3.0")
61    implementation(project(":benchmark:benchmark-common"))
62    implementation("androidx.test:rules:1.5.0")
63    implementation("androidx.test:runner:1.5.2")
64
65    androidTestImplementation(libs.testExtJunit)
66    androidTestImplementation(libs.testRules)
67    androidTestImplementation(libs.testRunner)
68    androidTestImplementation(libs.kotlinTest)
69    androidTestImplementation(libs.truth)
70}
71
72tasks.withType(KotlinCompile).configureEach {
73    kotlinOptions {
74        // Enable using experimental APIs from within same version group
75        freeCompilerArgs += [
76                "-opt-in=androidx.benchmark.ExperimentalBenchmarkConfigApi",
77                "-opt-in=androidx.benchmark.macro.ExperimentalMetricApi",
78                "-opt-in=androidx.benchmark.perfetto.ExperimentalPerfettoCaptureApi",
79        ]
80    }
81}
82
83androidx {
84    name = "Benchmark - Macrobenchmark JUnit4"
85    type = SoftwareType.PUBLISHED_LIBRARY
86    inceptionYear = "2020"
87    description = "Android Benchmark - Macrobenchmark JUnit4"
88    legacyDisableKotlinStrictApiMode = true
89    deviceTests {
90        targetAppProject = project(":benchmark:integration-tests:macrobenchmark-target")
91        targetAppVariant = "release"
92    }
93    samples(project(":benchmark:benchmark-samples"))
94}
95