Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# git config --global merge.ours.driver true
# (and if ever need to disable change `true` to `false`

Comment thread
cowtowncoder marked this conversation as resolved.
pom.xml merge=ours
pom.xml merge=ours
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ syntax: glob
*.ipr
*.iws
/.idea/

# Ignore Gradle project-specific cache directory
gradle/.gradle

# Ignore Gradle build output directory
gradle/build
81 changes: 81 additions & 0 deletions gradle/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import groovy.xml.XmlSlurper
import groovy.xml.slurpersupport.GPathResult
import groovy.xml.slurpersupport.NodeChild
import java.io.ByteArrayOutputStream

plugins {
`java-platform`
`version-catalog`
`maven-publish`
// id("org.gradlex.java-ecosystem-capabilities-base") // only rules
// id("org.gradlex.logging-capabilities") // logging extension
}

group = "com.fasterxml.jackson"
version = File("../pom.xml")
.readText()
.substringAfter("<groupId>com.fasterxml.jackson<")
.substringAfter("<version>")
.substringBefore('<')

javaPlatform {
allowDependencies()
}

val computeCatalogAndPlatform by tasks.registering(Exec::class) {

workingDir = projectDir.parentFile
commandLine("sh", "-c", "./mvnw -B -f pom.xml help:effective-pom")
standardOutput = ByteArrayOutputStream()

doLast {
val output = standardOutput
.toString()
// clean output from dirty
.substringAfter("Effective POMs, after inheritance, interpolation, and profiles are applied:")
.substringBefore("[INFO]")
.trim()

operator fun GPathResult.div(child: String) = children().find { (it!! as NodeChild).name() == child } as GPathResult

val bom = XmlSlurper().parseText(output).children().first() as GPathResult
val deps = bom / "dependencyManagement" / "dependencies"
val map = mutableMapOf<String, String>()
for (dep in deps.children()) {
val node = dep as NodeChild
val g = node / "groupId"
val a = node / "artifactId"
val v = node / "version"
val gav = "$g:$a:$v"

map["$a"] = gav
// println("$a, $gav")

catalog.versionCatalog { library("$a", gav) }
dependencies.constraints { api(gav) }
}

val bundles = listOf("dataformat", "datatype", "jaxrs", "jakarta-rs", "jr", "module")
for (bundle in bundles)
catalog.versionCatalog {
val bundleAlias = "jackson-$bundle"
val aliases = map.keys.filter { it.startsWith(bundleAlias) }
bundle(bundleAlias, aliases)
}
}
}

publishing {
publications {
create<MavenPublication>("jackson") {
from(components["javaPlatform"])
}
}
}

tasks {
// dependsOn runs only if the src is successful, finalizedBy not
generateCatalogAsToml { dependsOn(computeCatalogAndPlatform) }
val generateMetadataFileForJacksonPublication by getting { dependsOn(computeCatalogAndPlatform) }
register("generateCatalogAndPlatform") { dependsOn(generateMetadataFileForJacksonPublication, generateCatalogAsToml) }
}
Binary file added gradle/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
252 changes: 252 additions & 0 deletions gradle/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading