99 lines
4.0 KiB
Kotlin
99 lines
4.0 KiB
Kotlin
import org.gradle.api.tasks.bundling.Compression
|
|
|
|
plugins {
|
|
java
|
|
jacoco
|
|
id("org.springframework.boot") version "4.0.9"
|
|
id("org.graalvm.buildtools.native") version "0.11.5"
|
|
}
|
|
|
|
group = "net.intrepid"
|
|
version = "0.1.0"
|
|
|
|
tasks.withType<Jar>().configureEach {
|
|
from("LICENSE") { into("META-INF") }
|
|
}
|
|
|
|
java { toolchain { languageVersion = JavaLanguageVersion.of(25) } }
|
|
repositories { mavenCentral() }
|
|
dependencies {
|
|
implementation(platform("org.springframework.boot:spring-boot-dependencies:4.0.9"))
|
|
implementation(platform("org.springframework.modulith:spring-modulith-bom:2.0.9"))
|
|
implementation("org.springframework.boot:spring-boot-starter")
|
|
implementation("org.springframework.modulith:spring-modulith-starter-core")
|
|
implementation("info.picocli:picocli:4.7.7")
|
|
annotationProcessor("info.picocli:picocli-codegen:4.7.7")
|
|
implementation("tools.jackson.dataformat:jackson-dataformat-yaml")
|
|
testImplementation("org.springframework.modulith:spring-modulith-starter-test") {
|
|
exclude(group = "org.junit.jupiter")
|
|
exclude(group = "org.junit.platform")
|
|
}
|
|
testImplementation(enforcedPlatform("org.junit:junit-bom:5.13.4"))
|
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
testImplementation("org.assertj:assertj-core")
|
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
}
|
|
tasks.withType<JavaCompile>().configureEach {
|
|
options.release = 25
|
|
options.compilerArgs.add("-parameters")
|
|
}
|
|
tasks.test {
|
|
useJUnitPlatform()
|
|
dependsOn(tasks.bootJar)
|
|
systemProperty("cli.jar", tasks.bootJar.get().archiveFile.get().asFile.absolutePath)
|
|
finalizedBy(tasks.jacocoTestReport)
|
|
}
|
|
jacoco { toolVersion = "0.8.14" }
|
|
tasks.jacocoTestReport {
|
|
// Ordering, not a success dependency: failed tests must still produce reports.
|
|
mustRunAfter(tasks.test)
|
|
reports {
|
|
xml.required.set(true)
|
|
xml.outputLocation.set(layout.buildDirectory.file("reports/jacoco/jacocoTestReport/jacocoTestReport.xml"))
|
|
html.required.set(true)
|
|
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco/jacocoTestReport/html"))
|
|
csv.required.set(false)
|
|
}
|
|
}
|
|
val jenkinsPipelineTest = tasks.register("jenkinsPipelineTest") {
|
|
group = "verification"
|
|
description = "Checks Jenkins publication behavior with a local Pipeline step fixture (no controller required)."
|
|
val fixture = layout.projectDirectory.file("scripts/test-jenkins-pipeline.groovy")
|
|
val pipeline = layout.projectDirectory.file("files/config/Jenkinsfile")
|
|
inputs.files(fixture, pipeline)
|
|
doLast { groovy.lang.GroovyShell().run(fixture.asFile, arrayOf(pipeline.asFile.absolutePath)) }
|
|
}
|
|
tasks.check { dependsOn(jenkinsPipelineTest) }
|
|
springBoot { mainClass = "net.intrepid.aiengineering.AiEngineeringApplication" }
|
|
graalvmNative {
|
|
binaries.named("main") {
|
|
imageName = "ai-engineering"
|
|
buildArgs.addAll("--no-fallback", "-O1")
|
|
}
|
|
}
|
|
val platformName = providers.gradleProperty("targetPlatform").orElse(
|
|
"${System.getProperty("os.name").lowercase().replace(" ", "-")}-${System.getProperty("os.arch")}")
|
|
tasks.register<Zip>("nativeDistZip") {
|
|
dependsOn("nativeCompile")
|
|
archiveBaseName = "ai-engineering"
|
|
archiveClassifier = platformName
|
|
destinationDirectory = layout.buildDirectory.dir("distributions")
|
|
from(layout.buildDirectory.dir("native/nativeCompile")) {
|
|
include("ai-engineering", "ai-engineering.exe")
|
|
filePermissions { unix("rwxr-xr-x") }
|
|
}
|
|
from("README.md", "LICENSE")
|
|
from("docs") { into("docs") }
|
|
}
|
|
tasks.register<Tar>("nativeDistTar") {
|
|
dependsOn("nativeCompile")
|
|
archiveBaseName = "ai-engineering"
|
|
archiveClassifier = platformName
|
|
archiveExtension = "tar.gz"
|
|
compression = Compression.GZIP
|
|
destinationDirectory = layout.buildDirectory.dir("distributions")
|
|
from(layout.buildDirectory.dir("native/nativeCompile")) { include("ai-engineering"); filePermissions { unix("rwxr-xr-x") } }
|
|
from("README.md", "LICENSE")
|
|
from("docs") { into("docs") }
|
|
}
|