Skip to content

Commit

Permalink
Add dependencies BOM (#2210)
Browse files Browse the repository at this point in the history
* Add dependencies BOM
Motivation:
The current ServiceTalk BOM file includes only ServiceTalk modules and
does not include version information for the external dependencies
referenced by ServiceTalk. This information can be found transitively
but it is beneficial to be explicitly include it all in a BOM file.
Modifications:
Add an additional BOM `servicetalk-dependencies` which includes both
ServiceTalk modules and BOMs and versions for external dependencies.
Result:
An additional ServiceTalk BOM which can improve dependency version
resolution by explicitly identifying the preferred and tested
versions of external components which ServiceTalk utilizes.
  • Loading branch information
bondolo authored May 16, 2022
1 parent 48a0c54 commit bff3378
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 8 deletions.
9 changes: 6 additions & 3 deletions servicetalk-bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-core"
apply plugin: "java-platform"

rootProject.subprojects.findAll { !it.name.contains("bom") && !it.name.contains("examples") &&
description="ServiceTalk BOM that includes all modules"

rootProject.subprojects.findAll { !it.name.endsWith("-bom") && !it.name.endsWith("-dependencies") &&
!it.name.contains("examples") &&
!it.name.equals("grpc") && !it.name.equals("http") }.each {
dependencies.constraints.add("api", it)
dependencies.constraints.add(it.name.endsWith("-internal") ? "runtime" : "api", it )
}

// Keep publishing and signing configuration in sync with ServiceTalkLibraryPlugin.groovy from
Expand All @@ -31,7 +34,7 @@ publishing {
from components.javaPlatform
pom {
name = project.name
description = 'A networking framework that evolves with your application'
description = project.description
url = 'https://servicetalk.io'
licenses {
license {
Expand Down
123 changes: 123 additions & 0 deletions servicetalk-dependencies/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* Copyright © 2018-2019 Apple Inc. and the ServiceTalk project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-core"
apply plugin: "java-platform"

description = "ServiceTalk BOM that includes direct dependencies"

javaPlatform {
allowDependencies()
}

dependencies {
api platform(project(":servicetalk-bom"))
api platform("io.netty:netty-bom:${nettyVersion}")
api platform("org.glassfish.jersey:jersey-bom:$jerseyVersion")

constraints {
// Use `api` only for dependencies whose types appear in ServiceTalk API.
api "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
api "com.google.api.grpc:proto-google-common-protos:$protoGoogleCommonProtosVersion"
api "com.google.protobuf:protobuf-java:$protobufVersion"
api "io.opentracing:opentracing-api:$openTracingVersion"
api "io.zipkin.reporter2:zipkin-reporter:$zipkinReporterVersion"
// `spi` and `core` types exposed in `log4j2-mdc-utils`
api "org.apache.logging.log4j:log4j-core:$log4jVersion"
api "jakarta.ws.rs:jakarta.ws.rs-api:$jaxRsVersion"
// Matchers are exposed by `servicetalk-test-resources`
api "org.hamcrest:hamcrest:$hamcrestVersion"
api "org.reactivestreams:reactive-streams:$reactiveStreamsVersion"
// Use `runtime` for dependencies which are used for implementation
runtime "com.google.code.findbugs:jsr305:$jsr305Version"
runtime "com.google.protobuf:protobuf-java-util:$protobufVersion"
runtime "com.sun.activation:jakarta.activation:$javaxActivationVersion"
runtime "com.sun.xml.bind:jaxb-core:$javaxJaxbCoreVersion"
runtime "com.sun.xml.bind:jaxb-impl:$javaxJaxbImplVersion"
runtime "jakarta.xml.bind:jakarta.xml.bind-api:$javaxJaxbApiVersion"
runtime "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
runtime "org.jctools:jctools-core:$jcToolsVersion"
runtime "org.openjdk.jmh:jmh-core:$jmhCoreVersion"
runtime "org.slf4j:slf4j-api:$slf4jVersion"
}
}

// Keep publishing and signing configuration in sync with ServiceTalkLibraryPlugin.groovy from
// servicetalk-gradle-plugin-internal
publishing {
publications {
mavenJava(MavenPublication) {
// publish POM
from components.javaPlatform
pom {
name = project.name
description = project.description
url = 'https://servicetalk.io'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'servicetalk-project-authors'
name = 'ServiceTalk project authors'
email = '[email protected]'
}
}
scm {
connection = "scm:git:git://${scmHost}/${scmPath}.git"
developerConnection = "scm:git:ssh://${scmHost}:${scmPath}.git"
url = "https://${scmHost}/${scmPath}"
}
issueManagement {
system = 'ServiceTalk Issues'
url = "${issueManagementUrl}"
}
ciManagement {
system = 'ServiceTalk CI'
url = "${ciManagementUrl}"
}
}
}
}

if (!repositories) {
repositories {
maven {
name = "sonatype"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = project.isReleaseBuild ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_TOKEN")
}
}
}
}
}

if (!!findProperty("signingKey") && !!findProperty("signingPassword")) {
pluginManager.apply("signing")
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
}
1 change: 1 addition & 0 deletions servicetalk-opentracing-log4j2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
implementation project(":servicetalk-opentracing-asynccontext")
implementation "com.google.code.findbugs:jsr305:$jsr305Version"
implementation "org.apache.logging.log4j:log4j-api:$log4jVersion"
implementation "org.apache.logging.log4j:log4j-core:$log4jVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"

testImplementation testFixtures(project(":servicetalk-log4j2-mdc-utils"))
Expand Down
2 changes: 1 addition & 1 deletion servicetalk-test-resources/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This module provides internal common resources to be used for ServiceTalk tests.
The useful resources provided are:

* Certificates and Keys
* Log4J configuration file
* Log4J configuration file (and Log4J runtime dependencies)
This module should be included as a dependency in other ServiceTalk modules as:

Expand Down
9 changes: 5 additions & 4 deletions servicetalk-test-resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-library"
dependencies {
testImplementation enforcedPlatform("org.junit:junit-bom:$junit5Version")

api "org.apache.logging.log4j:log4j-core:$log4jVersion"
api "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
api "org.hamcrest:hamcrest:$hamcrestVersion"

implementation project(":servicetalk-annotations")
implementation project(":servicetalk-utils-internal")

api "org.hamcrest:hamcrest:$hamcrestVersion"

implementation "org.apache.logging.log4j:log4j-core:$log4jVersion"
implementation "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"

testImplementation "org.junit.jupiter:junit-jupiter-api"
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ include "servicetalk-annotations",
"servicetalk-data-jackson-jersey",
"servicetalk-data-protobuf-jersey",
"servicetalk-data-protobuf",
"servicetalk-dependencies",
"servicetalk-dns-discovery-netty",
"servicetalk-encoding-api",
"servicetalk-encoding-api-internal",
Expand Down

0 comments on commit bff3378

Please sign in to comment.