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

chore: migrate to toml dependencies #56

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
51 changes: 51 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[versions]
hypertrace-grpcUtils = "0.9.0"

guice = "5.1.0"
grpc = "1.48.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
grpc = "1.48.0"
grpc = "1.50.0"

(that's the version it'll get from grpcutils anyway)

jetty = "9.4.48.v20220622"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well bump this to latest too

Suggested change
jetty = "9.4.48.v20220622"
jetty = "9.4.49.v20220914"

micrometer = "1.9.5"
dropwizardMetrics = "4.2.10"
prometheus = "0.12.0"
mockito = "4.8.1"

[libraries]
hypertrace-grpc-client-utils = { module = "org.hypertrace.core.grpcutils:grpc-client-utils", version.ref = "hypertrace-grpcUtils"}
hypertrace-grpc-server-utils = { module = "org.hypertrace.core.grpcutils:grpc-server-utils", version.ref = "hypertrace-grpcUtils"}

grpc-api = { module = "io.grpc:grpc-api", version.ref = "grpc" }
grpc-core = { module = "io.grpc:grpc-core", version.ref = "grpc" }
grpc-services = { module = "io.grpc:grpc-services", version.ref = "grpc" }

google-guice = { module = "com.google.inject:guice", version.ref = "guice" }
google-guice-servlet = { module = "com.google.inject.extensions:guice-servlet", version.ref = "guice" }
jetty-servlet = { module = "org.eclipse.jetty:jetty-servlet", version.ref = "jetty" }
jetty-servlets = { module = "org.eclipse.jetty:jetty-servlets", version.ref = "jetty" }
jetty-server = { module = "org.eclipse.jetty:jetty-server", version.ref = "jetty" }
jetty-http = { module = "org.eclipse.jetty:jetty-http", version.ref = "jetty" }
javax-servlet-api = { module = "javax.servlet:javax.servlet-api", version = "4.0.1" }
dropwizard-metrics-core = {module = "io.dropwizard.metrics:metrics-core", version.ref = "dropwizardMetrics" }
dropwizard-metrics-jvm = { module = "io.dropwizard.metrics:metrics-jvm", version.ref = "dropwizardMetrics" }
dropwizard-metrics-servlets = { module = "io.dropwizard.metrics:metrics-servlets", version.ref = "dropwizardMetrics" }
prometheus-dropwizard = { module = "io.prometheus:simpleclient_dropwizard", version.ref = "prometheus" }
prometheus-servlet = { module = "io.prometheus:simpleclient_servlet", version.ref = "prometheus" }
prometheus-pushgateway = { module = "io.prometheus:simpleclient_pushgateway", version.ref = "prometheus" }

micrometer-core = { module = "io.micrometer:micrometer-core", version.ref = "micrometer" }
micrometer-registry-prometheus = { module = "io.micrometer:micrometer-registry-prometheus", version.ref = "micrometer" }
micrometer-jvm-extras = { module = "io.github.mweirauch:micrometer-jvm-extras", version = "0.2.2" }

awaitility = { module = "org.awaitility:awaitility", version = "4.0.3" }
google-guava = { module = "com.google.guava:guava", version = "31.1-jre" }
typesafe-config = { module = "com.typesafe:config", version = "1.4.2" }
lombok = { module = "org.projectlombok:lombok", version = "1.18.22" }
slf4j-api = { module = "org.slf4j:slf4j-api", version = "1.7.32" }
apache-log4j-slf4jImpl = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version = "2.17.1" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
apache-log4j-slf4jImpl = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version = "2.17.1" }
apache-log4j-slf4jImpl = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version = "2.19.0" }

apache-httpclient = { module = "org.apache.httpcomponents:httpclient", version = "4.5.13" }

junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version = "5.8.2" }
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
mockito-junit = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }

[bundles]
mockito = ["mockito-core", "mockito-junit"]
8 changes: 4 additions & 4 deletions integrationtest-service-framework/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ tasks.test {
}

dependencies {
implementation(project(":platform-service-framework"))
implementation(projects.platformServiceFramework)

// Configuration
implementation("com.typesafe:config:1.4.2")
implementation(libs.typesafe.config)
// Logging
implementation("org.slf4j:slf4j-api:1.7.36")
implementation("org.awaitility:awaitility:4.0.3")
implementation(libs.slf4j.api)
implementation(libs.awaitility)
}
21 changes: 10 additions & 11 deletions platform-grpc-service-framework/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ plugins {
}

dependencies {
api(project(":platform-service-framework"))
api(platform("io.grpc:grpc-bom:1.47.0"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you missed the grpc-bom - that's key!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that was needed to sync grpc versions across (which is now achieved via toml), since other grpc libraries didn't really had versions mentioned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably should have explained and messaged this, I just started doing it inconsistently 😳

So the idea of the BOM is that by declaring it here, it should get inherited when this library is used as a dependency. The version catalog helps us declare versions consistently within a project, but the bom helps us resolve consistently across projects.

As an example of this, a common issue we see:
Imagine query service API was using grpc 1.50.0, and gateway service, running grpc 1.45.1 upgrades its query service api. it would inherit certain dependencies (grpc-stub, grpc-api etc.) at 1.50.0, but it would also have other grpc dependencies of its own (e.g. grpc-netty) at 1.45.1 leading to a version mismatch and runtime errors. By including the bom with our api's dependencies, we should (hopefully!) see grpc-netty upgraded to 1.50.0 instead. In this position, it actually works in the reverse direction - if an API were to bring in a lower version of a grpc lib that was not otherwise declared (less common scenario, since usually the servers have more grpc libs than the api packages), this would bring it up to the server's specified version.

api("io.grpc:grpc-api")
api("io.grpc:grpc-services")
api("org.hypertrace.core.grpcutils:grpc-client-utils:0.7.6")
api("com.typesafe:config:1.4.2")
api(project(":service-framework-spi"))
api(projects.platformServiceFramework)
api(libs.grpc.api)
api(libs.grpc.services)
api(libs.hypertrace.grpc.client.utils)
api(libs.typesafe.config)
api(projects.serviceFrameworkSpi)

annotationProcessor("org.projectlombok:lombok:1.18.24")
compileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor(libs.lombok)
compileOnly(libs.lombok)

implementation("org.slf4j:slf4j-api:1.7.36")
implementation("org.hypertrace.core.grpcutils:grpc-server-utils:0.7.6")
implementation(libs.slf4j.api)
implementation(libs.hypertrace.grpc.server.utils)
}
28 changes: 14 additions & 14 deletions platform-http-service-framework/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ plugins {
}

dependencies {
api(project(":platform-service-framework"))
api("org.hypertrace.core.grpcutils:grpc-client-utils:0.7.6")
api("com.typesafe:config:1.4.2")
api("javax.servlet:javax.servlet-api:4.0.1")
api("com.google.inject:guice:5.1.0")
api(project(":service-framework-spi"))
api(projects.platformServiceFramework)
api(libs.hypertrace.grpc.client.utils)
api(libs.typesafe.config)
api(libs.javax.servlet.api)
api(libs.google.guice)
api(projects.serviceFrameworkSpi)

implementation("org.slf4j:slf4j-api:1.7.36")
implementation("com.google.inject.extensions:guice-servlet:5.1.0")
implementation("com.google.guava:guava:31.1-jre")
implementation("org.eclipse.jetty:jetty-servlet:9.4.48.v20220622")
implementation("org.eclipse.jetty:jetty-server:9.4.48.v20220622")
implementation("org.eclipse.jetty:jetty-servlets:9.4.48.v20220622")
implementation(libs.slf4j.api)
implementation(libs.google.guice.servlet)
implementation(libs.google.guava)
implementation(libs.jetty.servlet)
implementation(libs.jetty.server)
implementation(libs.jetty.servlets)

annotationProcessor("org.projectlombok:lombok:1.18.24")
compileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor(libs.lombok)
compileOnly(libs.lombok)

}
30 changes: 15 additions & 15 deletions platform-metrics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ tasks.test {
}

dependencies {
api("com.typesafe:config:1.4.2")
api("io.dropwizard.metrics:metrics-core:4.2.10")
api("io.micrometer:micrometer-core:1.5.3")
api("javax.servlet:javax.servlet-api:3.1.0")
api(libs.typesafe.config)
api(libs.dropwizard.metrics.core)
api(libs.micrometer.core)
api(libs.javax.servlet.api)

implementation("io.micrometer:micrometer-registry-prometheus:1.7.5")
implementation(libs.micrometer.registry.prometheus)

implementation("io.github.mweirauch:micrometer-jvm-extras:0.2.0")
implementation("org.slf4j:slf4j-api:1.7.36")
implementation("io.dropwizard.metrics:metrics-jvm:4.2.10")
implementation("io.prometheus:simpleclient_dropwizard:0.12.0")
implementation("io.prometheus:simpleclient_servlet:0.12.0")
implementation("io.prometheus:simpleclient_pushgateway:0.12.0")
implementation("org.eclipse.jetty:jetty-servlet:9.4.48.v20220622")
implementation ("com.google.guava:guava:30.1.1-jre")
implementation(libs.micrometer.jvm.extras)
implementation(libs.slf4j.api)
implementation(libs.dropwizard.metrics.jvm)
implementation(libs.prometheus.dropwizard)
implementation(libs.prometheus.servlet)
implementation(libs.prometheus.pushgateway)
implementation(libs.jetty.servlet)
implementation (libs.google.guava)

testImplementation("org.junit.jupiter:junit-jupiter:5.7.1")
testImplementation("org.mockito:mockito-core:3.8.0")
testImplementation(libs.junit.jupiter)
testImplementation(libs.bundles.mockito)
}
38 changes: 20 additions & 18 deletions platform-service-framework/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,33 @@ tasks.test {
}

dependencies {
api(project(":service-framework-spi"))
implementation(project(":platform-metrics"))
api(projects.serviceFrameworkSpi)
implementation(projects.platformMetrics)

api("org.slf4j:slf4j-api:1.7.36")
api("com.typesafe:config:1.4.2")
api(libs.slf4j.api)
api(libs.typesafe.config)

// Use for thread dump servlet
implementation("io.dropwizard.metrics:metrics-servlets:4.2.10")
implementation("org.eclipse.jetty:jetty-servlet:9.4.48.v20220622")
implementation(libs.dropwizard.metrics.servlets)
implementation(libs.jetty.servlet)

// Use for metrics servlet
implementation("io.prometheus:simpleclient_servlet:0.12.0")
implementation(libs.prometheus.servlet)

// http client
implementation("org.apache.httpcomponents:httpclient:4.5.13")

constraints {
implementation("commons-codec:commons-codec:1.15") {
because("version 1.12 has a vulnerability https://snyk.io/vuln/SNYK-JAVA-COMMONSCODEC-561518")
implementation(libs.apache.httpclient)

testImplementation(libs.apache.log4j.slf4jImpl)
testImplementation(libs.junit.jupiter)
testImplementation(libs.bundles.mockito)
testImplementation(libs.jetty.servlet) {
artifact {
classifier = "tests"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this classifier?

}
}
testImplementation(libs.jetty.http) {
artifact {
classifier = "tests"
}
}

testImplementation("org.apache.logging.log4j:log4j-slf4j-impl:2.17.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.1")
testImplementation("org.mockito:mockito-core:3.8.0")
testImplementation("org.eclipse.jetty:jetty-servlet:9.4.48.v20220622:tests")
testImplementation("org.eclipse.jetty:jetty-http:9.4.48.v20220622:tests")
}
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ plugins {
id("org.hypertrace.version-settings") version "0.2.0"
}

enableFeaturePreview("VERSION_CATALOGS")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

include(":platform-grpc-service-framework")
include(":platform-http-service-framework")
include(":platform-service-framework")
Expand Down