| /* |
| * Copyright 2019 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 project contains tests for code contained in buildSrc |
| // This project is stored outside of buildSrc/ so that waiting for these tests to complete doesn't delay the rest of the build |
| |
| import androidx.build.LibraryType |
| import androidx.build.KotlinTarget |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("kotlin") |
| id("java-gradle-plugin") |
| } |
| |
| |
| // We need 'java-gradle-plugin' on classpath for Gradle test kit projects. If it's not, we get the following error: |
| // org.gradle.testkit.runner.InvalidPluginMetadataException: Test runtime classpath does not contain |
| // plugin metadata file 'plugin-under-test-metadata.properties'but if we generate a .jar |
| // |
| // However, if we actually run the :jar task for buildSrc-tests we get the following warning log: |
| // |
| // :buildSrc-tests:jar: No valid plugin descriptors were found in META-INF/gradle-plugins |
| // so we disable it. |
| |
| apply from: "../buildSrc/kotlin-dsl-dependency.gradle" |
| |
| sourceSets { |
| main.kotlin.srcDirs += [ |
| '../buildSrc/public/src/main/kotlin', |
| '../buildSrc/private/src/main/kotlin', |
| '../buildSrc/jetpad-integration/src/main/java' |
| ] |
| main.java.srcDirs += [ |
| '../buildSrc/jetpad-integration/src/main/java', |
| ] |
| main.resources.srcDirs += ['../buildSrc/private/src/main/resources'] |
| } |
| |
| apply from: "${buildscript.sourceFile.parentFile.parent}/buildSrc/shared-dependencies.gradle" |
| |
| dependencies { |
| api(libs.javaxInject) |
| api(libs.shadow) |
| api(libs.guavaAndroid) |
| api(libs.kotlinGradlePluginApi) |
| api(libs.kotlinNativeUtils) |
| api(libs.kotlinStdlib) |
| |
| implementation(project(":benchmark:benchmark-gradle-plugin")) |
| implementation(project(":inspection:inspection-gradle-plugin")) |
| implementation(project(":stableaidl:stableaidl-gradle-plugin")) |
| implementation(project(":binarycompatibilityvalidator:binarycompatibilityvalidator")) |
| implementation(project.ext.findGradleKotlinDsl()) |
| // Workaround for targeting KotlinTarget.KOTLIN_1_9, but linking agaist kotlin compiler |
| // embeddable 2.0 in buildSrc |
| implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${libs.versions.kotlin.get()}") |
| implementation(libs.kotlinGradlePluginAnnotations) |
| implementation(libs.kotlinToolingCore) |
| implementation(libs.binaryCompatibilityValidator) |
| implementation(libs.jetbrainsBinaryCompatibilityValidator) |
| implementation(libs.xmlApis) |
| |
| testImplementation(libs.checkmark) |
| testImplementation libs.hamcrestCore |
| testImplementation(libs.junit) |
| testImplementation(libs.truth) |
| testImplementation(project(":internal-testutils-gradle-plugin")) |
| testImplementation(project(":internal-testutils-truth")) |
| testImplementation(gradleTestKit()) |
| } |
| |
| tasks.withType(Test).configureEach { |
| // https://github.com/gradle/gradle/issues/22317 |
| it.jvmArgs = ["--add-opens=java.base/java.lang=ALL-UNNAMED"] |
| } |
| |
| androidx { |
| type = LibraryType.INTERNAL_GRADLE_PLUGIN |
| kotlinTarget = KotlinTarget.KOTLIN_1_9 |
| } |
| |
| // Also do style checking of the buildSrc project from within this project |
| // We run that from this project so that it doesn't block other projects while it runs |
| def ktfmtDir = file("../buildSrc") |
| def subdirs = ["plugins", "private", "public"] |
| |
| tasks["ktCheck"].configure({ t -> |
| t.overrideDirectory = ktfmtDir |
| t.overrideSubdirectories = subdirs |
| }) |
| tasks["ktFormat"].configure({ t -> |
| t.overrideDirectory = ktfmtDir |
| t.overrideSubdirectories = subdirs |
| }) |
| |