Add publish-library convention plugin
This commit is contained in:
@@ -11,6 +11,18 @@ dependencyResolutionManagement {
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
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")
|
||||
val mainImplementation = project.configurations.getByName(main.implementationConfigurationName)
|
||||
|
||||
|
||||
val demoImplementation = project.configurations.getByName(demo.implementationConfigurationName)
|
||||
//demoImplementation.dependencies.addAll(mainImplementation.dependencies)
|
||||
//
|
||||
//val demo by sourceSets.creating {
|
||||
//
|
||||
//
|
||||
//}
|
||||
demoImplementation.extendsFrom(mainImplementation)
|
||||
|
||||
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")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user