Compare commits

29 Commits

Author SHA1 Message Date
Abe Pazos
6140930461 Update to Gradle 9.5.1 2026-05-24 11:02:32 +02:00
Abe Pazos
746c9fb5f8 Update to slf4j 2.0.18 and kotlinLogging 8.0.03 2026-05-24 11:02:03 +02:00
Abe Pazos
d8276c3135 Update dependencies
kotlinxCoroutines 1.11.0
kotlinLogging 8.0.02
versions 0.54.0
2026-05-09 23:26:22 +03:00
Abe Pazos
30a19f9a41 Update to kotlin 2.3.21, kotlinxSerialization 1.11.0 2026-05-02 16:11:16 +03:00
Abe Pazos
1e27e93968 Upgrade to Gradle 9.5.0 2026-04-28 16:21:22 +02:00
Abe Pazos
bb41fe62ac Update to openrndr and orx 0.5.0-alpha4 2026-04-22 09:31:15 +02:00
Abe Pazos
c79d274c38 Bring .github workflow changes from snapshot branch 2026-03-23 15:24:34 +01:00
Abe Pazos
4c59139b05 Switch default from glfw to sdl 2026-03-23 15:14:48 +01:00
Abe Pazos
5d800bd09c Add sdl dependency
Copy build.gradle.kts  from the snapshot branch
2026-03-23 15:09:03 +01:00
Abe Pazos
1126db6bfa Upgrade dependencies
- Gradle 9.4.1
- kotlin 2.3.20
- shadow 9.4.0
- kotlinLogging 8.0.01
- Fix logging typo
2026-03-23 15:06:29 +01:00
Abe Pazos
8390a7ea75 Update to openrndr and orx 0.5.0-alpha3 2026-03-23 15:04:53 +01:00
Abe Pazos
c88b4e3134 Upgrade to gradle 9.3.1 2026-02-11 10:31:24 +01:00
Abe Pazos
208424bcdb Upgrade kotlin and kotlinxSerialization
- kotlin 2.3.10
- kotlinxSerialization 1.10.0
2026-02-11 10:30:18 +01:00
Abe Pazos
ceccea9b58 Use java-version 21 in build-on-commit.yaml
Matching the snapshot version
2026-02-11 10:29:27 +01:00
Abe Pazos
21cef80b9c Upgrade to gradle 9.3.0, kotlinLogging 7.0.14 2026-01-21 13:45:46 +01:00
Abe Pazos
af4068bb8b jpackageZip: Make files under bin executable 2026-01-21 13:44:39 +01:00
Abe Pazos
22de6dfd58 Add openrndr.openal to build.gradle.kts
Needed for webcam access and more
2025-12-31 10:20:25 +01:00
Abe Pazos
98ea2de9ee Solve gradle warnings
`--compress 1` becomes `--compress zip-6`

Use $$ instead of ${"$"}
2025-12-20 20:06:33 +01:00
Abe Pazos
2635231b25 Upgrade to kotlin 2.3.0, shadow 9.3.0, versions 0.53.0 2025-12-20 20:05:44 +01:00
Abe Pazos
e582b896a0 Fix jpackageZip task compatibility issue 2025-12-20 20:05:01 +01:00
Abe Pazos
17782d1773 Update GitHub workflows 2025-12-09 13:59:44 +01:00
Abe Pazos
00a3c08161 Fix shadowJar task
By not discarding openrndr-application-glfw when minimizing
2025-11-30 10:28:39 +01:00
Abe Pazos
224f488da8 Update to Gradle 9.2.1 2025-11-30 10:23:43 +01:00
Edwin Jakobs
edb8104388 Update to OPENRNDR 0.5.0-alpha2 2025-11-13 12:23:34 +01:00
Edwin Jakobs
18ba01caa5 Use openrndr / orx 0.5.0-alpha1 2025-09-17 14:16:23 +02:00
Edwin Jakobs
4bdb7f95d7 Refactor template using buildSrc, feature variants and published version catalogs (#56)
Co-authored-by: Abe Pazos <abe@hamoid.com>
2025-09-17 10:36:48 +02:00
Abe Pazos
e97ef57b78 Update README.md: change Java requirement 14 -> 17 2025-09-13 19:46:41 +02:00
Abe Pazos
2e760f9c53 Add link to wiki 2025-09-11 13:11:13 +02:00
Abe Pazos
b4242bc892 Upgrade to Kotlin 2.2.20 2025-09-11 11:49:41 +02:00
18 changed files with 449 additions and 417 deletions

View File

@@ -8,14 +8,16 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: temurin
java-version: '17' java-version: 21
#cache: 'gradle' #cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Build sources - name: Build sources
run: ./gradlew build run: ./gradlew build

View File

@@ -0,0 +1,63 @@
name: Build snapshot on commit
on:
push:
branches:
- snapshot
defaults:
run:
working-directory: ./template
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout OPENRNDR repository
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: openrndr/openrndr
path: ./openrndr
ref: master
- name: Checkout ORX repository
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: openrndr/orx
path: ./orx
ref: master
- name: Checkout current repository
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: openrndr/openrndr-template
path: ./template
ref: snapshot
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Set swap space
uses: pierotofy/set-swap-space@v1.0
with:
swap-size-gb: 8
- name: Build OPENRNDR
working-directory: ./openrndr
run: ./gradlew publishToMavenLocal snapshot
- name: Build ORX
working-directory: ./orx
run: ./gradlew publishToMavenLocal snapshot
- name: Build template
working-directory: ./template
run: ./gradlew build

View File

@@ -23,10 +23,10 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v4 uses: actions/setup-java@v7
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '17' java-version: '17'
@@ -48,7 +48,7 @@ jobs:
run: mv ./build/distributions/openrndr-application.zip ./build/distributions/openrndr-application-${{env.OR_TARGET_NAME}}.zip run: mv ./build/distributions/openrndr-application.zip ./build/distributions/openrndr-application-${{env.OR_TARGET_NAME}}.zip
- name: Create Release - name: Create Release
uses: ncipollo/release-action@v1.14.0 uses: ncipollo/release-action@v1.20.0
id: create_release id: create_release
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -24,7 +24,7 @@ See the [wiki](https://github.com/openrndr/openrndr-template/wiki)
## Cross builds ## Cross builds
To create a runnable jar for a platform different from your current platform, use `./gradlew jar -PtargetPlatform=<platform>`, where `<platform>` is either `windows`, `macos`, `linux-x64`, or `linux-arm64`. See the [wiki](https://github.com/openrndr/openrndr-template/wiki)
## Updating OPENRNDR, ORX and other dependencies ## Updating OPENRNDR, ORX and other dependencies
@@ -64,3 +64,10 @@ any time a commit is tagged with a version number like `v1.*`. For example, we c
``` ```
You can follow the progress of the action under the Actions tab in GitHub. Once complete, the executables will appear under the Releases section. You can follow the progress of the action under the Actions tab in GitHub. Once complete, the executables will appear under the Releases section.
## Building libraries
This template can be used to create a library with your classes and extensions and reuse them across projects or share them with other people.
To publish the project as a library, open [build.gradle.kts](build.gradle.kts) and replace the `conventions.distribute-application` plugin with `conventions.publish-library`.
This automatically sets up the `maven-publish` plugin, which adds the `publishToMavenLocal` task.
The plugin also adds a `demo` sourceSet with runtime dependencies set to go. Demos can be placed in `src/demo/kotlin` and started right away.

View File

@@ -1,374 +1,30 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar group = property("project.group") ?: error("project.group not set")
import org.gradle.internal.os.OperatingSystem version = property("project.version") ?: error("project.version not set")
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
group = "org.openrndr.template"
version = "1.0.0"
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-compositor",
// "orx-compute-graph",
// "orx-compute-graph-nodes",
"orx-delegate-magic",
// "orx-dnk3",
// "orx-easing",
"orx-envelopes",
// "orx-expression-evaluator",
// "orx-fcurve",
// "orx-fft",
// "orx-file-watcher",
"orx-fx",
// "orx-git-archiver",
// "orx-gradient-descent",
"orx-gui",
// "orx-hash-grid",
"orx-image-fit",
// "orx-integral-image",
// "orx-interval-tree",
// "orx-jumpflood",
// "orx-kdtree",
// "orx-keyframer",
// "orx-kinect-v1",
// "orx-kotlin-parser",
// "orx-marching-squares",
// "orx-math",
// "orx-mesh-generators",
// "orx-midi",
// "orx-minim",
"orx-no-clear",
"orx-noise",
// "orx-obj-loader",
"orx-olive",
// "orx-osc",
// "orx-palette",
"orx-panel",
// "orx-parameters",
// "orx-poisson-fill",
// "orx-property-watchers",
// "orx-quadtree",
// "orx-rabbit-control",
// "orx-realsense2",
// "orx-runway",
"orx-shade-styles",
// "orx-shader-phrases",
"orx-shapes",
"orx-svg",
// "orx-syphon",
// "orx-temporal-blur",
// "orx-tensorflow",
"orx-text-writer",
// "orx-time-operators",
// "orx-timer",
// "orx-triangulation",
// "orx-turtle",
"orx-video-profiles",
"orx-view-box",
)
/** ## additional ORML features to be added to this project */
val ormlFeatures = setOf<String>(
// "orml-blazepose",
// "orml-dbface",
// "orml-facemesh",
// "orml-image-classifier",
// "orml-psenet",
// "orml-ssd",
// "orml-style-transfer",
// "orml-super-resolution",
// "orml-u2net",
)
/** ## additional OPENRNDR features to be added to this project */
val openrndrFeatures = setOfNotNull(
if (DefaultNativePlatform("current").architecture.name != "arm-v8") "video" else null
)
/** ## configure the type of logging this project uses */
enum class Logging { NONE, SIMPLE, FULL }
val applicationLogging = Logging.FULL
// ------------------------------------------------------------------------------------------------------------------ //
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
java
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.shadow)
alias(libs.plugins.runtime)
alias(libs.plugins.gitarchive.tomarkdown).apply(false)
alias(libs.plugins.versions)
alias(libs.plugins.kotlin.serialization) alias(libs.plugins.kotlin.serialization)
} id("conventions.kotlin-jvm")
id("conventions.openrndr-tasks")
repositories { id("conventions.distribute-application")
mavenCentral()
mavenLocal()
} }
dependencies { dependencies {
implementation(openrndr.bundles.basic)
implementation(openrndr.bundles.video)
runtimeOnly(openrndr.bundles.runtime.sdl)
// runtimeOnly(openrndr.bundles.runtime.glfw)
runtimeOnly(openrndr.gl3)
implementation(openrndr.dialogs)
implementation(openrndr.orextensions)
// implementation(libs.jsoup) implementation(orx.bundles.basic)
// implementation(libs.csv) implementation(orx.olive)
/* ORSL dependencies */
// implementation(libs.orsl.shader.generator)
// implementation(libs.orsl.extension.color)
// implementation(libs.orsl.extension.easing)
// implementation(libs.orsl.extension.gradient)
// implementation(libs.orsl.extension.noise)
// implementation(libs.orsl.extension.pbr)
// implementation(libs.orsl.extension.raymarching)
// implementation(libs.orsl.extension.sdf)
implementation(libs.kotlinx.coroutines.core) implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.core) implementation(libs.kotlinx.serialization.core)
implementation(libs.kotlinx.serialization.json) implementation(libs.kotlinx.serialization.json)
implementation(libs.slf4j.api) implementation(libs.slf4j.api)
implementation(libs.kotlin.logging) implementation(libs.kotlin.logging)
runtimeOnly(libs.bundles.logging.simple)
when (applicationLogging) {
Logging.NONE -> runtimeOnly(libs.slf4j.nop)
Logging.SIMPLE -> runtimeOnly(libs.slf4j.simple)
Logging.FULL -> {
runtimeOnly(libs.log4j.slf4j2)
runtimeOnly(libs.log4j.core)
runtimeOnly(libs.jackson.databind)
runtimeOnly(libs.jackson.json)
}
}
implementation(kotlin("stdlib-jdk8"))
testImplementation(libs.junit) testImplementation(libs.junit)
} }
// ------------------------------------------------------------------------------------------------------------------ //
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
compilerOptions {
languageVersion = KotlinVersion.KOTLIN_2_0
apiVersion = KotlinVersion.KOTLIN_2_0
jvmTarget = JvmTarget.JVM_17
}
}
// ------------------------------------------------------------------------------------------------------------------ //
application {
mainClass = if (hasProperty("openrndr.application"))
"${property("openrndr.application")}"
else
applicationMainClass
}
tasks {
named<ShadowJar>("shadowJar") {
manifest {
attributes["Main-Class"] = applicationMainClass
attributes["Implementation-Version"] = project.version
}
minimize {
exclude(dependency("org.openrndr:openrndr-gl3:.*"))
exclude(dependency("org.jetbrains.kotlin:kotlin-reflect:.*"))
exclude(dependency("org.slf4j:slf4j-simple:.*"))
exclude(dependency("org.apache.logging.log4j:log4j-slf4j2-impl:.*"))
exclude(dependency("com.fasterxml.jackson.core:jackson-databind:.*"))
exclude(dependency("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:.*"))
exclude(dependency("org.bytedeco:.*"))
}
}
}
// ------------------------------------------------------------------------------------------------------------------ //
tasks {
named<org.beryx.runtime.JPackageTask>("jpackage") {
doLast {
val destPath = if (OperatingSystem.current().isMacOsX)
"build/jpackage/openrndr-application.app/Contents/Resources/data"
else
"build/jpackage/openrndr-application/data"
copy {
from("data") { include("**/*") }
into(destPath)
}
}
}
register<Zip>("jpackageZip") {
archiveFileName = "openrndr-application.zip"
from("${layout.buildDirectory.get()}/jpackage") {
include("**/*")
}
dependsOn("jpackage")
}
}
runtime {
jpackage {
imageName = "openrndr-application"
skipInstaller = true
if (OperatingSystem.current().isMacOsX) {
jvmArgs.add("-XstartOnFirstThread")
jvmArgs.add("-Duser.dir=${"$"}APPDIR/../Resources")
}
}
options = listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages")
modules = listOf("jdk.unsupported", "java.management", "java.desktop")
}
// ------------------------------------------------------------------------------------------------------------------ //
tasks {
register<org.openrndr.extra.gitarchiver.GitArchiveToMarkdown>("gitArchiveToMarkDown") {
historySize = 20
}
}
// ------------------------------------------------------------------------------------------------------------------ //
tasks {
dependencyUpdates {
gradleReleaseChannel = "current"
val nonStableKeywords = listOf("alpha", "beta", "rc")
fun isNonStable(version: String) = nonStableKeywords.any {
version.lowercase().contains(it)
}
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
}
// ------------------------------------------------------------------------------------------------------------------ //
class Openrndr {
val openrndrVersion = libs.versions.openrndr.get()
val orxVersion = libs.versions.orx.get()
val ormlVersion = libs.versions.orml.get()
// choices are "orx-tensorflow-gpu", "orx-tensorflow"
val orxTensorflowBackend = "orx-tensorflow"
val currArch = DefaultNativePlatform("current").architecture.name
val currOs = OperatingSystem.current()
val os = if (project.hasProperty("targetPlatform")) {
val supportedPlatforms = setOf("windows", "macos", "linux-x64", "linux-arm64")
val platform: String = project.property("targetPlatform") as String
if (platform !in supportedPlatforms) {
throw IllegalArgumentException("target platform not supported: $platform")
} else {
platform
}
} else when {
currOs.isWindows -> "windows"
currOs.isMacOsX -> when (currArch) {
"aarch64", "arm-v8" -> "macos-arm64"
else -> "macos"
}
currOs.isLinux -> when (currArch) {
"x86-64" -> "linux-x64"
"aarch64" -> "linux-arm64"
else -> throw IllegalArgumentException("architecture not supported: $currArch")
}
else -> throw IllegalArgumentException("os not supported: ${currOs.name}")
}
fun orx(module: String) = "org.openrndr.extra:$module:$orxVersion"
fun orml(module: String) = "org.openrndr.orml:$module:$ormlVersion"
fun openrndr(module: String) = "org.openrndr:openrndr-$module:$openrndrVersion"
fun openrndrNatives(module: String) = "org.openrndr:openrndr-$module-natives-$os:$openrndrVersion"
fun orxNatives(module: String) = "org.openrndr.extra:$module-natives-$os:$orxVersion"
init {
dependencies {
runtimeOnly(openrndr("gl3"))
runtimeOnly(openrndrNatives("gl3"))
implementation(openrndr("openal"))
runtimeOnly(openrndrNatives("openal"))
implementation(openrndr("application"))
implementation(openrndr("animatable"))
implementation(openrndr("extensions"))
implementation(openrndr("filter"))
implementation(openrndr("dialogs"))
if ("video" in openrndrFeatures) {
implementation(openrndr("ffmpeg"))
runtimeOnly(openrndrNatives("ffmpeg"))
}
for (feature in orxFeatures) {
implementation(orx(feature))
}
for (feature in ormlFeatures) {
implementation(orml(feature))
}
if ("orx-tensorflow" in orxFeatures) runtimeOnly("org.openrndr.extra:$orxTensorflowBackend-natives-$os:$orxVersion")
if ("orx-kinect-v1" in orxFeatures) runtimeOnly(orxNatives("orx-kinect-v1"))
if ("orx-olive" in orxFeatures) implementation(libs.kotlin.script.runtime)
}
}
}
val openrndr = Openrndr()
if (properties["openrndr.tasks"] == "true") {
tasks.register("create executable jar for $applicationMainClass") {
group = " \uD83E\uDD8C OPENRNDR"
dependsOn("shadowJar")
}
tasks.register("run $applicationMainClass") {
group = " \uD83E\uDD8C OPENRNDR"
dependsOn("run")
}
tasks.register("create standalone executable for $applicationMainClass") {
group = " \uD83E\uDD8C OPENRNDR"
dependsOn("jpackageZip")
}
tasks.register("add IDE file scopes") {
group = " \uD83E\uDD8C OPENRNDR"
val scopesFolder = File("${project.projectDir}/.idea/scopes")
scopesFolder.mkdirs()
val files = listOf(
"Code" to "file:*.kt||file:*.frag||file:*.vert||file:*.glsl",
"Text" to "file:*.txt||file:*.md||file:*.xml||file:*.json",
"Gradle" to "file[*buildSrc*]:*/||file:*gradle.*||file:*.gradle||file:*/gradle-wrapper.properties||file:*.toml",
"Media" to "file:*.png||file:*.jpg||file:*.dds||file:*.exr||file:*.mp3||file:*.wav||file:*.mp4||file:*.mov||file:*.svg"
)
files.forEach { (name, pattern) ->
val file = File(scopesFolder, "__$name.xml")
if (!file.exists()) {
file.writeText(
"""
<component name="DependencyValidationManager">
<scope name=" ★ $name" pattern="$pattern" />
</component>
""".trimIndent()
)
}
}
}
}

12
buildSrc/build.gradle.kts Normal file
View File

@@ -0,0 +1,12 @@
plugins {
`kotlin-dsl`
}
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
dependencies {
implementation(libs.findLibrary("shadow-gradle-plugin").get())
implementation(libs.findLibrary("runtime-gradle-plugin").get())
implementation(libs.findLibrary("kotlin-gradle-plugin").get())
implementation(libs.findLibrary("xversions-gradle-plugin").get())
}

View File

@@ -0,0 +1,39 @@
rootProject.name = "buildSrc"
dependencyResolutionManagement {
repositories {
mavenCentral()
gradlePluginPortal()
mavenLocal {
content {
includeGroup("org.openrndr")
includeGroup("org.openrndr.extra")
}
}
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
// We use a regex to get the openrndr/orx versions from the primary catalog as there is no public Gradle API to parse catalogs.
val orRegEx = Regex("^openrndr[ ]*=[ ]*(?:\\{[ ]*require[ ]*=[ ]*)?\"(.*)\"[ ]*(?:\\})?", RegexOption.MULTILINE)
val orxRegEx = Regex("^orx[ ]*=[ ]*(?:\\{[ ]*require[ ]*=[ ]*)?\"(.*)\"[ ]*(?:\\})?", RegexOption.MULTILINE)
val openrndrVersion = orRegEx.find(File(rootDir,"../gradle/libs.versions.toml").readText())?.groupValues?.get(1) ?: error("can't find openrndr version")
val orxVersion = orxRegEx.find(File(rootDir,"../gradle/libs.versions.toml").readText())?.groupValues?.get(1) ?: error("can't find orx version")
create("orx") {
from("org.openrndr.extra:orx-module-catalog:$orxVersion")
}
create("openrndr") {
from("org.openrndr:openrndr-module-catalog:$openrndrVersion")
}
}
}
pluginManagement {
repositories {
gradlePluginPortal()
}
}

View File

@@ -0,0 +1,80 @@
package conventions
import org.gradle.internal.os.OperatingSystem
import kotlin.collections.set
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("com.gradleup.shadow")
id("org.beryx.runtime")
}
val applicationMainClass: String by properties
application {
mainClass = if (hasProperty("openrndr.application"))
"${property("openrndr.application")}"
else
applicationMainClass
}
tasks {
named<ShadowJar>("shadowJar") {
manifest {
attributes["Main-Class"] = applicationMainClass
attributes["Implementation-Version"] = project.version
}
minimize {
exclude(dependency("org.openrndr:openrndr-gl3:.*"))
exclude(dependency("org.openrndr:openrndr-application-glfw"))
exclude(dependency("org.openrndr:openrndr-application-sdl"))
exclude(dependency("org.jetbrains.kotlin:kotlin-reflect:.*"))
exclude(dependency("org.slf4j:slf4j-simple:.*"))
exclude(dependency("org.apache.logging.log4j:log4j-slf4j2-impl:.*"))
exclude(dependency("com.fasterxml.jackson.core:jackson-databind:.*"))
exclude(dependency("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:.*"))
exclude(dependency("org.bytedeco:.*"))
}
}
}
tasks {
named<org.beryx.runtime.JPackageTask>("jpackage") {
doLast {
val destPath = if (OperatingSystem.current().isMacOsX)
"build/jpackage/openrndr-application.app/Contents/Resources/data"
else
"build/jpackage/openrndr-application/data"
copy {
from("data") { include("**/*") }
into(destPath)
}
}
}
register<Zip>("jpackageZip") {
archiveFileName = "openrndr-application.zip"
from("${layout.buildDirectory.get()}/jpackage") {
include("**/*")
}
filesMatching("**/bin/*") {
permissions {
unix("0755")
}
}
dependsOn("jpackage")
}
}
runtime {
jpackage {
imageName = "openrndr-application"
skipInstaller = true
if (OperatingSystem.current().isMacOsX) {
jvmArgs.add("-XstartOnFirstThread")
jvmArgs.add($$"-Duser.dir=$APPDIR/../Resources")
}
}
options = listOf("--strip-debug", "--compress", "zip-6", "--no-header-files", "--no-man-pages")
modules = listOf("jdk.unsupported", "java.management", "java.desktop")
}

View File

@@ -0,0 +1,71 @@
package conventions
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
plugins {
java
kotlin("jvm")
id("com.github.ben-manes.versions")
}
repositories {
mavenCentral()
mavenLocal()
}
java {
targetCompatibility = JavaVersion.valueOf("VERSION_${libs.findVersion("jvmTarget").get().displayName}")
sourceCompatibility = JavaVersion.valueOf("VERSION_${libs.findVersion("jvmTarget").get().displayName}")
}
kotlin {
compilerOptions {
apiVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.findVersion("kotlinApi").get().displayName.replace(".", "_")}"))
languageVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.findVersion("kotlinLanguage").get().displayName.replace(".", "_")}"))
jvmTarget.set(JvmTarget.valueOf("JVM_${libs.findVersion("jvmTarget").get().displayName}"))
}
}
fun arch(arch: String = System.getProperty("os.arch")): String {
return when (arch) {
"x86-64", "x86_64", "amd64" -> "x86-64"
"arm64", "aarch64" -> "aarch64"
else -> error("unsupported arch $arch")
}
}
fun Project.addHostMachineAttributesToRuntimeConfigurations() {
val currentOperatingSystemName: String = DefaultNativePlatform.getCurrentOperatingSystem().toFamilyName()
val currentArchitectureName: String = arch()
configurations.matching {
it.name.endsWith("runtimeClasspath", ignoreCase = true)
}.configureEach {
attributes {
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(currentOperatingSystemName))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(currentArchitectureName))
}
}
}
addHostMachineAttributesToRuntimeConfigurations()
tasks {
dependencyUpdates {
gradleReleaseChannel = "current"
val nonStableKeywords = listOf("alpha", "beta", "rc")
fun isNonStable(version: String) = nonStableKeywords.any {
version.lowercase().contains(it)
}
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
}

View File

@@ -0,0 +1,42 @@
package conventions
val applicationMainClass by properties
tasks.register("create executable jar for $applicationMainClass") {
group = " \uD83E\uDD8C OPENRNDR"
dependsOn("shadowJar")
}
tasks.register("run $applicationMainClass") {
group = " \uD83E\uDD8C OPENRNDR"
dependsOn("run")
}
tasks.register("create standalone executable for $applicationMainClass") {
group = " \uD83E\uDD8C OPENRNDR"
dependsOn("jpackageZip")
}
tasks.register("add IDE file scopes") {
group = " \uD83E\uDD8C OPENRNDR"
val scopesFolder = File("${project.projectDir}/.idea/scopes")
scopesFolder.mkdirs()
val files = listOf(
"Code" to "file:*.kt||file:*.frag||file:*.vert||file:*.glsl",
"Text" to "file:*.txt||file:*.md||file:*.xml||file:*.json",
"Gradle" to "file[*buildSrc*]:*/||file:*gradle.*||file:*.gradle||file:*/gradle-wrapper.properties||file:*.toml",
"Media" to "file:*.png||file:*.jpg||file:*.dds||file:*.exr||file:*.mp3||file:*.wav||file:*.mp4||file:*.mov||file:*.svg"
)
files.forEach { (name, pattern) ->
val file = File(scopesFolder, "__$name.xml")
if (!file.exists()) {
file.writeText(
"""
<component name="DependencyValidationManager">
<scope name=" ★ $name" pattern="$pattern" />
</component>
""".trimIndent()
)
}
}
}

View File

@@ -0,0 +1,37 @@
package conventions
import org.gradle.kotlin.dsl.java
import org.gradle.kotlin.dsl.kotlin
plugins {
java
kotlin("jvm")
`maven-publish`
}
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
val openrndr = extensions.getByType<VersionCatalogsExtension>().named("openrndr")
val demo = sourceSets.create("demo")
val main = sourceSets.getByName("main")
demo.compileClasspath += main.compileClasspath
demo.runtimeClasspath += main.runtimeClasspath
demo.compileClasspath += main.output
demo.runtimeClasspath += main.output
dependencies {
"demoRuntimeOnly"(openrndr.findLibrary("gl3").get())
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
groupId = property("project.group")?.toString() ?: error("project.group not set")
artifactId = property("project.name")?.toString() ?: error("project.name not set")
description = property("project.name")?.toString() ?: error("project.name not set")
version = property("project.version")?.toString() ?: error("project.version not set")
}
}
}

View File

@@ -1,3 +1,7 @@
project.name=openrndr-template
project.group=org.openrndr
project.version=1.0.0
applicationMainClass=TemplateProgramKt
openrndr.tasks=true openrndr.tasks=true
kotlin.code.style=official kotlin.code.style=official
#org.gradle.configuration-cache=true #org.gradle.configuration-cache=true

View File

@@ -1,21 +1,26 @@
[versions] [versions]
kotlin = "2.2.10" jvmTarget = "17"
openrndr = "0.4.5" kotlin = "2.3.21"
orx = "0.4.5" kotlinApi = "2.2"
kotlinLanguage = "2.2"
openrndr = "0.5.0-alpha4"
orx = "0.5.0-alpha4"
orsl = "0.4.5-alpha5" orsl = "0.4.5-alpha5"
orml = "0.4.1" orml = "0.4.1"
slf4j = "2.0.17"
slf4j = "2.0.18"
log4j = "2.23.1" log4j = "2.23.1"
jackson = "2.17.2" jackson = "2.17.2"
junit = "4.13.2" junit = "4.13.2"
kotlinxCoroutines = "1.10.2" kotlinxCoroutines = "1.11.0"
kotlinxSerialization = "1.9.0" kotlinxSerialization = "1.11.0"
kotlinLogging = "7.0.13" kotlinLogging = "8.0.03"
kotlinCsvJvm = "1.9.3" kotlinCsvJvm = "1.9.3"
jsoup = "1.17.1" jsoup = "1.17.1"
shadow = "9.1.0" shadow = "9.4.0"
runtime = "1.13.1" runtime = "2.0.1"
versions = "0.52.0" versions = "0.54.0"
[libraries] [libraries]
kotlin-script-runtime = { group = "org.jetbrains.kotlin", name = "kotlin-script-runtime", version.ref = "kotlin" } kotlin-script-runtime = { group = "org.jetbrains.kotlin", name = "kotlin-script-runtime", version.ref = "kotlin" }
@@ -28,15 +33,10 @@ log4j-core = { group = "org.apache.logging.log4j", name = "log4j-core", version.
jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" } jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" }
jackson-json = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version.ref = "jackson" } jackson-json = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version.ref = "jackson" }
orsl-shader-generator = { group = "org.openrndr.extra", name = "orsl-shader-generator", version.ref = "orsl" } shadow-gradle-plugin = { group = "com.gradleup.shadow", name = "com.gradleup.shadow.gradle.plugin", version.ref = "shadow" }
orsl-extension-color = { group = "org.openrndr.extra", name = "orsl-extension-color", version.ref = "orsl" } runtime-gradle-plugin = { group = "org.beryx.runtime", name = "org.beryx.runtime.gradle.plugin", version.ref = "runtime" }
orsl-extension-easing = { group = "org.openrndr.extra", name = "orsl-extension-easing", version.ref = "orsl" } kotlin-gradle-plugin = { group = "org.jetbrains.kotlin.jvm", name = "org.jetbrains.kotlin.jvm.gradle.plugin", version.ref = "kotlin" }
orsl-extension-gradient = { group = "org.openrndr.extra", name = "orsl-extension-gradient", version.ref = "orsl" } xversions-gradle-plugin = { group = "com.github.ben-manes.versions", name = "com.github.ben-manes.versions.gradle.plugin", version.ref = "versions" }
orsl-extension-noise = { group = "org.openrndr.extra", name = "orsl-extension-noise", version.ref = "orsl" }
orsl-extension-pbr = { group = "org.openrndr.extra", name = "orsl-extension-pbr", version.ref = "orsl" }
orsl-extension-raymarching = { group = "org.openrndr.extra", name = "orsl-extension-raymarching", version.ref = "orsl" }
orsl-extension-sdf = { group = "org.openrndr.extra", name = "orsl-extension-sdf", version.ref = "orsl" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" } kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" } kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" }
kotlinx-serialization-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core", version.ref = "kotlinxSerialization" } kotlinx-serialization-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core", version.ref = "kotlinxSerialization" }
@@ -52,3 +52,8 @@ shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
runtime = { id = "org.beryx.runtime", version.ref = "runtime" } runtime = { id = "org.beryx.runtime", version.ref = "runtime" }
gitarchive-tomarkdown = { id = "org.openrndr.extra.gitarchiver.tomarkdown", version.ref = "orx" } gitarchive-tomarkdown = { id = "org.openrndr.extra.gitarchiver.tomarkdown", version.ref = "orx" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" } versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
[bundles]
logging-none = ["slf4j-nop"]
logging-simple = ["slf4j-simple"]
logging-full = ["log4j-slf4j2", "log4j-core", "jackson-databind", "jackson-json"]

Binary file not shown.

View File

@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000 networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

7
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@" "$@"

32
gradlew.bat vendored
View File

@@ -23,8 +23,8 @@
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables, and ensure extensions are enabled
if "%OS%"=="Windows_NT" setlocal setlocal EnableExtensions
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@@ -51,7 +51,7 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2 echo location of your Java installation. 1>&2
goto fail "%COMSPEC%" /c exit 1
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
@@ -65,30 +65,18 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2 echo location of your Java installation. 1>&2
goto fail "%COMSPEC%" /c exit 1
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* @rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
:end :exitWithErrorLevel
@rem End local scope for the variables with windows NT shell @rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
if %ERRORLEVEL% equ 0 goto mainEnd "%COMSPEC%" /c exit %ERRORLEVEL%
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1,4 +1,4 @@
rootProject.name = "openrndr-template" rootProject.name = extra["project.name"]?.toString() ?: error("project.name not set")
pluginManagement { pluginManagement {
repositories { repositories {
@@ -6,3 +6,30 @@ pluginManagement {
mavenLocal() mavenLocal()
} }
} }
dependencyResolutionManagement {
repositories {
mavenCentral()
mavenLocal {
content {
includeGroup("org.openrndr")
includeGroup("org.openrndr.extra")
}
}
}
versionCatalogs {
// We use a regex to get the openrndr/orx versions from the primary catalog as there is no public Gradle API to parse catalogs.
val orRegEx = Regex("^openrndr[ ]*=[ ]*(?:\\{[ ]*require[ ]*=[ ]*)?\"(.*)\"[ ]*(?:\\})?", RegexOption.MULTILINE)
val orxRegEx = Regex("^orx[ ]*=[ ]*(?:\\{[ ]*require[ ]*=[ ]*)?\"(.*)\"[ ]*(?:\\})?", RegexOption.MULTILINE)
val openrndrVersion = orRegEx.find(File(rootDir,"gradle/libs.versions.toml").readText())?.groupValues?.get(1) ?: error("can't find openrndr version")
val orxVersion = orxRegEx.find(File(rootDir,"gradle/libs.versions.toml").readText())?.groupValues?.get(1) ?: error("can't find orx version")
create("orx") {
from("org.openrndr.extra:orx-module-catalog:$orxVersion")
}
create("openrndr") {
from("org.openrndr:openrndr-module-catalog:$openrndrVersion")
}
}
}