Files
prometeu-studio/prometeu-app/build.gradle.kts
T
bquarkz 1d8b8c2101
Test / Tests and coverage
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
feat(studio): integrate memcard persistence and headless controls
Persist cartridge identity and slot configuration, add MemcardBoot and the MemcardBuffer SDK, and consume the runtime's negotiated memcard host controls with protected teardown.

Qualify save/reopen and version upgrades through distinct configured runtime processes. Include specs, examples, regression evidence and the consolidated discussion lesson.
2026-10-30 11:01:02 +00:00

142 lines
6.7 KiB
Kotlin

plugins {
id("gradle.java-application-conventions")
alias(libs.plugins.javafx)
}
dependencies {
implementation(libs.tomlj)
implementation(project(":prometeu-infra"))
implementation(project(":prometeu-lsp:prometeu-lsp-api"))
implementation(project(":prometeu-lsp:prometeu-lsp-v1"))
implementation(project(":prometeu-compiler:prometeu-compiler-core"))
implementation(project(":prometeu-compiler:prometeu-build-pipeline"))
implementation(project(":prometeu-compiler:prometeu-frontend-registry"))
implementation(project(":prometeu-compiler:prometeu-deps"))
implementation(project(":prometeu-packer:prometeu-packer-api"))
implementation(project(":prometeu-packer:prometeu-packer-v1"))
implementation(project(":prometeu-studio-api"))
implementation(project(":prometeu-studio-core"))
implementation(project(":prometeu-studio-ui-javafx"))
implementation(libs.spring.boot)
implementation(libs.lsp4j)
implementation(libs.javafx.controls)
implementation(libs.javafx.fxml)
}
application {
mainClass = "p.studio.app.StudioLauncher"
}
val studioJava = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(21) }
val studioRuntime = layout.buildDirectory.dir("studio-runtime")
val assembleStudioRuntime by tasks.registering(Exec::class) {
val jdk = studioJava.get().metadata.installationPath.asFile
inputs.property("jdk", jdk.absolutePath)
outputs.dir(studioRuntime)
doFirst { delete(studioRuntime) }
// jlink license files can be read-only; Gradle Sync must be able to refresh the installed image.
doLast {
studioRuntime.get().asFile.walkTopDown().filter { it.isFile }.forEach {
check(it.setWritable(true, true)) { "Cannot normalize staged runtime permissions" }
}
}
commandLine(jdk.resolve("bin/jlink"), "--add-modules", "ALL-MODULE-PATH", "--strip-debug", "--no-header-files",
"--no-man-pages", "--output", studioRuntime.get().asFile)
}
distributions {
main { contents { from(assembleStudioRuntime) { into("runtime") } } }
}
tasks.register<JavaExec>("stageStudioInstallation") {
group = "application"
description = "Stages and validates the bundled Studio/Java installation; no project launcher is created."
dependsOn(tasks.named("installDist"))
classpath = sourceSets["main"].runtimeClasspath
mainClass = "p.studio.app.install.ManagedStudioInstallation"
args(layout.buildDirectory.dir("install/prometeu-app").get().asFile.absolutePath,
providers.gradleProperty("studioInstallationRoot").getOrElse(
"${System.getProperty("user.home")}/Library/Application Support/Prometeu/Studio"))
}
javafx {
version = libs.versions.javafx.get()
modules("javafx.controls", "javafx.fxml")
}
// Opt-in desktop gate: real JavaFX toolkit and windows, no display required by normal unit tests.
tasks.named<Test>("test") { exclude("**/DevDesktopTest.class", "**/InstalledKnowledgeTest.class", "**/HeadlessInstalledRuntimeTest.class", "**/HeadlessTaskIntegrationTest.class", "**/HeadlessMcpDesktopTest.class", "**/MemcardInstalledRuntimeTest.class") }
tasks.register<Test>("devDesktopTest") {
group = "verification"
description = "Runs the DEV/Debug desktop lifecycle and handoff smoke tests (requires a display)."
testClassesDirs = sourceSets["test"].output.classesDirs
classpath = sourceSets["test"].runtimeClasspath
useJUnitPlatform()
include("**/DevDesktopTest.class")
systemProperty("java.awt.headless", "false")
}
tasks.register<Test>("installedKnowledgeTest") {
group = "verification"
description = "Reads installed references and compiles their example in an isolated JVM outside the checkout."
dependsOn(tasks.named("installDist"))
testClassesDirs = sourceSets["test"].output.classesDirs
classpath = sourceSets["test"].runtimeClasspath
useJUnitPlatform()
include("**/InstalledKnowledgeTest.class")
val distribution = layout.buildDirectory.dir("install/prometeu-app")
inputs.dir(distribution)
systemProperty("studio.test.distribution", distribution.get().asFile.absolutePath)
systemProperty("pbs.registryConformanceDirectory",
project(":prometeu-compiler:prometeu-build-pipeline").layout.buildDirectory.dir("registry-conformance").get().asFile.absolutePath)
}
tasks.register<Test>("headlessProcessTest") {
group = "verification"
description = "Exercises the configured packaged headless runtime (requires -PstudioRuntimeInstall)."
testClassesDirs = sourceSets["test"].output.classesDirs
classpath = sourceSets["test"].runtimeClasspath
useJUnitPlatform()
include("**/HeadlessInstalledRuntimeTest.class")
include("**/HeadlessTaskIntegrationTest.class")
systemProperty("studio.test.runtimeInstall", providers.gradleProperty("studioRuntimeInstall").getOrElse(""))
}
tasks.register<Test>("memcardProcessTest") {
group = "verification"
description = "Qualifies PBS memcard save/reopen/version upgrade through the configured runtime installation."
testClassesDirs = sourceSets["test"].output.classesDirs
classpath = sourceSets["test"].runtimeClasspath
useJUnitPlatform()
include("**/MemcardInstalledRuntimeTest.class")
outputs.upToDateWhen { false }
testLogging.showStandardStreams = true
systemProperty("studio.test.runtimeInstall", providers.gradleProperty("studioRuntimeInstall").getOrElse(""))
}
tasks.register<Test>("headlessMcpDesktopTest") {
group = "verification"
description = "Proves MCP/runtime/DEV parity and adversarial lifecycle (requires POSIX desktop, free Debug port 7777 and -PstudioRuntimeInstall)."
testClassesDirs = sourceSets["test"].output.classesDirs
classpath = sourceSets["test"].runtimeClasspath
useJUnitPlatform()
include("**/HeadlessMcpDesktopTest.class")
systemProperty("java.awt.headless", "false")
systemProperty("studio.test.runtimeInstall", providers.gradleProperty("studioRuntimeInstall").getOrElse(""))
}
// Subprocess tests exercise the actual Studio main and OS ownership boundaries.
tasks.withType<Test>().configureEach {
systemProperty("studio.test.classpath", sourceSets["test"].runtimeClasspath.asPath)
}
tasks.named<Test>("test") { exclude("**/InstalledConnectorTest.class") }
tasks.register<Test>("installedConnectorTest") {
group = "verification"
description = "Validates installed Java, stable updates, project preparation and JavaFX startup (requires a display)."
dependsOn(tasks.named("installDist"))
testClassesDirs = sourceSets["test"].output.classesDirs
classpath = sourceSets["test"].runtimeClasspath
useJUnitPlatform()
include("**/InstalledConnectorTest.class")
systemProperty("studio.test.distribution", layout.buildDirectory.dir("install/prometeu-app").get().asFile.absolutePath)
}