1/* 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 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 */ 24 25import androidx.build.SoftwareType 26import androidx.build.SdkHelperKt 27import androidx.build.AndroidXConfig 28 29plugins { 30 id("AndroidXPlugin") 31 id("kotlin") 32} 33 34androidx.configureAarAsJarForConfiguration("testImplementation") 35 36def buildToolsVersion = AndroidXConfig.getDefaultAndroidConfig(project).getBuildToolsVersion() 37def compileSdk = AndroidXConfig.getDefaultAndroidConfig(project).getCompileSdk() 38 39dependencies { 40 api(project(":privacysandbox:tools:tools")) 41 api(project(":privacysandbox:tools:tools-core")) 42 api(libs.kotlinStdlib) 43 implementation(libs.kspApi) 44 implementation("com.squareup:kotlinpoet:2.0.0") 45 46 testImplementation(project(":privacysandbox:tools:tools-testing")) 47 testImplementation(project(":room:room-compiler-processing-testing")) 48 testImplementationAarAsJar(project(":privacysandbox:activity:activity-core")) 49 testImplementationAarAsJar(project(":privacysandbox:activity:activity-provider")) 50 testImplementationAarAsJar(project(":privacysandbox:ui:ui-core")) 51 testImplementationAarAsJar(project(":privacysandbox:ui:ui-provider")) 52 testImplementationAarAsJar(project(":privacysandbox:sdkruntime:sdkruntime-core")) 53 testImplementation(libs.junit) 54 testImplementation(libs.truth) 55 testImplementation(libs.kotlinCoroutinesCore) 56 // Include android jar for compilation of generated sources. 57 testImplementation(SdkHelperKt.getSdkDependency(project)) 58} 59 60// Get AIDL compiler path and framework.aidl path and pass to tests for code generation. 61def aidlCompilerPath = "${SdkHelperKt.getSdkPath(project)}/build-tools/$buildToolsVersion/aidl" 62def frameworkAidlPath = "${SdkHelperKt.getSdkPath(project)}/platforms/android-$compileSdk/framework.aidl" 63def testGeneratedSourcesPath = "${project.buildDir}/testGeneratedSources" 64tasks.withType(Test).configureEach { test -> 65 test.inputs.files(aidlCompilerPath) 66 .withPropertyName("aidl_compiler_path") 67 .withPathSensitivity(PathSensitivity.NAME_ONLY) 68 test.inputs.files(frameworkAidlPath) 69 .withPropertyName("framework_aidl_path") 70 .withPathSensitivity(PathSensitivity.NAME_ONLY) 71 test.inputs.dir("src/test/test-data").withPathSensitivity(PathSensitivity.RELATIVE) 72 test.doFirst { 73 systemProperty("aidl_compiler_path", aidlCompilerPath) 74 systemProperty("framework_aidl_path", frameworkAidlPath) 75 systemProperty("test_output_dir", testGeneratedSourcesPath) 76 } 77} 78 79androidx { 80 name = "androidx.privacysandbox.tools:tools-apicompiler" 81 type = SoftwareType.ANNOTATION_PROCESSOR 82 inceptionYear = "2022" 83 description = "Compiler for Privacy Sandbox API annotations." 84} 85