Skip to content
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

Optimize dependency resolution via platform module #2915

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
7 changes: 1 addition & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ checkerframework = "3.44.0"
codehaus-woodstox = "4.2.2"
commons-cli = "1.9.0"
commons-codec = "1.17.1"
commons-collections = "3.2.2"
commons-io = "2.15.1"
cutterslade-analyze = "1.10.0"
cybozulabs-langdetect = "1.1-20120112"
Expand All @@ -101,8 +100,6 @@ google-cloud-nio = "0.127.3"
google-cloud-storage = "2.27.0"
google-errorprone = "2.31.0"
# @keep for version alignment
google-failureaccess = "1.0.2"
# @keep for version alignment
google-gson = "2.11.0"
google-guava = "33.1.0-jre"
# @keep for version alignment
Expand All @@ -111,7 +108,6 @@ google-j2objc = "3.0.0"
google-javaformat = "1.18.1"
# @keep for version alignment
google-protobuf = "3.25.3"
google-re2j = "1.7"
# @keep Gradle version to run the build
gradle = "8.10"
grpc = "1.65.1"
Expand Down Expand Up @@ -293,7 +289,6 @@ checkerframework-qual = { module = "org.checkerframework:checker-qual", version.
codehaus-woodstox-stax2api = { module = "org.codehaus.woodstox:stax2-api", version.ref = "codehaus-woodstox" }
commonscli-commonscli = { module = "commons-cli:commons-cli", version.ref = "commons-cli" }
commonscodec-commonscodec = { module = "commons-codec:commons-codec", version.ref = "commons-codec" }
commonscollections-commonscollections = { module = "commons-collections:commons-collections", version.ref = "commons-collections" }
commonsio-commonsio = { module = "commons-io:commons-io", version.ref = "commons-io" }
cybozulabs-langdetect = { module = "com.cybozu.labs:langdetect", version.ref = "cybozulabs-langdetect" }
dropwizard-metrics-core = { module = "io.dropwizard.metrics:metrics-core", version.ref = "dropwizard-metrics" }
Expand Down Expand Up @@ -361,7 +356,6 @@ google-j2objc-annotations = { module = "com.google.j2objc:j2objc-annotations", v
# @keep transitive dependency for version alignment
google-protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "google-protobuf" }
google-protobuf-javautils = { module = "com.google.protobuf:protobuf-java-util", version.ref = "google-protobuf" }
google-re2j = { module = "com.google.re2j:re2j", version.ref = "google-re2j" }
# @keep transitive dependency for version alignment
grpc-api = { module = "io.grpc:grpc-api", version.ref = "grpc" }
# @keep transitive dependency for version alignment
Expand Down Expand Up @@ -414,6 +408,7 @@ netty-tcnative-boringssl = { module = "io.netty:netty-tcnative-boringssl-static"
netty-tcnative-classes = { module = "io.netty:netty-tcnative-classes", version.ref = "netty-tcnative" }
# @keep transitive dependency for version alignment
netty-transport-classes-epoll = { module = "io.netty:netty-transport-classes-epoll", version.ref = "netty" }
# @keep transitive dependency for version alignment
netty-transport-native-epoll = { module = "io.netty:netty-transport-native-epoll", version.ref = "netty" }
nimbusds-josejwt = { module = "com.nimbusds:nimbus-jose-jwt", version.ref = "nimbusds-josejwt" }
openjdk-jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "openjdk-jmh" }
Expand Down
245 changes: 0 additions & 245 deletions gradle/validation/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,254 +64,9 @@ allprojects {
replacedBy("org.hamcrest:hamcrest", "hamcrest-core was renamed to hamcrest")
}
}

constraints { handler ->
consolidatedConfigurations.configureEach { Configuration conf ->
// Add BOMs as they resolve many dependency conflicts
handler.add(conf.name, libs.amazon.awssdk.bom, {
because 'version alignment with known BOM for consistency across project'
})
handler.add(conf.name, libs.google.cloud.bom, {
because 'version alignment with known BOM for consistency across project'
})
handler.add(conf.name, libs.fasterxml.jackson.bom, {
because 'version alignment with known BOM for consistency across project'
})
handler.add(conf.name, libs.opentelemetry.bom, {
because 'version alignment with known BOM for consistency across project'
})
handler.add(conf.name, libs.grpc.bom, {
because 'version alignment with known BOM for consistency across project'
})
handler.add(conf.name, libs.netty.bom, {
because 'version alignment with known BOM for consistency across project'
})

// Add known dependencies that have multiple versions as constraints
// to align versions
handler.add(conf.name, libs.google.guava, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.google.errorprone.annotations, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.commons.exec, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.xerial.snappy.java, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.grpc.context, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.commonscli.commonscli, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.commonscodec.commonscodec, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.commonsio.commonsio, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.junit.junit, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.grpc.core, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.grpc.protobuf, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.jakarta.annotation.api, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.commons.lang3, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.grpc.stub, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.eclipse.jetty.server, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.fasterxml.woodstox.core, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.slf4j.api, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.slf4j.jultoslf4j, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.commons.compress, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.benmanes.caffeine, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.carrotsearch.hppc, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.log4j.api, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.grpc.api, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.slf4j.jcloverslf4j, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.netty.codechttp, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.bc.jose4j, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.lmax.disruptor, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.httpcomponents.httpclient, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.httpcomponents.httpcore, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.httpcomponents.httpmime, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.zookeeper.zookeeper, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.apache.zookeeper.jute, {
because 'version alignment for consistency across project'
})
handler.add(conf.name, libs.hamcrest.hamcrest, {
because 'version alignment for consistency across project'
})

// Add transitive dependencies as constraints to align versions
handler.add(conf.name, libs.checkerframework.qual, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.google.guava)} uses 3.42.0" +
"\n- ${getFullName(libs.benmanes.caffeine)} uses 3.37.0" +
"\n- ${getFullName(libs.google.cloud.storage)} uses 3.44.0"
})
handler.add(conf.name, libs.ow2.asm, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.apache.lucene.expressions)} uses 7.2" +
"\n- ${getFullName(libs.apache.tika.parsers)} uses 9.3"
})
handler.add(conf.name, libs.google.protobuf.java, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.google.errorprone.core)} uses 3.19.6" +
"\n- ${getFullName(libs.apache.tika.parsers)} uses 3.21.5" +
"\n- ${getFullName(libs.apache.calcite.avatica.core)} uses 3.21.9" +
"\n- ${getFullName(libs.google.cloud.storage)} uses 3.25.3" +
"\n- ${getFullName(libs.google.cloud.core)} uses 3.25.3"
})
handler.add(conf.name, libs.google.gson, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.grpc.core)} uses 2.10.1" +
"\n- ${getFullName(libs.apache.tika.parsers)} uses 2.9.1" +
"\n- ${getFullName(libs.google.cloud.storage)} uses 2.11.0 and 2.10.1" +
"\n- ${getFullName(libs.google.protobuf.java)} uses 2.8.9" +
"\n- ${getFullName(libs.google.cloud.core)} uses 2.8.9 and 2.10.1" +
"\n- ${getFullName(libs.google.auth.oauth2http)} uses 2.10.1"
})
handler.add(conf.name, libs.google.autovalue.annotations, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.google.cloud.storage)} uses 1.10.4" +
"\n- ${getFullName(libs.google.cloud.corehttp)} uses 1.10.4" +
"\n- ${getFullName(libs.google.cloud.core)} uses 1.10.4" +
"\n- ${getFullName(libs.google.api.gax)} uses 1.10.4" +
"\n- ${getFullName(libs.google.auth.oauth2http)} uses 1.10.4" +
"\n- ${getFullName(libs.google.cloud.bom)} uses 1.10.4" +
"\n- ${getFullName(libs.google.errorprone.core)} uses 1.9"
})
handler.add(conf.name, libs.apache.commons.text, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.apache.calcite.core)} uses 1.11.0" +
"\n- ${getFullName(libs.apache.commons.configuration2)} uses 1.12.0"
})
handler.add(conf.name, libs.grpc.util, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.google.cloud.storage)} uses 1.62.2" +
"\n- ${getFullName(libs.grpc.netty)} uses 1.65.1"
})
handler.add(conf.name, libs.jodatime.jodatime, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.amazon.awssdk.sdkcore)} uses 2.8.1" +
"\n- ${getFullName(libs.apache.tika.parsers)} uses 2.2"
})
handler.add(conf.name, libs.google.api.grpc.proto, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.grpc.protobuf.asProvider())} uses 2.29.0" +
"\n- ${getFullName(libs.google.api.gax)} uses 2.41.0" +
"\n- ${getFullName(libs.google.api.grpc.proto)} uses 2.41.0" +
"\n- ${getFullName(libs.google.cloud.core)} uses 2.41.0" +
"\n- ${getFullName(libs.google.cloud.storage)} uses 2.41.0"
})
handler.add(conf.name, libs.netty.handler, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.apache.zookeeper.zookeeper)} uses 4.1.105.Final" +
"\n- ${getFullName(libs.netty.codechttp)} uses 4.1.112.Final"
})
handler.add(conf.name, libs.grpc.protobuf.lite, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.google.cloud.storage)} uses 1.62.2" +
"\n- ${getFullName(libs.grpc.protobuf.asProvider())} uses 1.65.1"
})
handler.add(conf.name, libs.jaxb.runtime, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.apache.tika.parsers)} uses 2.3.5" +
"\n- ${getFullName(libs.adobe.testing.s3mock.testsupportcommon)} uses 2.3.8"
})
handler.add(conf.name, libs.perfmark.api, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.grpc.core)} uses 0.26.0" +
"\n- ${getFullName(libs.grpc.netty)} uses 0.26.0" +
"\n- ${getFullName(libs.google.cloud.storage)} uses 0.27.0"
})
handler.add(conf.name, libs.netty.tcnative.boringssl, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.netty.bom)} uses 2.0.66.Final" +
"\n- ${getFullName(libs.apache.zookeeper.zookeeper)} uses 2.0.61.Final"
})
handler.add(conf.name, libs.netty.transport.classes.epoll, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.netty.bom)} uses 4.1.114.Final" +
"\n- ${getFullName(libs.apache.zookeeper.zookeeper)} uses 4.1.105.Final"
})
handler.add(conf.name, libs.netty.transport.native.epoll, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.netty.bom)} uses 4.1.114.Final" +
"\n- ${getFullName(libs.apache.zookeeper.zookeeper)} uses 4.1.105.Final"
})
handler.add(conf.name, libs.google.j2objc.annotations, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.google.guava)} uses 3.0.0" +
"\n- ${getFullName(libs.google.protobuf.javautils)} uses 2.8"
})
handler.add(conf.name, libs.apiguardian.api, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.apache.calcite.core)} uses 1.1.2" +
"\n- ${getFullName(libs.junit.junit)} (api) uses 1.1.0"
})
handler.add(conf.name, libs.hk2.locator, {
because "transitive version alignment for consistency across project" +
"\n- ${getFullName(libs.jersey.inject.hk2)} uses 3.0.6" +
"\n- ${getFullName(libs.hk2.api)} uses 3.1.1"
})
}
}
}
}

static def getFullName(Provider<MinimalExternalModuleDependency> dependency) {
def resolvedDep = dependency.get()
return "${resolvedDep.module.group}:${resolvedDep.module.name}"
}

// Configure version catalog cleanups plugin.
configure(rootProject) {
apply plugin: libs.plugins.littlerobots.versioncatalogupdate.get().pluginId
Expand Down
2 changes: 2 additions & 0 deletions gradle/validation/error-prone.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ allprojects { prj ->
errorprone
}
dependencies {
errorprone platform(project(":platform"))
errorprone libs.google.errorprone.core
}
configurations.annotationProcessor.extendsFrom(configurations.errorprone)
} else {
prj.apply plugin: libs.plugins.ltgt.errorprone.get().pluginId

dependencies {
errorprone platform(project(":platform"))
errorprone libs.google.errorprone.core
}

Expand Down
Loading
Loading