1/** 2 * This file was created using the `create_project.py` script located in the 3 * `<AndroidX root>/development/project-creator` directory. 4 * 5 * Please use that script when creating a new project, rather than copying an existing project and 6 * modifying its settings. 7 */ 8import com.android.build.api.artifact.SingleArtifact 9 10/* 11 * Copyright 2022 The Android Open Source Project 12 * 13 * Licensed under the Apache License, Version 2.0 (the "License"); 14 * you may not use this file except in compliance with the License. 15 * You may obtain a copy of the License at 16 * 17 * http://www.apache.org/licenses/LICENSE-2.0 18 * 19 * Unless required by applicable law or agreed to in writing, software 20 * distributed under the License is distributed on an "AS IS" BASIS, 21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 * See the License for the specific language governing permissions and 23 * limitations under the License. 24 */ 25 26plugins { 27 id("AndroidXPlugin") 28 id("com.android.application") 29 id("org.jetbrains.kotlin.android") 30 id("androidx.baselineprofile") 31 id("com.google.devtools.ksp") 32 id("com.google.dagger.hilt.android") 33} 34 35android { 36 sourceSets { 37 // This is required because of release variant specific code used by hilt. 38 releaseLibrariesOnly { 39 java.srcDirs += "src/release/" 40 } 41 } 42 buildTypes { 43 release { 44 minifyEnabled = true 45 shrinkResources = true 46 proguardFiles getDefaultProguardFile("proguard-android-optimize.txt") 47 } 48 releaseLibrariesOnly { 49 initWith(release) 50 matchingFallbacks += "release" 51 } 52 } 53 namespace = "androidx.benchmark.integration.baselineprofile.consumer" 54} 55 56dependencies { 57 implementation(libs.kotlinStdlib) 58 implementation(libs.constraintLayout) 59 implementation(libs.hiltAndroid) 60 ksp(libs.hiltCompiler) 61 implementation(project(":profileinstaller:profileinstaller")) 62} 63 64baselineProfile { 65 // Note that these are the default settings, just reported here to make it explicit. 66 // `automaticGenerationDuringBuild` has to be off otherwise assembling release on CI would 67 // trigger baseline profile generation and integration tests on device. 68 saveInSrc = true 69 automaticGenerationDuringBuild = false 70 71 variants { 72 release { 73 from(project(":benchmark:integration-tests:baselineprofile-producer")) 74 } 75 releaseLibrariesOnly { 76 // No dependency set 77 } 78 } 79} 80 81apply(from: "../baselineprofile-test-utils/utils.gradle") 82 83// Exposes the apk for profile verifier tests. When calling this function, the generated apks 84// can be utilized with `profileinstaller:integration-tests:profile-verification`. 85configurations { 86 apkAssets { 87 canBeConsumed = true 88 canBeResolved = false 89 attributes { 90 attribute( 91 LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, 92 objects.named(LibraryElements, 'profileverification-apkAssets') 93 ) 94 } 95 } 96} 97androidComponents { 98 onVariants(selector().all(), { variant -> 99 artifacts { 100 apkAssets(variant.artifacts.get(SingleArtifact.APK.INSTANCE)) 101 } 102 }) 103} 104