1/**
2 * This file was created using the `create_project.py` script located in the
3 * `<AndroidX root>/development/project-creator` directory.
4 *
5 * Please use that script when creating a new project, rather than copying an existing project and
6 * modifying its settings.
7 */
8import androidx.build.SoftwareType
9import androidx.build.SdkResourceGenerator
10
11plugins {
12    id("AndroidXPlugin")
13    id("kotlin")
14    id("java-gradle-plugin")
15}
16
17configurations {
18    // Config for plugin classpath to be used during tests
19    testPlugin {
20        canBeConsumed = false
21        canBeResolved = true
22    }
23}
24
25tasks.withType(Test).configureEach {
26    it.javaLauncher = javaToolchains.launcherFor {
27        // Test on JDK 17 which supports lower versions of AGP. This can be removed
28        // once we move to AGP 8.2.1+
29        languageVersion = JavaLanguageVersion.of(17)
30    }
31}
32
33dependencies {
34    implementation("com.android.tools.build:gradle-api:8.1.1")
35    implementation(libs.kotlinStdlib)
36    compileOnly(libs.androidGradlePlugin)
37    compileOnly(libs.kspGradlePlugin)
38
39    testImplementation(libs.junit)
40    testImplementation(project(":internal-testutils-gradle-plugin"))
41
42    testPlugin("com.android.tools.build:gradle:8.1.1")
43    testPlugin("com.android.tools.build:aapt2:8.1.1-10154469")
44    testPlugin("com.android.tools.build:aapt2:8.1.1-10154469:linux")
45    testPlugin("com.android.tools.build:aapt2:8.1.1-10154469:osx")
46    testPlugin("com.google.devtools.ksp:symbol-processing-api:1.9.22-1.0.17")
47    testPlugin(libs.kotlinGradlePlugin)
48    testPlugin(libs.kspGradlePlugin)
49}
50
51gradlePlugin {
52    plugins {
53        privacysandboxlibrary {
54            id = "androidx.privacysandbox.library"
55            implementationClass = "androidx.privacysandboxlibraryplugin.PrivacySandboxLibraryPlugin"
56        }
57    }
58}
59
60// Configure the generating task of plugin-under-test-metadata.properties to
61// include additional dependencies for the injected plugin classpath that
62// are not present in the main runtime dependencies. This allows us to test
63// the KAPT / KSP plugins while keeping a compileOnly dep on the main source.
64tasks.withType(PluginUnderTestMetadata.class).named("pluginUnderTestMetadata").configure {
65    it.pluginClasspath.from(configurations.testPlugin)
66}
67
68androidx {
69    name = "androidx.privacysandbox.plugins:privacysandbox-library"
70    type = SoftwareType.GRADLE_PLUGIN
71    inceptionYear = "2023"
72    description = "Android Privacy Sandbox Sdk Library Gradle Plugin"
73}
74