-
-
Notifications
You must be signed in to change notification settings - Fork 35
2.17 Gradle Platform and Catalog #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
elect86
wants to merge
19
commits into
FasterXML:2.19
Choose a base branch
from
elect86:2.17-gradle
base: 2.19
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
77da4b4
Flat versions, quick fix for Gradle consumers #81
abaa84f
add comment explaining the flattening
bf6903f
injecting Gradle Platform and Catalog within the same Maven publication
84dada1
Merge branch '2.19' into 2.17-gradle
cowtowncoder f46d642
Merge branch '2.19' into 2.17-gradle
cowtowncoder 4e3154f
Revert "Flat versions, quick fix for Gradle consumers #81"
58c84d1
Merge remote-tracking branch 'origin/2.17-gradle' into 2.17-gradle
d62f1e2
revert accidental .gitattributes changes
6585ce9
revert accidental .gitattributes changes
db848bb
remove the pom.xml comment
37b2818
Merge branch '2.19' into 2.17-gradle
cowtowncoder 41ee882
Merge branch '2.19' into 2.17-gradle
cowtowncoder 6e42d56
Merge branch '2.19' into 2.17-gradle
cowtowncoder dc04956
Merge branch '2.19' into 2.17-gradle
cowtowncoder 48c9849
Merge branch 'FasterXML:2.19' into 2.17-gradle
elect86 930ef8c
Added missing version specifications for Maven plugins
7560c80
Update Gradle wrapper to version 8.13
422528d
Merge branch '2.19' into 2.17-gradle
cowtowncoder 246bb97
Merge branch '2.19' into 2.17-gradle
cowtowncoder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.