| /* | |
| * Copyright (C) 2026 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. | |
| */ | |
| package com.android.build.gradle.internal.coverage | |
| import com.android.Version | |
| /** Configurations for the on-device coverage agent. */ | |
| object CoverageAgentConfigurations { | |
| private const val AGENT_DEPENDENCY_GROUP = "com.android.tools.test" | |
| private const val AGENT_DEPENDENCY_NAME = "coverage-agent" | |
| /** | |
| * Returns the Maven coordinate of the on-device coverage agent. | |
| * | |
| * The agent is built and released in lockstep with the Android Gradle plugin (same version, same gmaven release), so it always resolves | |
| * to the exact AGP version: the coordinate is added to the androidTest runtime classpath and forced on both the compile and runtime | |
| * classpaths of the test component (see `TaskManager.handleOnTheFlyCoverageDependencies`), so a different version declared by the build | |
| * author cannot win conflict resolution. Fixes to the agent ship with the next AGP release. | |
| */ | |
| @JvmStatic | |
| fun getAgentRuntimeDependency(): String { | |
| return "$AGENT_DEPENDENCY_GROUP:$AGENT_DEPENDENCY_NAME:${Version.ANDROID_GRADLE_PLUGIN_VERSION}" | |
| } | |
| } |