Compare commits
28 Commits
openrndr-0
...
feature-co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e35d629a5a | ||
|
|
577e0c2f9a | ||
|
|
3350274efb | ||
|
|
a83e888dc3 | ||
|
|
498fd6773d | ||
|
|
d5702db78f | ||
|
|
d692d6998d | ||
|
|
3db83af277 | ||
|
|
29db13e82a | ||
|
|
a3c9178d4d | ||
|
|
84f54b3f4e | ||
|
|
4c9e1c552f | ||
|
|
e36cad040e | ||
|
|
ce3bf56b43 | ||
|
|
5ce3313da5 | ||
|
|
9695d5e8af | ||
|
|
5242dae526 | ||
|
|
d97e80c903 | ||
|
|
adf88e1062 | ||
|
|
eda66cc37a | ||
|
|
fa820c6d3c | ||
|
|
411b5f5b12 | ||
|
|
2f2d279e24 | ||
|
|
a35675fd03 | ||
|
|
2477ce7de8 | ||
|
|
0fd7a72d4f | ||
|
|
f907422a5e | ||
|
|
f3d8d0a3dc |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,3 +6,6 @@ out
|
||||
video/
|
||||
screenshots/
|
||||
gui-parameters/
|
||||
ffmpegOutput.txt
|
||||
ShaderError.glsl
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ Newer versions of OPENRNDR and ORX bring useful features and bug fixes. The most
|
||||
<br> for OPENRNDR.
|
||||
<br> for ORX.
|
||||
|
||||
You can use those version numbers in your toml file. They can look like "0.4.3" or "0.4.3-alpha4". Use the complete string, as in:
|
||||
Switch to the [next-version branch](https://github.com/openrndr/openrndr-template/tree/next-version) or enter these version numbers in your toml file. They can look like "0.4.3" or "0.4.3-alpha4". Use the complete string, as in:
|
||||
|
||||
openrndr = "0.4.3-alpha4"
|
||||
orx = "0.4.3-alpha4"
|
||||
|
||||
335
build.gradle.kts
335
build.gradle.kts
@@ -1,329 +1,28 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
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-boofcv",
|
||||
"orx-camera",
|
||||
// "orx-chataigne",
|
||||
"orx-color",
|
||||
"orx-compositor",
|
||||
// "orx-compute-graph",
|
||||
// "orx-compute-graph-nodes",
|
||||
// "orx-dnk3",
|
||||
// "orx-easing",
|
||||
// "orx-expression-evaluator",
|
||||
// "orx-file-watcher",
|
||||
"orx-fx",
|
||||
// "orx-git-archiver",
|
||||
// "orx-glslify",
|
||||
// "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-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-quadtree",
|
||||
// "orx-rabbit-control",
|
||||
// "orx-realsense2",
|
||||
// "orx-runway",
|
||||
"orx-shade-styles",
|
||||
// "orx-shader-phrases",
|
||||
"orx-shapes",
|
||||
// "orx-syphon",
|
||||
// "orx-temporal-blur",
|
||||
// "orx-tensorflow",
|
||||
// "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 {
|
||||
java
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
alias(libs.plugins.shadow)
|
||||
alias(libs.plugins.runtime)
|
||||
alias(libs.plugins.gitarchive.tomarkdown).apply(false)
|
||||
openrndr
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
openrndr {
|
||||
openrndrVersion = libs.versions.openrndr.get()
|
||||
orxVersion = libs.versions.orx.get()
|
||||
orxFeatures = setOf(
|
||||
libs.orx.olive,
|
||||
libs.orx.color,
|
||||
libs.orx.shapes,
|
||||
libs.orx.gui,
|
||||
libs.orx.svg
|
||||
)
|
||||
openrndrFeatures = setOf(
|
||||
libs.openrndr.ffmpeg,
|
||||
libs.openrndr.gl3
|
||||
)
|
||||
mainClass = "TemplateProgramKt"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// implementation(libs.jsoup)
|
||||
// implementation(libs.gson)
|
||||
// implementation(libs.csv)
|
||||
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.slf4j.api)
|
||||
implementation(libs.kotlin.logging)
|
||||
|
||||
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)
|
||||
implementation(libs.csv)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "11"
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
project.setProperty("mainClassName", applicationMainClass)
|
||||
|
||||
application {
|
||||
if (hasProperty("openrndr.application")) {
|
||||
mainClass.set("${property("openrndr.application")}")
|
||||
}
|
||||
}
|
||||
|
||||
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:.*"))
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
tasks.register<Zip>("jpackageZip") {
|
||||
archiveFileName.set("openrndr-application.zip")
|
||||
from("$buildDir/jpackage") {
|
||||
include("**/*")
|
||||
}
|
||||
}
|
||||
tasks.findByName("jpackageZip")?.dependsOn("jpackage")
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
runtime {
|
||||
jpackage {
|
||||
imageName = "openrndr-application"
|
||||
skipInstaller = true
|
||||
if (OperatingSystem.current().isMacOsX) {
|
||||
jvmArgs.add("-XstartOnFirstThread")
|
||||
jvmArgs.add("-Duser.dir=${"$"}APPDIR/../Resources")
|
||||
}
|
||||
}
|
||||
options.set(listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages"))
|
||||
modules.set(listOf("jdk.unsupported", "java.management", "java.desktop"))
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
tasks.register<org.openrndr.extra.gitarchiver.GitArchiveToMarkdown>("gitArchiveToMarkDown") {
|
||||
historySize.set(20)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
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("svg"))
|
||||
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") {
|
||||
task("create executable jar for $applicationMainClass") {
|
||||
group = " \uD83E\uDD8C OPENRNDR"
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
|
||||
task("run $applicationMainClass") {
|
||||
group = " \uD83E\uDD8C OPENRNDR"
|
||||
dependsOn("run")
|
||||
}
|
||||
|
||||
task("create standalone executable for $applicationMainClass") {
|
||||
group = " \uD83E\uDD8C OPENRNDR"
|
||||
dependsOn("jpackageZip")
|
||||
}
|
||||
|
||||
task("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",
|
||||
"Images" to "file:*.png||file:*.jpg||file:*.dds||file:*.exr"
|
||||
)
|
||||
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()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
buildSrc/build.gradle.kts
Normal file
29
buildSrc/build.gradle.kts
Normal file
@@ -0,0 +1,29 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.kotlin.gradle.plugin)
|
||||
|
||||
implementation(libs.shadow.gradle.plugin)
|
||||
implementation(libs.runtime.gradle.plugin)
|
||||
|
||||
//implementation(libs.kotlin.serialization.gradle.plugin)
|
||||
// https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
|
||||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
register("openrndr-plugin") {
|
||||
id = "openrndr"
|
||||
implementationClass = "org.openrndr.template.OpenrndrPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
buildSrc/settings.gradle.kts
Normal file
7
buildSrc/settings.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.openrndr.template.convention
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
val libs = the<LibrariesForLibs>()
|
||||
|
||||
var applicationMainClass: String = "setme"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("org.beryx.runtime")
|
||||
application
|
||||
}
|
||||
|
||||
tasks {
|
||||
named<ShadowJar>("shadowJar") {
|
||||
manifest {
|
||||
attributes["Main-Class"] = application.mainClass.get()
|
||||
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:.*"))
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Zip>("jpackageZip") {
|
||||
archiveFileName.set("openrndr-application.zip")
|
||||
from("${layout.buildDirectory.get()}/jpackage") {
|
||||
include("**/*")
|
||||
}
|
||||
}
|
||||
tasks.findByName("jpackageZip")?.dependsOn("jpackage")
|
||||
|
||||
runtime {
|
||||
jpackage {
|
||||
imageName = "openrndr-application"
|
||||
skipInstaller = true
|
||||
if (OperatingSystem.current().isMacOsX) {
|
||||
jvmArgs.add("-XstartOnFirstThread")
|
||||
jvmArgs.add("-Duser.dir=${"$"}APPDIR/../Resources")
|
||||
}
|
||||
}
|
||||
options.set(listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages"))
|
||||
modules.set(listOf("jdk.unsupported", "java.management", "java.desktop"))
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.openrndr.template.convention
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
val libs = the<LibrariesForLibs>()
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
application
|
||||
}
|
||||
|
||||
//application {
|
||||
// if (hasProperty("openrndr.application")) {
|
||||
// mainClass.set("${property("openrndr.application")}")
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.valueOf("JVM_${libs.versions.jvmTarget.get()}"))
|
||||
freeCompilerArgs.add("-Xjdk-release=${libs.versions.jvmTarget.get()}")
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.valueOf("VERSION_${libs.versions.jvmTarget.get()}")
|
||||
targetCompatibility = JavaVersion.valueOf("VERSION_${libs.versions.jvmTarget.get()}")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.slf4j.api)
|
||||
implementation(libs.kotlin.logging)
|
||||
|
||||
implementation(libs.openrndr.application)
|
||||
implementation(libs.openrndr.animatable)
|
||||
implementation(libs.openrndr.dialogs)
|
||||
implementation(libs.openrndr.extensions)
|
||||
}
|
||||
163
buildSrc/src/main/kotlin/org/openrndr/template/openrndr.kt
Normal file
163
buildSrc/src/main/kotlin/org/openrndr/template/openrndr.kt
Normal file
@@ -0,0 +1,163 @@
|
||||
package org.openrndr.template
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.ProjectEvaluationListener
|
||||
import org.gradle.api.ProjectState
|
||||
import org.gradle.api.artifacts.DependencyResolutionListener
|
||||
import org.gradle.api.artifacts.MinimalExternalModuleDependency
|
||||
import org.gradle.api.artifacts.ResolvableDependencies
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.provider.SetProperty
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
import java.io.File
|
||||
|
||||
interface OpenrndrPluginExtension {
|
||||
val openrndrVersion: Property<String>
|
||||
val orxVersion: Property<String>
|
||||
val openrndrFeatures: SetProperty<Provider<MinimalExternalModuleDependency>>
|
||||
val orxFeatures: SetProperty<Provider<MinimalExternalModuleDependency>>
|
||||
val mainClass: Property<String>
|
||||
}
|
||||
|
||||
class OpenrndrPlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) {
|
||||
val extension = target.extensions.create("openrndr", OpenrndrPluginExtension::class.java)
|
||||
|
||||
// Install the convention plugins
|
||||
run {
|
||||
target.plugins.apply("org.openrndr.template.convention.openrndr-jvm")
|
||||
target.plugins.apply("org.openrndr.template.convention.distribution-jvm")
|
||||
}
|
||||
|
||||
// Configure the application mainClass
|
||||
run {
|
||||
val app =
|
||||
(target as org.gradle.api.plugins.ExtensionAware).extensions.getByName("application") as org.gradle.api.plugins.JavaApplication
|
||||
app.mainClass.set(extension.mainClass)
|
||||
}
|
||||
|
||||
// Install the OPENRNDR tasks
|
||||
run {
|
||||
target.gradle.addListener(object : ProjectEvaluationListener {
|
||||
override fun beforeEvaluate(project: Project) {
|
||||
}
|
||||
|
||||
override fun afterEvaluate(project: Project, state: ProjectState) {
|
||||
if (target.properties["openrndr.tasks"] == "true") {
|
||||
target.task("create executable jar for ${extension.mainClass.get()}") {
|
||||
group = " \uD83E\uDD8C OPENRNDR"
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
|
||||
target.task("run $${extension.mainClass.get()}") {
|
||||
group = " \uD83E\uDD8C OPENRNDR"
|
||||
dependsOn("run")
|
||||
}
|
||||
|
||||
target.task("create standalone executable for ${extension.mainClass.get()}") {
|
||||
group = " \uD83E\uDD8C OPENRNDR"
|
||||
dependsOn("jpackageZip")
|
||||
}
|
||||
|
||||
target.task("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()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Dynamically configure dependencies from openrndrFeatures and orxFeatures
|
||||
run {
|
||||
val currArch = DefaultNativePlatform("current").architecture.name
|
||||
val currOs = OperatingSystem.current()
|
||||
val os = if (target.hasProperty("targetPlatform")) {
|
||||
val supportedPlatforms = setOf("windows", "macos", "macos-arm64", "linux-x64", "linux-arm64")
|
||||
val platform: String = target.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}")
|
||||
}
|
||||
|
||||
|
||||
target.gradle.addListener(object : DependencyResolutionListener {
|
||||
override fun beforeResolve(dependencies: ResolvableDependencies) {
|
||||
for (feature in extension.orxFeatures.get()) {
|
||||
target.dependencies.add("implementation", feature)
|
||||
}
|
||||
|
||||
for (feature in extension.openrndrFeatures.get()) {
|
||||
target.dependencies.add("implementation", feature)
|
||||
val dep = feature.get()
|
||||
when (dep.name) {
|
||||
"openrndr-ffmpeg" -> target.dependencies.add(
|
||||
"runtimeOnly",
|
||||
"${dep.group}:${dep.name}-natives-$os:${dep.version}"
|
||||
)
|
||||
|
||||
"openrndr-gl3" -> target.dependencies.add(
|
||||
"runtimeOnly",
|
||||
"${dep.group}:${dep.name}-natives-$os:${dep.version}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
for (feature in extension.orxFeatures.get()) {
|
||||
target.dependencies.add("implementation", feature)
|
||||
val dep = feature.get()
|
||||
when (dep.name) {
|
||||
"orx-kinect-v1" -> target.dependencies.add(
|
||||
"runtimeOnly",
|
||||
"${dep.group}:${dep.name}-natives-$os:${dep.version}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
target.gradle.removeListener(this)
|
||||
}
|
||||
|
||||
override fun afterResolve(dependencies: ResolvableDependencies) {
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
openrndr.tasks=true
|
||||
kotlin.code.style=official
|
||||
org.gradle.unsafe.configuration-cache=false
|
||||
|
||||
#org.gradle.configuration-cache=true
|
||||
#org.gradle.configuration-cache.problems=warn
|
||||
@@ -1,15 +1,18 @@
|
||||
[versions]
|
||||
kotlin = "1.8.21"
|
||||
openrndr = "0.4.3"
|
||||
orx = "0.4.3"
|
||||
kotlin = "2.0.0"
|
||||
openrndr = "0.4.5-SNAPSHOT"
|
||||
orx = "0.4.5-SNAPSHOT"
|
||||
orml = "0.4.1"
|
||||
jvmTarget = "17"
|
||||
|
||||
slf4j = "2.0.7"
|
||||
log4j = "2.20.0"
|
||||
jackson = "2.14.2"
|
||||
|
||||
slf4j = "2.0.13"
|
||||
log4j = "2.23.1"
|
||||
jackson = "2.17.1"
|
||||
|
||||
[libraries]
|
||||
kotlin-script-runtime = { group = "org.jetbrains.kotlin", name = "kotlin-script-runtime", version.ref = "kotlin" }
|
||||
kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
|
||||
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
|
||||
slf4j-nop = { group = "org.slf4j", name = "slf4j-nop", version.ref = "slf4j" }
|
||||
@@ -19,15 +22,53 @@ 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-json = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version.ref = "jackson" }
|
||||
|
||||
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.6.4" }
|
||||
kotlin-logging = { group = "io.github.microutils", name = "kotlin-logging", version = "3.0.5" }
|
||||
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.8.1" }
|
||||
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging", version = "6.0.9" }
|
||||
junit = { group = "junit", name = "junit", version = "4.13.2" }
|
||||
jsoup = { group = "org.jsoup", name = "jsoup", version = "1.16.1" }
|
||||
gson = { group = "com.google.code.gson", name = "gson", version = "2.10.1" }
|
||||
csv = { group = "com.github.doyaaaaaken", name = "kotlin-csv-jvm", version = "1.9.0" }
|
||||
jsoup = { group = "org.jsoup", name = "jsoup", version = "1.17.2" }
|
||||
gson = { group = "com.google.code.gson", name = "gson", version = "2.11.1" }
|
||||
csv = { group = "com.github.doyaaaaaken", name = "kotlin-csv-jvm", version = "1.9.3" }
|
||||
|
||||
openrndr-animatable = { group = "org.openrndr", name = "openrndr-animatable", version.ref = "openrndr" }
|
||||
openrndr-application = { group = "org.openrndr", name = "openrndr-application", version.ref = "openrndr" }
|
||||
openrndr-binpack = { group = "org.openrndr", name = "openrndr-binpack", version.ref = "openrndr" }
|
||||
openrndr-dialogs = { group = "org.openrndr", name = "openrndr-dialogs", version.ref = "openrndr" }
|
||||
openrndr-event = { group = "org.openrndr", name = "openrndr-event", version.ref = "openrndr" }
|
||||
openrndr-extensions = { group = "org.openrndr", name = "openrndr-extensions", version.ref = "openrndr" }
|
||||
openrndr-filter = { group = "org.openrndr", name = "openrndr-filter", version.ref = "openrndr" }
|
||||
openrndr-gl3 = { group = "org.openrndr", name = "openrndr-gl3", version.ref = "openrndr" }
|
||||
openrndr-math = { group = "org.openrndr", name = "openrndr-math", version.ref = "openrndr" }
|
||||
openrndr-ffmpeg = { group = "org.openrndr", name = "openrndr-ffmpeg", version.ref = "openrndr" }
|
||||
openrndr-nullgl = { group = "org.openrndr", name = "openrndr-nullgl", version.ref = "openrndr" }
|
||||
|
||||
|
||||
orx-camera = { group = "org.openrndr.extra", name = "orx-camera", version.ref = "orx" }
|
||||
orx-color = { group = "org.openrndr.extra", name = "orx-color", version.ref = "orx" }
|
||||
orx-compositor = { group = "org.openrndr.extra", name = "orx-compositor", version.ref = "orx" }
|
||||
orx-delegate-magic = { group = "org.openrndr.extra", name = " orx-delegate-magic", version.ref = "orx" }
|
||||
orx-envelopes = { group = "org.openrndr.extra", name = "orx-envelopes", version.ref = "orx" }
|
||||
orx-fx = { group = "org.openrndr.extra", name = "orx-fx", version.ref = "orx" }
|
||||
orx-gui = { group = "org.openrndr.extra", name = "orx-gui", version.ref = "orx" }
|
||||
orx-image-fit = { group = "org.openrndr.extra", name = "orx-image-fit", version.ref = "orx" }
|
||||
orx-no-clear = { group = "org.openrndr.extra", name = "orx-no-clear", version.ref = "orx" }
|
||||
orx-noise = { group = "org.openrndr.extra", name = "orx-noise", version.ref = "orx" }
|
||||
orx-olive = { group = "org.openrndr.extra", name = "orx-olive", version.ref = "orx" }
|
||||
orx-panel = { group = "org.openrndr.extra", name = "orx-panel", version.ref = "orx" }
|
||||
orx-shade-styles = { group = "org.openrndr.extra", name = "orx-shade-styles", version.ref = "orx" }
|
||||
orx-shapes = { group = "org.openrndr.extra", name = "orx-shapes", version.ref = "orx" }
|
||||
orx-svg = { group = "org.openrndr.extra", name = "orx-svg", version.ref = "orx" }
|
||||
|
||||
orx-video-profiles = { group = "org.openrndr.extra", name = "orx-video-profiles", version.ref = "orx" }
|
||||
orx-view-box = { group = "org.openrndr.extra", name = "orx-view-box", version.ref = "orx" }
|
||||
|
||||
shadow-gradle-plugin = { group = "com.github.johnrengelman", name = "shadow", version = "8.1.1" }
|
||||
runtime-gradle-plugin = { group = "org.beryx", name = "badass-runtime-plugin", version = "1.13.0" }
|
||||
|
||||
|
||||
[plugins]
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
shadow = { id = "com.github.johnrengelman.shadow", version = "7.1.2" }
|
||||
runtime = { id = "org.beryx.runtime", version = "1.13.0" }
|
||||
|
||||
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
|
||||
runtime = { id = "org.beryx.runtime", version = "1.13.1" }
|
||||
gitarchive-tomarkdown = { id = "org.openrndr.extra.gitarchiver.tomarkdown", version.ref = "orx" }
|
||||
versions = { id = "com.github.ben-manes.versions", version = "0.50.0" }
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
22
gradlew
vendored
22
gradlew
vendored
@@ -83,7 +83,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -130,18 +131,21 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -198,11 +202,11 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
Reference in New Issue
Block a user