blob: c526eb8d49ab67ea3810c0784f8460f0e92593d1 [file] [log] [blame] [edit]
import com.google.devtools.ksp.RelativizingInternalPathProvider
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import kotlin.math.max
val junitVersion: String by project
val kotlinBaseVersion: String by project
val kotlinxSerializationVersion: String by project
val agpBaseVersion: String by project
val aaCoroutinesVersion: String by project
plugins {
kotlin("jvm")
}
repositories {
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}
dependencies {
testImplementation("junit:junit:$junitVersion")
testImplementation(gradleTestKit())
testImplementation(project(":api"))
testImplementation(project(":gradle-plugin"))
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxSerializationVersion")
testImplementation("com.intellij.platform:kotlinx-coroutines-core-jvm:$aaCoroutinesVersion")
}
fun Test.configureCommonSettings() {
systemProperty("kotlinVersion", kotlinBaseVersion)
systemProperty("kspVersion", version)
systemProperty("agpVersion", agpBaseVersion)
jvmArgumentProviders.add(
RelativizingInternalPathProvider(
"testRepo",
rootProject.layout.buildDirectory.dir("repos/test").get().asFile
)
)
dependsOn(":api:publishAllPublicationsToTestRepository")
dependsOn(":gradle-plugin:publishAllPublicationsToTestRepository")
dependsOn(":common-deps:publishAllPublicationsToTestRepository")
dependsOn(":symbol-processing:publishAllPublicationsToTestRepository")
dependsOn(":symbol-processing-aa-embeddable:publishAllPublicationsToTestRepository")
}
// Create a new test task for the AGP compatibility tests
val agpCompatibilityTest by tasks.registering(Test::class) {
description = "Runs AGP compatibility tests with maxParallelForks = 1"
group = "verification"
// Include only the AGP compatibility tests
include("**/AGPVersionIT.class")
include("**/AGPVersionBuiltInKotlinIT.class")
// Set maxParallelForks to 1 to avoid race conditions when downloading SDKs with old AGPs
maxParallelForks = 1
testClassesDirs = sourceSets["test"].output.classesDirs
classpath = sourceSets["test"].runtimeClasspath
// Apply common settings
configureCommonSettings()
}
tasks.test {
maxParallelForks = max(1, Runtime.getRuntime().availableProcessors() / 2)
// Exclude test classes from agpCompatibilityTest
exclude("**/AGPVersionIT.class")
exclude("**/AGPVersionBuiltInKotlinIT.class")
// Apply common settings
configureCommonSettings()
// Ensure that 'test' runs after 'compatibilityTest'
mustRunAfter(agpCompatibilityTest)
}
tasks.check {
dependsOn(agpCompatibilityTest)
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}