feat: adopt local SQLite engineering memory and quality gates
This commit is contained in:
+68
-12
@@ -24,6 +24,7 @@ dependencies {
|
||||
implementation("info.picocli:picocli:4.7.7")
|
||||
annotationProcessor("info.picocli:picocli-codegen:4.7.7")
|
||||
implementation("tools.jackson.dataformat:jackson-dataformat-yaml")
|
||||
implementation("org.xerial:sqlite-jdbc:3.54.1.0")
|
||||
testImplementation("org.springframework.modulith:spring-modulith-starter-test") {
|
||||
exclude(group = "org.junit.jupiter")
|
||||
exclude(group = "org.junit.platform")
|
||||
@@ -39,6 +40,7 @@ tasks.withType<JavaCompile>().configureEach {
|
||||
}
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
jvmArgs("--enable-native-access=ALL-UNNAMED")
|
||||
dependsOn(tasks.bootJar)
|
||||
systemProperty("cli.jar", tasks.bootJar.get().archiveFile.get().asFile.absolutePath)
|
||||
finalizedBy(tasks.jacocoTestReport)
|
||||
@@ -65,34 +67,88 @@ val jenkinsPipelineTest = tasks.register("jenkinsPipelineTest") {
|
||||
}
|
||||
tasks.check { dependsOn(jenkinsPipelineTest) }
|
||||
springBoot { mainClass = "net.intrepid.aiengineering.AiEngineeringApplication" }
|
||||
val sqliteProbe = sourceSets.create("sqliteProbe")
|
||||
sqliteProbe.compileClasspath += sourceSets.main.get().output
|
||||
sqliteProbe.runtimeClasspath += sourceSets.main.get().output
|
||||
configurations[sqliteProbe.implementationConfigurationName].extendsFrom(configurations.implementation.get())
|
||||
configurations[sqliteProbe.runtimeOnlyConfigurationName].extendsFrom(configurations.runtimeOnly.get())
|
||||
tasks.register<JavaExec>("sqliteProbe") {
|
||||
group = "verification"
|
||||
description = "Exercise SQLite in a separate JVM against an explicitly supplied disposable database."
|
||||
classpath = sqliteProbe.runtimeClasspath
|
||||
mainClass.set("net.intrepid.aiengineering.probe.SqliteProbe")
|
||||
jvmArgs("--enable-native-access=ALL-UNNAMED")
|
||||
if (providers.gradleProperty("probeDatabase").isPresent) {
|
||||
args(providers.gradleProperty("probeDatabase").get())
|
||||
}
|
||||
}
|
||||
graalvmNative {
|
||||
binaries.named("main") {
|
||||
imageName = "ai-engineering"
|
||||
buildArgs.addAll("--no-fallback", "-O1")
|
||||
javaLauncher.set(javaToolchains.launcherFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(25))
|
||||
vendor.set(JvmVendorSpec.matching("GraalVM"))
|
||||
})
|
||||
buildArgs.addAll("--no-fallback", "-O1", "--enable-native-access=ALL-UNNAMED",
|
||||
"-Dorg.sqlite.lib.exportPath=${layout.buildDirectory.dir("native/nativeCompile").get().asFile}")
|
||||
}
|
||||
binaries.create("sqliteProbe") {
|
||||
imageName.set("aie-sqlite-probe")
|
||||
mainClass.set("net.intrepid.aiengineering.probe.SqliteProbe")
|
||||
javaLauncher.set(javaToolchains.launcherFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(25))
|
||||
vendor.set(JvmVendorSpec.matching("GraalVM"))
|
||||
})
|
||||
classpath.from(sqliteProbe.runtimeClasspath)
|
||||
classpath.from(files(layout.buildDirectory.dir("generated/aotResources")).builtBy(tasks.named("processAot")))
|
||||
buildArgs.addAll("--no-fallback", "-O1",
|
||||
"--enable-native-access=ALL-UNNAMED",
|
||||
"-Dorg.sqlite.lib.exportPath=${layout.buildDirectory.dir("native/nativeSqliteProbeCompile").get().asFile}")
|
||||
}
|
||||
}
|
||||
tasks.named("nativeSqliteProbeCompile") { dependsOn(tasks.named("processAot")) }
|
||||
val platformName = providers.gradleProperty("targetPlatform").orElse(
|
||||
"${System.getProperty("os.name").lowercase().replace(" ", "-")}-${System.getProperty("os.arch")}")
|
||||
val sqliteCliName = if (System.getProperty("os.name").startsWith("Windows")) "sqlite3.exe" else "sqlite3"
|
||||
val sqliteCli = tasks.register<Exec>("sqliteCli") {
|
||||
group = "build"
|
||||
description = "Build the pinned SQLite diagnostic CLI into build/ without installing it."
|
||||
inputs.files("scripts/build-sqlite-cli.py", "scripts/sqlite-version.json")
|
||||
outputs.file(layout.buildDirectory.file("sqlite-cli/$sqliteCliName"))
|
||||
commandLine("python3", "scripts/build-sqlite-cli.py", layout.buildDirectory.dir("sqlite-cli").get().asFile.absolutePath)
|
||||
}
|
||||
val nativePackage = tasks.register<Sync>("nativePackage") {
|
||||
group = "distribution"
|
||||
description = "Prepare native AIE, companion libraries and sqlite3 together; no installation."
|
||||
dependsOn("nativeCompile", sqliteCli)
|
||||
inputs.file("scripts/native-package-manifest.py")
|
||||
into(layout.buildDirectory.dir("native/package"))
|
||||
from(layout.buildDirectory.dir("native/nativeCompile")) { include("ai-engineering", "ai-engineering.exe", "*.dylib", "*.so", "*.dll") }
|
||||
from(layout.buildDirectory.file("sqlite-cli/$sqliteCliName"))
|
||||
from("README.md", "LICENSE")
|
||||
from("docs") { into("docs") }
|
||||
filePermissions { unix("rwxr-xr-x") }
|
||||
doLast {
|
||||
providers.exec {
|
||||
commandLine("python3", "scripts/native-package-manifest.py", layout.buildDirectory.dir("native/package").get().asFile.absolutePath)
|
||||
}.result.get().assertNormalExitValue()
|
||||
}
|
||||
}
|
||||
tasks.register<Zip>("nativeDistZip") {
|
||||
dependsOn("nativeCompile")
|
||||
dependsOn(nativePackage)
|
||||
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") }
|
||||
from(layout.buildDirectory.dir("native/package"))
|
||||
filePermissions { unix("rwxr-xr-x") }
|
||||
}
|
||||
tasks.register<Tar>("nativeDistTar") {
|
||||
dependsOn("nativeCompile")
|
||||
dependsOn(nativePackage)
|
||||
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") }
|
||||
from(layout.buildDirectory.dir("native/package"))
|
||||
filePermissions { unix("rwxr-xr-x") }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user