Skip to content

Commit

Permalink
Cleanup jackson build tool dependencies (#83164)
Browse files Browse the repository at this point in the history
- use jackson platform
- use compatible schema validator version
  • Loading branch information
breskeby authored Jan 27, 2022
1 parent 5707b65 commit fd9887e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions build-tools-internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,9 @@ configurations {
integTestRuntimeOnly.extendsFrom(testRuntimeOnly)
}
dependencies {
constraints {
api("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.getProperty('jackson')}") {
version {
strictly "${versions.getProperty('jackson')}"
}
because 'We want to use the exact same jackson version we use in production'
}
}
components.all(JacksonAlignmentRule)
// Forcefully downgrade the jackson platform as used in production
api enforcedPlatform("com.fasterxml.jackson:jackson-bom:${versions.getProperty('jackson')}")
api localGroovy()
api gradleApi()

Expand All @@ -230,7 +225,8 @@ dependencies {
api 'de.thetaphi:forbiddenapis:3.2'
api 'com.avast.gradle:gradle-docker-compose-plugin:0.14.13'
api 'org.apache.maven:maven-model:3.6.2'
api 'com.networknt:json-schema-validator:1.0.65'
// needs to match the jackson minor version in use
api 'com.networknt:json-schema-validator:1.0.49'
api "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.getProperty('jackson')}"
api 'org.ow2.asm:asm:9.2'
api 'org.ow2.asm:asm-tree:9.2'
Expand Down Expand Up @@ -298,3 +294,14 @@ tasks.register("bootstrapPerformanceTests", Copy) {
def root = file('..')
filter(ReplaceTokens, tokens: [testGitCommit:GitInfo.gitInfo(root).revision])
}

abstract class JacksonAlignmentRule implements ComponentMetadataRule {
void execute(ComponentMetadataContext ctx) {
ctx.details.with {d ->
if (d.id.group.startsWith("com.fasterxml.jackson")) {
// declare that Jackson modules all belong to the Jackson virtual platform
belongsTo("com.fasterxml.jackson:jackson-bom:${d.id.version}")
}
}
}
}

0 comments on commit fd9887e

Please sign in to comment.