blob: f1f5a3b0166976dca2dd0de6d9376efdb024e352 [file] [log] [blame]
/*
* 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 androidx.build.SdkHelperKt
import androidx.build.AndroidXConfig
plugins {
id("AndroidXPlugin")
id("kotlin")
}
androidx.configureAarAsJarForConfiguration("testImplementation")
def buildToolsVersion = AndroidXConfig.getDefaultAndroidConfig(project).getBuildToolsVersion()
def compileSdk = AndroidXConfig.getDefaultAndroidConfig(project).getCompileSdk()
dependencies {
api(libs.kotlinStdlib)
implementation(libs.kspApi)
implementation(libs.kotlinPoet)
implementation project(path: ':privacysandbox:tools:tools')
implementation project(path: ':privacysandbox:tools:tools-core')
testImplementation(project(":privacysandbox:tools:tools-testing"))
testImplementation(project(":room:room-compiler-processing-testing"))
testImplementationAarAsJar(project(":privacysandbox:activity:activity-core"))
testImplementationAarAsJar(project(":privacysandbox:activity:activity-provider"))
testImplementationAarAsJar(project(":privacysandbox:ui:ui-core"))
testImplementationAarAsJar(project(":privacysandbox:ui:ui-provider"))
testImplementationAarAsJar(project(":privacysandbox:sdkruntime:sdkruntime-core"))
testImplementation(libs.junit)
testImplementation(libs.truth)
testImplementation(libs.kotlinCoroutinesCore)
// Include android jar for compilation of generated sources.
testImplementation(SdkHelperKt.getSdkDependency(project))
}
// Get AIDL compiler path and framework.aidl path and pass to tests for code generation.
def aidlCompilerPath = "${SdkHelperKt.getSdkPath(project)}/build-tools/$buildToolsVersion/aidl"
def frameworkAidlPath = "${SdkHelperKt.getSdkPath(project)}/platforms/$compileSdk/framework.aidl"
def testGeneratedSourcesPath = "${project.buildDir}/testGeneratedSources"
tasks.withType(Test).configureEach { test ->
test.inputs.files(aidlCompilerPath)
.withPropertyName("aidl_compiler_path")
.withPathSensitivity(PathSensitivity.NAME_ONLY)
test.inputs.files(frameworkAidlPath)
.withPropertyName("framework_aidl_path")
.withPathSensitivity(PathSensitivity.NAME_ONLY)
test.inputs.dir("src/test/test-data").withPathSensitivity(PathSensitivity.RELATIVE)
test.doFirst {
systemProperty("aidl_compiler_path", aidlCompilerPath)
systemProperty("framework_aidl_path", frameworkAidlPath)
systemProperty("test_output_dir", testGeneratedSourcesPath)
}
}
androidx {
name = "androidx.privacysandbox.tools:tools-apicompiler"
type = LibraryType.ANNOTATION_PROCESSOR
inceptionYear = "2022"
description = "Compiler for Privacy Sandbox API annotations."
}