Make use of version catalogs and variants

This commit is contained in:
Edwin Jakobs
2025-09-14 21:27:30 +02:00
parent 3d6774275a
commit 84f00fa827
9 changed files with 270 additions and 368 deletions

View File

@@ -1,8 +1,36 @@
import groovy.xml.dom.DOMCategory.attributes
rootProject.name = "openrndr-template"
ext.set("applicationMainClass", "TemplateProgramKt")
pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
}
}
dependencyResolutionManagement {
repositories {
mavenCentral()
mavenLocal {
include("org.openrndr")
}
}
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")
}
}
}