Files
df-research/dataframe/plugins/kotlin-dataframe/build.gradle.kts
2026-02-08 11:20:43 -10:00

122 lines
3.9 KiB
Kotlin
Vendored

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
id("java")
kotlin("jvm")
kotlin("plugin.serialization")
}
group = "org.jetbrains.kotlinx.dataframe"
val kotlinVersion: String by project.properties
repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
}
sourceSets {
main {
java.setSrcDirs(listOf("src"))
resources.setSrcDirs(listOf("resources"))
}
test {
java.setSrcDirs(listOf("tests", "tests-gen"))
resources.setSrcDirs(listOf("testResources"))
}
}
dependencies {
"org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion".let {
compileOnly(it)
testImplementation(it)
}
testRuntimeOnly("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
testRuntimeOnly("org.jetbrains.kotlin:kotlin-script-runtime:$kotlinVersion")
testRuntimeOnly("org.jetbrains.kotlin:kotlin-annotations-jvm:$kotlinVersion")
implementation(project(projects.dataframeCompilerPluginCore.path, "shadow"))
testRuntimeOnly(projects.core)
testRuntimeOnly(projects.dataframeCsv)
testImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
testImplementation("org.jetbrains.kotlin:kotlin-compiler-internal-test-framework:$kotlinVersion")
testImplementation(platform("org.junit:junit-bom:5.11.3"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.platform:junit-platform-commons")
testImplementation("org.junit.platform:junit-platform-launcher")
testImplementation("org.junit.platform:junit-platform-runner")
testImplementation("org.junit.platform:junit-platform-suite-api")
}
tasks.test {
useJUnitPlatform()
jvmArgs("-Xmx2G")
environment("TEST_RESOURCES", project.layout.projectDirectory)
doFirst {
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-stdlib", "kotlin-stdlib")
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-reflect", "kotlin-reflect")
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-test", "kotlin-test")
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-script-runtime", "kotlin-script-runtime")
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-annotations-jvm", "kotlin-annotations-jvm")
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
friendPaths.from(project(projects.core.path).projectDir)
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-receivers",
)
optIn.addAll(
"org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi",
)
}
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
tasks.compileKotlin {
compilerOptions {
languageVersion = KotlinVersion.KOTLIN_2_0
jvmTarget = JvmTarget.JVM_1_8
}
}
tasks.compileTestKotlin {
compilerOptions {
languageVersion = KotlinVersion.KOTLIN_2_0
jvmTarget = JvmTarget.JVM_1_8
}
}
tasks.register<JavaExec>("generateTests") {
classpath = sourceSets.test.get().runtimeClasspath
mainClass = "org.jetbrains.kotlin.fir.dataframe.GenerateTestsKt"
}
fun Test.setLibraryProperty(propName: String, jarName: String) {
val path = project.configurations
.testRuntimeClasspath.get()
.files
.find { """$jarName-\d.*jar""".toRegex().matches(it.name) }
?.absolutePath
?: return
systemProperty(propName, path)
}
// Disabling all tests before removing the compiler plugin here
// because we're moving to the Kotlin repo: #1290
tasks.filter {
":plugins:kotlin-dataframe" in it.path &&
"test" in it.name.lowercase()
}.forEach {
println("disabling compiler plugin test task: ${it.path}. See #1290")
it.onlyIf { false }
}