Files
planterette/cmd/plt-build/build.gradle.kts
2025-11-16 20:34:38 -06:00

52 lines
1.6 KiB
Kotlin

plugins {
kotlin("jvm") version "2.2.10"
kotlin("plugin.serialization") version "2.2.20"
}
group = "moe.rosa"
version = "0.1.0"
repositories {
mavenCentral()
}
val kotlinVersion = "2.2.10"
val kotlinCoroutinesVersion = "1.7.0-RC"
dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0")
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlin:kotlin-scripting-common:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-scripting-dependencies:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-scripting-dependencies-maven:${kotlinVersion}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${kotlinCoroutinesVersion}")
}
sourceSets.main {
resources {
srcDirs("src/main/resources", "build/natives")
}
}
kotlin {
jvmToolchain(24)
}
tasks.test {
useJUnitPlatform()
}
tasks.register<Exec>("compileNativeLib") {
val java_home = System.getProperty("java.home")
environment("CGO_CFLAGS" to "-I$java_home/include -I$java_home/include/linux")
workingDir("src/main/go")
commandLine("go", "build", "-linkshared", "-buildmode=c-shared", "-o", layout.buildDirectory.get().dir("natives").file("pltbuild.so"))
}
tasks.processResources {
dependsOn += "compileNativeLib"
}