| /* |
| * 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("release")) { |
| 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.15.0") |
| |
| api(project(":privacysandbox:sdkruntime:sdkruntime-core")) |
| |
| implementation("androidx.core:core:1.15.0") |
| implementation("androidx.activity:activity:1.9.3") |
| implementation("androidx.lifecycle:lifecycle-process:2.8.7") |
| |
| 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(project(":internal-testutils-runtime")) |
| androidTestImplementation(project(":internal-testutils-truth")) // for assertThrows |
| |
| androidTestImplementation(libs.mockitoCore) |
| androidTestImplementation(libs.dexmakerMockitoInline) |
| |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:current")) |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v4")) |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v5")) |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v6")) |
| androidTestBundleDex(project(":privacysandbox:sdkruntime:test-sdks:v7")) |
| } |
| |
| android { |
| sourceSets { |
| androidTest { |
| assets { |
| srcDirs += "src/androidTest/assets" |
| } |
| } |
| } |
| |
| namespace = "androidx.privacysandbox.sdkruntime.client" |
| compileSdk = 35 |
| compileSdkExtension = 14 |
| } |
| |
| androidx { |
| name = "SdkRuntime Client" |
| type = LibraryType.PUBLISHED_LIBRARY |
| inceptionYear = "2022" |
| description = "Provides components for SdkRuntime aware Applications" |
| legacyDisableKotlinStrictApiMode = true |
| } |