feat: add version catalog and bom
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Johannes Frohnmeyer 2024-04-22 11:11:10 +02:00
parent c455aa42a8
commit 571bc58f80
Signed by: Johannes
GPG Key ID: E76429612C2929F4
4 changed files with 124 additions and 0 deletions

View File

@ -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

View 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))
}
}
}

View 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}")
}
}
}
}

View File

@ -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")