[go: nahoru, domu]

blob: 81ab23a25cd3d71d075a4ea305047917976677e0 [file] [log] [blame]
/*
* 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.BuildServerConfigurationKt
import androidx.build.LibraryType
import androidx.build.SdkResourceGenerator
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.
jar.enabled = false
apply from: "../buildSrc/kotlin-dsl-dependency.gradle"
def buildSrcJar(jarName) {
return project.files(
new File(
BuildServerConfigurationKt.getRootOutDirectory(project),
"buildSrc/$jarName/build/libs/${jarName}.jar"
)
)
}
dependencies {
implementation(findGradleKotlinDsl())
implementation(gradleApi())
implementation(libs.androidGradlePluginz)
implementation(buildSrcJar("private"))
implementation(buildSrcJar("public"))
implementation(buildSrcJar("jetpad-integration"))
implementation("com.googlecode.json-simple:json-simple:1.1")
implementation(libs.gson)
implementation(libs.dom4j) {
// Optional dependency where Ivy fails to parse the POM file.
exclude(group:"net.java.dev.msv", module:"xsdlib")
}
// Required for dom4j to parse comments correctly.
implementation(libs.xerces)
implementation(libs.kotlinGradlePluginz)
testImplementation(libs.junit)
testImplementation(libs.truth)
testImplementation(project(":internal-testutils-gradle-plugin"))
testImplementation(project(":internal-testutils-truth"))
testImplementation(gradleTestKit())
testImplementation(libs.checkmark)
testImplementation(libs.toml)
}
SdkResourceGenerator.generateForHostTest(project)
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_HOST_TEST_LIBRARY
}
// 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 ktlintDir = file("../buildSrc")
def subdirs = ["plugins", "private", "public"]
tasks["ktlint"].configure({ t ->
t.overrideDirectory = ktlintDir
t.overrideSubdirectories = subdirs
})
tasks["ktlintFormat"].configure({ t ->
t.overrideDirectory = ktlintDir
t.overrideSubdirectories = subdirs
})
// Broken in AGP 7.0-alpha15 due to b/180408027
tasks["lint"].configure { t ->
t.enabled = false
}