feat: add version catalog and bom
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
c455aa42a8
commit
571bc58f80
@ -39,3 +39,5 @@ Common code for my java projects. Uses my common [build scripts](https://git.fro
|
||||
- commons-manifold: Some common code using the features of manifold-ext. Mainly extension classes.
|
||||
- commons-gson: Provides some utility classes around my fork of gson and an implementation of the `Serializer` interface
|
||||
- commons-unsafe: Provides wrappers around sun.misc.Unsafe and the LambdaMetaFactory
|
||||
- commons-bom: A maven BOM to make using multiple modules easier
|
||||
- commons-catalog: A gradle version catalog to make using multiple modules easier
|
55
commons-bom/build.gradle.kts
Normal file
55
commons-bom/build.gradle.kts
Normal file
@ -0,0 +1,55 @@
|
||||
plugins {
|
||||
`java-platform`
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
version = rootProject.version
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
if (project.hasProperty("maven")) {
|
||||
maven {
|
||||
url = uri(project.property("maven").toString())
|
||||
name = "dynamic"
|
||||
|
||||
credentials(PasswordCredentials::class) {
|
||||
username = System.getenv()["MAVEN_NAME"]
|
||||
password = System.getenv()["MAVEN_TOKEN"]
|
||||
}
|
||||
authentication {
|
||||
create<BasicAuthentication>("basic")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
groupId = "io.gitlab.jfronny"
|
||||
artifactId = "commons-bom"
|
||||
|
||||
from(components["javaPlatform"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(GenerateModuleMetadata::class) {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
constraints {
|
||||
for (proj in rootProject.allprojects) {
|
||||
if (proj == project || proj == rootProject) {
|
||||
continue
|
||||
}
|
||||
if (proj.name == "commons-catalog") {
|
||||
continue
|
||||
}
|
||||
|
||||
api(project(proj.path))
|
||||
}
|
||||
}
|
||||
}
|
65
commons-catalog/build.gradle.kts
Normal file
65
commons-catalog/build.gradle.kts
Normal file
@ -0,0 +1,65 @@
|
||||
plugins {
|
||||
`version-catalog`
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
version = rootProject.version
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
if (project.hasProperty("maven")) {
|
||||
maven {
|
||||
url = uri(project.property("maven").toString())
|
||||
name = "dynamic"
|
||||
|
||||
credentials(PasswordCredentials::class) {
|
||||
username = System.getenv()["MAVEN_NAME"]
|
||||
password = System.getenv()["MAVEN_TOKEN"]
|
||||
}
|
||||
authentication {
|
||||
create<BasicAuthentication>("basic")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
groupId = "io.gitlab.jfronny"
|
||||
artifactId = "commons-catalog"
|
||||
|
||||
from(components["versionCatalog"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(GenerateModuleMetadata::class) {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
tasks.register("configureCatalog") {
|
||||
doFirst {
|
||||
doConfigureCatalog()
|
||||
}
|
||||
}
|
||||
tasks.named("generateCatalogAsToml") {
|
||||
dependsOn("configureCatalog")
|
||||
}
|
||||
|
||||
fun doConfigureCatalog() {
|
||||
for (proj in rootProject.allprojects) {
|
||||
if (proj == project || proj == rootProject) {
|
||||
continue
|
||||
}
|
||||
|
||||
val catalogName = if (proj.name == "commons-bom") "bom" else proj.name
|
||||
|
||||
catalog {
|
||||
versionCatalog {
|
||||
library(catalogName, "$group:${proj.name}:${proj.version}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -31,5 +31,7 @@ include("commons-logger")
|
||||
include("commons-manifold")
|
||||
include("commons-gson")
|
||||
include("commons-unsafe")
|
||||
include("commons-bom")
|
||||
include("commons-catalog")
|
||||
|
||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
|
Loading…
Reference in New Issue
Block a user