Compare commits

2 Commits

Author SHA1 Message Date
Abe Pazos
34d0087cc3 make jpackageZip work on Linux
Note: using @incubating useFileSystemPermissions()

Note: type = ImageType.DEFAULT not working on Linux, using APP_IMAGE, even if it creates a zip file (?)
2025-08-01 15:06:32 +02:00
Abe Pazos
4ace0c4512 Wip upgrade gradle, kotlinLogging, shadow, jpackage
gradle 9.0.0
kotlinLogging 7.0.10
shadow 8.3.8
jpackage 1.7.3
2025-08-01 10:32:37 +02:00
4 changed files with 85 additions and 48 deletions

View File

@@ -7,20 +7,13 @@ go-to starting point for writing OPENRNDR-based software.
If you are looking at this from IntelliJ IDEA you can start by expanding the _project_ tab on the left. You will find a template program in `src/main/kotlin/TemplateProgram.kt` and a live-coding example in `src/main/kotlin/TemplateLiveProgram.kt`.
You will find some [basic instructions](https://guide.openrndr.org/setUpYourFirstProgram.html) in the [OPENRNDR guide](https://guide.openrndr.org).
You will find some [basic instructions](https://guide.openrndr.org/setUpYourFirstProgram.html) in the [OPENRNDR guide](https://guide.openrndr.org)
## Gradle tasks
- `./gradlew run` runs `TemplateProgram.kt` (Use `gradlew.bat run` under Windows)
- `./gradlew run -Popenrndr.application=MyProgramKt` runs `src/main/kotlin/myProgram.kt`
- `./gradlew run -Popenrndr.application=foo.bar.MyProgramKt` runs `src/main/kotlin/foo/bar/myProgram.kt` (assuming `package foo.bar` is used in myProgram.kt)
- `./gradlew run` runs the TemplateProgram (Use `gradlew.bat run` under Windows)
- `./gradlew shadowJar` creates an executable platform specific jar file with all dependencies. Run the resulting program by typing `java -jar build/libs/openrndr-template-1.0.0-all.jar` in a terminal from the project root. If your project contains multiple `main` methods, specify which one to run with `java -cp build/libs/openrndr-template-1.0.0-all.jar MyProgramKt`, where `MyProgramKt` can also be `foo.bar.MyProgramKt` if it's in the package `foo.bar`.
- `./gradlew jpackageZip` creates a zip with a stand-alone executable for the current platform (requires Java 17 or newer). Run it like this: `cd build/jpackage/openrndr-application/ && bin/openrndr-application`.
- `./gradlew dependencyUpydates` checks whether any dependencies have newer versions.
## Tips and issues
See the [wiki](https://github.com/openrndr/openrndr-template/wiki)
- `./gradlew jpackageZip` creates a zip with a stand-alone executable for the current platform (works with Java 14 only). Run it like this: `cd build/jpackage/openrndr-application/ && bin/openrndr-application`.
## Cross builds
@@ -33,10 +26,10 @@ provides the optional [orsl](https://github.com/openrndr/orsl/) shader helper mo
The version numbers of these dependencies are specified in your [libs.versions.toml](gradle/libs.versions.toml) file.
Learn more about this file in the [Gradle documentation](https://docs.gradle.org/current/userguide/platforms.html#sub:conventional-dependencies-toml) website.
Newer versions bring useful features and bug fixes. The most recent versions are<br>
![Maven Central Version](https://img.shields.io/maven-central/v/org.openrndr/openrndr-math-jvm?label=OPENRNDR&color=%23FFC0CB)
![Maven Central Version](https://img.shields.io/maven-central/v/org.openrndr.extra/orx-noise-jvm?label=ORX&color=%23FFC0CB)
![Maven Central Version](https://img.shields.io/maven-central/v/org.openrndr.orsl/orsl-shader-generator-jvm?label=ORSL&color=%23FFC0CB).
Newer versions bring useful features and bug fixes. The most recent versions are
<br>![openrndr version](https://maven-badges.herokuapp.com/maven-central/org.openrndr/openrndr-application/badge.svg) for OPENRNDR.
<br>![orx version](https://maven-badges.herokuapp.com/maven-central/org.openrndr.extra/orx-parameters-jvm/badge.svg) for ORX.
<br>![orsl version](https://maven-badges.herokuapp.com/maven-central/org.openrndr.orsl/orsl-shader-generator-jvm/badge.svg) for ORSL.
Switch to the [next-version branch](https://github.com/openrndr/openrndr-template/tree/next-version) or enter these versions manually in your toml file.
They can look like "0.4.3" or "0.4.3-alpha4". Use the complete string, as in:
@@ -49,6 +42,18 @@ You can add other dependencies needed by your project to your [build.gradle.kts]
⚠️ Remember to reload the Gradle configuration after changing any dependencies.
## Run other Kotlin programs from the command line
By default `./gradlew run` runs a program called `TemplateProgram.kt` but a different one can be provided as an argument:
To run `src/main/kotlin/myProgram.kt`
./gradlew run -Popenrndr.application=MyProgramKt
To run `src/main/kotlin/foo/bar/myProgram.kt` (assuming `package foo.bar` in myProgram.kt)
./gradlew run -Popenrndr.application=foo.bar.MyProgramKt
## Github Actions
This repository contains various Github Actions under `./github/workflows`:

View File

@@ -3,6 +3,7 @@ import org.gradle.internal.os.OperatingSystem
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.panteleyev.jpackage.ImageType
group = "org.openrndr.template"
version = "1.0.0"
@@ -11,12 +12,11 @@ val applicationMainClass = "TemplateProgramKt"
/** ## additional ORX features to be added to this project */
val orxFeatures = setOf<String>(
// "orx-axidraw",
// "orx-boofcv",
"orx-camera",
// "orx-chataigne",
"orx-color",
"orx-composition",
// "orx-composition",
"orx-compositor",
// "orx-compute-graph",
// "orx-compute-graph-nodes",
@@ -63,11 +63,11 @@ val orxFeatures = setOf<String>(
"orx-shade-styles",
// "orx-shader-phrases",
"orx-shapes",
"orx-svg",
// "orx-svg",
// "orx-syphon",
// "orx-temporal-blur",
// "orx-tensorflow",
"orx-text-writer",
// "orx-text-writer",
// "orx-time-operators",
// "orx-timer",
// "orx-triangulation",
@@ -104,9 +104,10 @@ val applicationLogging = Logging.FULL
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
java
application
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.shadow)
alias(libs.plugins.runtime)
alias(libs.plugins.jpackage)
alias(libs.plugins.gitarchive.tomarkdown).apply(false)
alias(libs.plugins.versions)
alias(libs.plugins.kotlin.serialization)
@@ -140,8 +141,14 @@ dependencies {
implementation(libs.kotlin.logging)
when (applicationLogging) {
Logging.NONE -> runtimeOnly(libs.slf4j.nop)
Logging.SIMPLE -> runtimeOnly(libs.slf4j.simple)
Logging.NONE -> {
runtimeOnly(libs.slf4j.nop)
}
Logging.SIMPLE -> {
runtimeOnly(libs.slf4j.simple)
}
Logging.FULL -> {
runtimeOnly(libs.log4j.slf4j2)
runtimeOnly(libs.log4j.core)
@@ -197,12 +204,12 @@ tasks {
// ------------------------------------------------------------------------------------------------------------------ //
tasks {
named<org.beryx.runtime.JPackageTask>("jpackage") {
named("jpackage") {
doLast {
val destPath = if (OperatingSystem.current().isMacOsX)
"build/jpackage/openrndr-application.app/Contents/Resources/data"
val destPath = "build/jpackage/" + if (OperatingSystem.current().isMacOsX)
"openrndr-application.app/Contents/Resources/data"
else
"build/jpackage/openrndr-application/data"
"openrndr-application/data"
copy {
from("data") { include("**/*") }
@@ -216,29 +223,52 @@ tasks {
from("${layout.buildDirectory.get()}/jpackage") {
include("**/*")
}
isPreserveFileTimestamps = true
isReproducibleFileOrder = true
useFileSystemPermissions()
dependsOn("jpackage")
}
}
runtime {
jpackage {
imageName = "openrndr-application"
skipInstaller = true
if (OperatingSystem.current().isMacOsX) {
jvmArgs.add("-XstartOnFirstThread")
jvmArgs.add("-Duser.dir=${"$"}APPDIR/../Resources")
}
// ------------------------------------------------------------------------------------------------------------------ //
tasks.register("copyDependencies", Copy::class) {
from(configurations.runtimeClasspath).into(layout.buildDirectory.dir("jars"))
}
tasks.register("copyJar", Copy::class) {
from(tasks.jar).into(layout.buildDirectory.dir("jars"))
}
tasks.jpackage {
dependsOn("build", "copyDependencies", "copyJar")
appName = "openrndr-application"
mac {
javaOptions = listOf(
"-XstartOnFirstThread",
$$"-Duser.dir=$APPDIR/../Resources"
)
}
options = listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages")
modules = listOf("jdk.unsupported", "java.management", "java.desktop")
windows {
}
linux {
type = ImageType.APP_IMAGE
}
input = layout.buildDirectory.dir("jars")
destination = layout.buildDirectory.dir("jpackage")
mainJar = tasks.jar.get().archiveFileName.get()
mainClass = applicationMainClass
addModules = listOf("jdk.unsupported", "java.management", "java.desktop")
jLinkOptions = listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages")
}
// ------------------------------------------------------------------------------------------------------------------ //
tasks {
register<org.openrndr.extra.gitarchiver.GitArchiveToMarkdown>("gitArchiveToMarkDown") {
historySize = 20
}
tasks.register<org.openrndr.extra.gitarchiver.GitArchiveToMarkdown>("gitArchiveToMarkDown") {
historySize = 20
}
// ------------------------------------------------------------------------------------------------------------------ //
@@ -249,7 +279,9 @@ tasks {
val nonStableKeywords = listOf("alpha", "beta", "rc")
fun isNonStable(version: String) = nonStableKeywords.any {
fun isNonStable(
version: String
) = nonStableKeywords.any {
version.lowercase().contains(it)
}

View File

@@ -1,7 +1,7 @@
[versions]
kotlin = "2.2.10"
openrndr = "0.4.5"
orx = "0.4.5"
kotlin = "2.2.0"
openrndr = "0.4.5-alpha9"
orx = "0.4.5-alpha9"
orsl = "0.4.5-alpha5"
orml = "0.4.1"
slf4j = "2.0.17"
@@ -10,11 +10,11 @@ jackson = "2.17.2"
junit = "4.13.2"
kotlinxCoroutines = "1.10.2"
kotlinxSerialization = "1.9.0"
kotlinLogging = "7.0.13"
kotlinLogging = "7.0.10"
kotlinCsvJvm = "1.9.3"
jsoup = "1.17.1"
shadow = "9.1.0"
runtime = "1.13.1"
shadow = "8.3.8"
jpackage = "1.7.3"
versions = "0.52.0"
[libraries]
@@ -49,6 +49,6 @@ csv = { group = "com.github.doyaaaaaken", name = "kotlin-csv-jvm", version.ref =
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
runtime = { id = "org.beryx.runtime", version.ref = "runtime" }
jpackage = { id = "org.panteleyev.jpackageplugin", version.ref = "jpackage"}
gitarchive-tomarkdown = { id = "org.openrndr.extra.gitarchiver.tomarkdown", version.ref = "orx" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME