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}
31
32// This project can be removed once b/239659205 has landed and use only the
33// profile-verification-sample project.
34android {
35    compileSdk = 35
36
37    buildTypes {
38        release {
39            // Minification and shrinking are disabled to avoid r8 removing unused methods and
40            // speed up build process.
41            minifyEnabled = false
42            shrinkResources = false
43        }
44    }
45
46    flavorDimensions = ["version"]
47    productFlavors {
48        v1 {
49            dimension "version"
50            versionCode 1
51        }
52        v2 {
53            dimension "version"
54            versionCode 2
55        }
56        v3 {
57            dimension "version"
58            versionCode 3
59        }
60    }
61
62    namespace = "androidx.profileinstaller.integration.profileverification.target.no_initializer"
63}
64
65dependencies {
66    implementation(libs.kotlinStdlib)
67    implementation(project(":profileinstaller:profileinstaller"))
68
69    // These projects are not used directly but added to baseline-prof.txt to increase number of
70    // methods, in order to have dex opt to run.
71    implementation("androidx.core:core:1.15.0")
72    implementation("androidx.core:core-ktx:1.15.0")
73}
74
75// Define a configuration that can be consumed, as this project is a provider of test apks for
76// profile verification integration test.
77configurations {
78    apkAssets {
79        canBeConsumed = true
80        canBeResolved = false
81        attributes {
82            attribute(
83                    LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
84                    objects.named(LibraryElements, 'profileverification-apkAssets')
85            )
86        }
87    }
88}
89
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