1/*
2 * Copyright 2022 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 */
24import com.android.build.api.artifact.SingleArtifact
25
26plugins {
27    id("AndroidXPlugin")
28    id("com.android.application")
29    id("org.jetbrains.kotlin.android")
30}
31android {
32    compileSdk = 35
33
34    buildTypes {
35        release {
36            // Minification and shrinking are disabled to avoid r8 removing unused methods and
37            // speed up build process.
38            minifyEnabled = false
39            shrinkResources = false
40        }
41    }
42
43    flavorDimensions = ["version"]
44    productFlavors {
45        v1 {
46            dimension "version"
47            versionCode 1
48        }
49        v2 {
50            dimension "version"
51            versionCode 2
52        }
53        v3 {
54            dimension "version"
55            versionCode 3
56        }
57    }
58
59    namespace = "androidx.profileinstaller.integration.profileverification.target"
60}
61
62dependencies {
63    implementation(libs.kotlinStdlib)
64    implementation(project(":profileinstaller:profileinstaller"))
65
66    // These projects are not used directly but added to baseline-prof.txt to increase number of
67    // methods, in order to have dex opt to run.
68    implementation("androidx.core:core:1.15.0")
69    implementation("androidx.core:core-ktx:1.15.0")
70}
71
72// Define a configuration that can be consumed, as this project is a provider of test apks for
73// profile verification integration test.
74configurations {
75    apkAssets {
76        canBeConsumed = true
77        canBeResolved = false
78        attributes {
79            attribute(
80                    LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
81                    objects.named(LibraryElements, 'profileverification-apkAssets')
82            )
83        }
84    }
85}
86
87// Release apk variants are added as output artifacts to the apkAssets configuration.
88// The apkAssets configuration is consumed by profile-verification integration test and
89// artifacts are placed in the assets folder.
90// Release apk variants are added as output artifacts to the apkAssets configuration.
91// The apkAssets configuration is consumed by profile-verification integration test and
92// artifacts are placed in the assets folder.
93androidComponents {
94    onVariants(selector().all().withBuildType("release"), { variant ->
95        artifacts {
96            apkAssets(variant.artifacts.get(SingleArtifact.APK.INSTANCE))
97        }
98    })
99}
100