[go: nahoru, domu]

blob: af66549e7ea3ce98a47672b5d392f1fe310da766 [file] [log] [blame]
Anton Kulakov64ed1522022-08-18 07:53:16 +00001/*
2 * Copyright (C) 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
Tiem Songee0da742024-01-03 14:08:46 -080017/**
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 */
Anton Kulakov64ed1522022-08-18 07:53:16 +000024import androidx.build.LibraryType
Anton Kulakovf0e2a2c2023-07-27 11:17:27 +000025import javax.inject.Inject
Anton Kulakov64ed1522022-08-18 07:53:16 +000026
27plugins {
28 id("AndroidXPlugin")
29 id("com.android.library")
30 id("org.jetbrains.kotlin.android")
31}
32
Anton Kulakovf0e2a2c2023-07-27 11:17:27 +000033abstract class BundleTestSdkDexTask extends DefaultTask {
34
35 @InputFiles
36 @PathSensitive(PathSensitivity.NAME_ONLY)
37 abstract ConfigurableFileCollection getTestSdkApkFolders()
38
39 @OutputDirectory
40 abstract DirectoryProperty getOutputDir()
41
42 @Inject
43 abstract FileSystemOperations getFileSystemOperations()
44
45 @Inject
46 abstract ArchiveOperations getArchiveOperations()
47
48 @TaskAction
49 def exec() {
50 for (File folder : testSdkApkFolders.files) {
51 for (File file : folder.listFiles()) {
52 String fileName = file.name
53 if (!fileName.endsWith(".apk")) {
54 continue
55 }
56
57 int projectNameEnd = fileName.indexOf("-")
58 String projectName = projectNameEnd > 0 ? fileName.substring(0, projectNameEnd) : fileName
59
60 fileSystemOperations.copy {
61 from(archiveOperations.zipTree(file))
62 into(outputDir.dir("test-sdks/$projectName/"))
63 include('*.dex')
64 }
65 }
66 }
67 }
68}
69
70def bundleTestSdkDexTaskProvider = tasks.register("bundleTestSdkDexTask", BundleTestSdkDexTask) {
71 description("Bundle DEX from the androidTestBundleDex configuration into assets folder")
72
73 def configuration = configurations.getByName("androidTestBundleDex")
74 testSdkApkFolders.from(configuration.incoming.artifactView {}.files)
75}
76
77androidComponents {
78 onVariants(selector().withBuildType("debug")) {
79 androidTest.sources.assets.addGeneratedSourceDirectory(
80 bundleTestSdkDexTaskProvider,
81 BundleTestSdkDexTask::getOutputDir
82 )
83 }
84}
85
86configurations {
87 androidTestBundleDex {
88 canBeConsumed = false
89 canBeResolved = true
90 attributes {
91 attribute(
92 LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
93 objects.named(LibraryElements, "testSdkApk")
94 )
95 }
96 }
97}
98
Anton Kulakov64ed1522022-08-18 07:53:16 +000099dependencies {
100 api(libs.kotlinStdlib)
Anton Kulakovac243d72022-09-25 09:25:54 +0000101 api(libs.kotlinCoroutinesCore)
Anton Kulakovf48ae8c2023-11-10 19:18:25 +0000102 implementation("androidx.core:core-ktx:1.12.0")
Anton Kulakovac243d72022-09-25 09:25:54 +0000103
Anton Kulakovac243d72022-09-25 09:25:54 +0000104 api project(path: ':privacysandbox:sdkruntime:sdkruntime-core')
105
Anton Kulakovf48ae8c2023-11-10 19:18:25 +0000106 implementation("androidx.core:core:1.12.0")
107 implementation("androidx.activity:activity:1.8.0")
Anton Kulakovac243d72022-09-25 09:25:54 +0000108
Anton Kulakov52eeb202022-11-22 12:17:46 +0000109 testImplementation(libs.junit)
110 testImplementation(libs.truth)
111 testImplementation project(":room:room-compiler-processing-testing")
112
Anton Kulakovac243d72022-09-25 09:25:54 +0000113 // TODO(b/249982004): cleanup dependencies
114 androidTestImplementation(libs.testCore)
115 androidTestImplementation(libs.testExtJunit)
116 androidTestImplementation(libs.testRunner)
117 androidTestImplementation(libs.testRules)
118 androidTestImplementation(libs.truth)
119 androidTestImplementation(libs.junit)
Anton Kulakoved50ebd2023-05-04 13:25:09 +0000120 androidTestImplementation(project(':internal-testutils-runtime'))
Anton Kulakovc06ac2b2022-10-22 08:46:32 +0000121 androidTestImplementation(project(":internal-testutils-truth")) // for assertThrows
Anton Kulakovac243d72022-09-25 09:25:54 +0000122
123 androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
124 androidTestImplementation(libs.dexmakerMockitoInline, excludes.bytebuddy) // DexMaker has it"s own MockMaker
Anton Kulakovf0e2a2c2023-07-27 11:17:27 +0000125
126 androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:current"))
Anton Kulakovc75cf932023-08-07 15:27:12 +0000127 androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v1"))
128 androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v2"))
129 // V3 was released as V4 (original release postponed)
130 androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v4"))
Anton Kulakov096fdc32024-02-27 17:30:30 +0000131 androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v5"))
Anton Kulakov64ed1522022-08-18 07:53:16 +0000132}
133
134android {
Anton Kulakovc06ac2b2022-10-22 08:46:32 +0000135 sourceSets {
136 androidTest {
137 assets {
138 srcDirs += "src/androidTest/assets"
139 }
140 }
141 }
Anton Kulakovde32ede2023-03-14 12:51:13 +0000142
Anton Kulakov64ed1522022-08-18 07:53:16 +0000143 namespace "androidx.privacysandbox.sdkruntime.client"
Omar Ismailf780db82024-04-11 16:00:49 -0400144 compileSdk = 34
145 compileSdkExtension = 10
Anton Kulakov64ed1522022-08-18 07:53:16 +0000146}
147
148androidx {
Anton Kulakovf8cec2a2023-09-20 09:54:11 +0000149 name = "SdkRuntime Client"
Anton Kulakov64ed1522022-08-18 07:53:16 +0000150 type = LibraryType.PUBLISHED_LIBRARY
Anton Kulakov64ed1522022-08-18 07:53:16 +0000151 inceptionYear = "2022"
152 description = "Provides components for SdkRuntime aware Applications"
Jinseong Jeon999075e2023-08-22 00:40:11 -0700153 metalavaK2UastEnabled = true
Aurimas Liutikas5c5419a2024-05-29 15:26:58 -0700154 legacyDisableKotlinStrictApiMode = true
Anton Kulakov64ed1522022-08-18 07:53:16 +0000155}