| /* |
| * Copyright (C) 2022 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| /** |
| * This file was created using the `create_project.py` script located in the |
| * `<AndroidX root>/development/project-creator` directory. |
| * |
| * Please use that script when creating a new project, rather than copying an existing project and |
| * modifying its settings. |
| */ |
| import androidx.build.LibraryType |
| import javax.inject.Inject |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("com.android.library") |
| id("org.jetbrains.kotlin.android") |
| } |
| |
| abstract class BundleTestSdkDexTask extends DefaultTask { |
| |
| @InputFiles |
| @PathSensitive(PathSensitivity.NAME_ONLY) |
| abstract ConfigurableFileCollection getTestSdkApkFolders() |
| |
| @OutputDirectory |
| abstract DirectoryProperty getOutputDir() |
| |
| @Inject |
| abstract FileSystemOperations getFileSystemOperations() |
| |
| @Inject |
| abstract ArchiveOperations getArchiveOperations() |
| |
| @TaskAction |
| def exec() { |
| for (File folder : testSdkApkFolders.files) { |
| for (File file : folder.listFiles()) { |
| String fileName = file.name |
| if (!fileName.endsWith(".apk")) { |
| continue |
| } |
| |
| int projectNameEnd = fileName.indexOf("-") |
| String projectName = projectNameEnd > 0 ? fileName.substring(0, projectNameEnd) : fileName |
| |
| fileSystemOperations.copy { |
| from(archiveOperations.zipTree(file)) |
| into(outputDir.dir("test-sdks/$projectName/")) |
| include('*.dex') |
| } |
| } |
| } |
| } |
| } |
| |
| def bundleTestSdkDexTaskProvider = tasks.register("bundleTestSdkDexTask", BundleTestSdkDexTask) { |
| description("Bundle DEX from the androidTestBundleDex configuration into assets folder") |
| |
| def configuration = configurations.getByName("androidTestBundleDex") |
| testSdkApkFolders.from(configuration.incoming.artifactView {}.files) |
| } |
| |
| androidComponents { |
| onVariants(selector().withBuildType("debug")) { |
| androidTest.sources.assets.addGeneratedSourceDirectory( |
| bundleTestSdkDexTaskProvider, |
| BundleTestSdkDexTask::getOutputDir |
| ) |
| } |
| } |
| |
| configurations { |
| androidTestBundleDex { |
| canBeConsumed = false |
| canBeResolved = true |
| attributes { |
| attribute( |
| LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, |
| objects.named(LibraryElements, "testSdkApk") |
| ) |
| } |
| } |
| } |
| |
| dependencies { |
| api(libs.kotlinStdlib) |
| api(libs.kotlinCoroutinesCore) |
| implementation("androidx.core:core-ktx:1.12.0") |
| |
| api project(path: ':privacysandbox:sdkruntime:sdkruntime-core') |
| |
| implementation("androidx.core:core:1.12.0") |
| implementation("androidx.activity:activity:1.8.0") |
| |
| testImplementation(libs.junit) |
| testImplementation(libs.truth) |
| testImplementation project(":room:room-compiler-processing-testing") |
| |
| // TODO(b/249982004): cleanup dependencies |
| androidTestImplementation(libs.testCore) |
| androidTestImplementation(libs.testExtJunit) |
| androidTestImplementation(libs.testRunner) |
| androidTestImplementation(libs.testRules) |
| androidTestImplementation(libs.truth) |
| androidTestImplementation(libs.junit) |
| androidTestImplementation(libs.multidex) |
| androidTestImplementation(project(':internal-testutils-runtime')) |
| androidTestImplementation(project(":internal-testutils-truth")) // for assertThrows |
| |
| androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker |
| androidTestImplementation(libs.dexmakerMockitoInline, excludes.bytebuddy) // DexMaker has it"s own MockMaker |
| |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:current")) |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v1")) |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v2")) |
| // V3 was released as V4 (original release postponed) |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v4")) |
| } |
| |
| android { |
| defaultConfig { |
| multiDexEnabled = true |
| } |
| sourceSets { |
| androidTest { |
| assets { |
| srcDirs += "src/androidTest/assets" |
| } |
| } |
| } |
| |
| namespace "androidx.privacysandbox.sdkruntime.client" |
| compileSdkVersion = "android-34-ext8" |
| } |
| |
| androidx { |
| name = "SdkRuntime Client" |
| type = LibraryType.PUBLISHED_LIBRARY |
| inceptionYear = "2022" |
| description = "Provides components for SdkRuntime aware Applications" |
| metalavaK2UastEnabled = true |
| } |