| /* |
| * Copyright 2023 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.SdkResourceGenerator |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("kotlin") |
| id("java-gradle-plugin") |
| } |
| |
| configurations { |
| // Config for plugin classpath to be used during tests |
| testPlugin { |
| canBeConsumed = false |
| canBeResolved = true |
| } |
| } |
| |
| dependencies { |
| implementation(libs.kotlinStdlib) |
| implementation(gradleApi()) |
| compileOnly("com.android.tools.build:gradle:8.1.0") |
| compileOnly(libs.kotlinGradlePlugin) |
| compileOnly(libs.kspGradlePlugin) |
| |
| testImplementation(project(":internal-testutils-gradle-plugin")) |
| testImplementation(gradleTestKit()) |
| testImplementation(libs.junit) |
| testImplementation(project(":kruth:kruth")) |
| testImplementation(libs.testParameterInjector) |
| |
| testPlugin("com.android.tools.build:gradle:8.1.0") |
| testPlugin("com.android.tools.build:aapt2:8.1.0-10154469") |
| testPlugin("com.android.tools.build:aapt2:8.1.0-10154469:linux") |
| testPlugin("com.android.tools.build:aapt2:8.1.0-10154469:osx") |
| testPlugin(libs.kotlinGradlePlugin) |
| testPlugin(libs.kspGradlePlugin) |
| } |
| |
| // Configure the generating task of plugin-under-test-metadata.properties to |
| // include additional dependencies for the injected plugin classpath that |
| // are not present in the main runtime dependencies. This allows us to test |
| // the KAPT / KSP plugins while keeping a compileOnly dep on the main source. |
| tasks.withType(PluginUnderTestMetadata.class).named("pluginUnderTestMetadata").configure { |
| it.pluginClasspath.from(configurations.testPlugin) |
| } |
| |
| tasks.withType(Test).configureEach { test -> |
| test.javaLauncher = javaToolchains.launcherFor { |
| // Test on JDK 17 which supports lower versions of AGP. This can be removed |
| // once we move to AGP 8.2.1+ |
| languageVersion = JavaLanguageVersion.of(17) |
| } |
| // Configure publishing tasks to be dependencies of 'test' so those artifacts are available for |
| // the test project executed with Gradle Test Kit. |
| test.dependsOn( |
| ":annotation:annotation:publish", |
| ":collection:collection:publish", |
| ":annotation:annotation-experimental:publish", |
| ":collection:collection:publish", |
| ":room:room-common:publish", |
| ":room:room-runtime:publish", |
| ":room:room-migration:publish", |
| ":room:room-compiler:publish", |
| ":room:room-compiler-processing:publish", |
| ":room:room-external-antlr:publish", |
| ":sqlite:sqlite:publish", |
| ":sqlite:sqlite-framework:publish", |
| ) |
| } |
| |
| gradlePlugin { |
| plugins { |
| room { |
| id = "androidx.room" |
| implementationClass = "androidx.room.gradle.RoomGradlePlugin" |
| } |
| } |
| } |
| |
| androidx { |
| name = "Room Gradle Plugin" |
| type = LibraryType.GRADLE_PLUGIN |
| inceptionYear = "2023" |
| description = "Android Room Gradle Plugin" |
| } |