Skip to content

Commit 11ef4a6

Browse files
authored
Add a fallback for when project version is unspecified (#1536)
* Add a fallback for when project version is `unspecified` * Run PDEWelcomeTests headless
1 parent 7b8f4a2 commit 11ef4a6

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ dependencies {
140140
}
141141

142142
tasks.test {
143+
systemProperty("java.awt.headless", "true")
143144
useJUnitPlatform()
144145
workingDir = file("build/test")
145146
workingDir.mkdirs()

app/src/processing/app/ui/PDEWelcome.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import processing.app.*
3939
import processing.app.api.Contributions.ExamplesList.Companion.listAllExamples
4040
import processing.app.api.Sketch.Companion.Sketch
4141
import processing.app.ui.theme.*
42+
import java.awt.GraphicsEnvironment
4243
import java.io.File
4344
import kotlin.io.path.Path
4445
import kotlin.io.path.exists
@@ -554,10 +555,14 @@ fun Sketch.card(onOpen: () -> Unit = {}) {
554555
}
555556

556557
fun noBaseWarning() {
557-
Messages.showWarning(
558-
"No Base",
559-
"No Base instance provided, this ui is likely being previewed."
560-
)
558+
if (Base.isCommandLine() || GraphicsEnvironment.isHeadless()) {
559+
System.err.println("No Base instance provided, this ui is likely being previewed");
560+
} else {
561+
Messages.showWarning(
562+
"No Base",
563+
"No Base instance provided, this ui is likely being previewed."
564+
)
565+
}
561566
}
562567

563568
val size = DpSize(970.dp, 600.dp)

java/gradle/src/main/kotlin/ProcessingPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
2323
val processingVersion = project.findProperty("processing.version") as String?
2424
?: javaClass.classLoader.getResourceAsStream("version.properties")?.use { stream ->
2525
java.util.Properties().apply { load(stream) }.getProperty("version")
26-
} ?: "4.3.4"
26+
}?.takeIf { it != "unspecified" } ?: "4.5.5"
2727
val processingGroup = project.findProperty("processing.group") as String? ?: "org.processing"
2828
val workingDir = project.findProperty("processing.workingDir") as String?
2929
val debugPort = project.findProperty("processing.debugPort") as String?

0 commit comments

Comments
 (0)