1 /*
2  * Copyright 2023 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 package androidx.baselineprofile.gradle.utils
18 
19 import com.android.build.api.AndroidPluginVersion
20 
21 // Minimum AGP version required
22 internal val MIN_AGP_VERSION_REQUIRED_INCLUSIVE = AndroidPluginVersion(8, 0, 0)
23 internal val MAX_AGP_VERSION_RECOMMENDED_EXCLUSIVE = AndroidPluginVersion(9, 0, 0).alpha(1)
24 
25 // Prefix for the build type baseline profile
26 internal const val BUILD_TYPE_BASELINE_PROFILE_PREFIX = "nonMinified"
27 internal const val BUILD_TYPE_BENCHMARK_PREFIX = "benchmark"
28 
29 // Configuration consumed by this plugin that carries the baseline profile HRF file.
30 internal const val CONFIGURATION_NAME_BASELINE_PROFILES = "baselineProfile"
31 
32 // Custom attributes to match the baseline profile configuration
33 internal const val ATTRIBUTE_USAGE_BASELINE_PROFILE = "baselineProfile"
34 internal const val ATTRIBUTE_TARGET_JVM_ENVIRONMENT = "android"
35 internal const val ATTRIBUTE_BASELINE_PROFILE_PLUGIN_VERSION = "alpha1"
36 
37 // Specifies the artifact type in the variant configuration
38 internal const val CONFIGURATION_ARTIFACT_TYPE = "baselineProfile"
39 
40 // Base folder for artifacts generated by the tasks
41 internal const val INTERMEDIATES_BASE_FOLDER = "intermediates/baselineprofiles"
42 
43 // Specifies the suffix for each baseline profile task. Note that tasks have the following
44 // structure: <action><variant><suffix>. For example, if action is `generate`, variant is `release`
45 // and suffix is `baselineProfile` the task name will be `generateReleaseBaselineProfile`.
46 internal const val TASK_NAME_SUFFIX = "baselineProfile"
47 
48 // Other constants
49 internal const val RELEASE = "release"
50 
51 // Kotlin Multiplatform Plugin ID
52 internal const val KOTLIN_MULTIPLATFORM_PLUGIN_ID = "org.jetbrains.kotlin.multiplatform"
53 
54 // Instrumentation runner arguments
55 internal const val INSTRUMENTATION_ARG_ENABLED_RULES = "androidx.benchmark.enabledRules"
56 internal const val INSTRUMENTATION_ARG_SKIP_ON_EMULATOR = "androidx.benchmark.skipOnEmulator"
57 internal const val INSTRUMENTATION_ARG_ENABLED_RULES_BASELINE_PROFILE = "baselineprofile"
58 internal const val INSTRUMENTATION_ARG_ENABLED_RULES_BENCHMARK = "macrobenchmark"
59 
60 // This should be aligned with `androidx.benchmark.Arguments#targetPackageName`
61 internal const val INSTRUMENTATION_ARG_TARGET_PACKAGE_NAME = "androidx.benchmark.targetPackageName"
62