Refactor template using buildSrc, feature variants and published version catalogs (#56)

Co-authored-by: Abe Pazos <abe@hamoid.com>
This commit is contained in:
Edwin Jakobs
2025-09-17 01:36:48 -07:00
committed by GitHub
parent e97ef57b78
commit 4bdb7f95d7
11 changed files with 347 additions and 373 deletions

View File

@@ -1,4 +1,4 @@
rootProject.name = "openrndr-template"
rootProject.name = extra["project.name"]?.toString() ?: error("project.name not set")
pluginManagement {
repositories {
@@ -6,3 +6,30 @@ pluginManagement {
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")
}
}
}