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

Add dependency-analysis-gradle-plugin #3158

Merged
merged 10 commits into from
Jan 3, 2025
2 changes: 1 addition & 1 deletion .github/workflows/ci-prq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Clean Gradle project
run: ./gradlew --parallel clean
- name: Build with Gradle
run: ./gradlew --parallel quality
run: ./gradlew --parallel -Pdependency.analysis.print.build.health=true quality
- name: Upload CheckStyle Results
if: always()
uses: actions/upload-artifact@v4
Expand Down
34 changes: 34 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,40 @@ if (!repositories) {
print("This machine already has some pre-configured repositories, will use: ${repositories*.name.join(", ")}")
}

buildscript {
if (!repositories) {
repositories {
gradlePluginPortal()
}
}
dependencies {
if (JavaVersion.current().isJava11Compatible()) {
classpath("com.autonomousapps:dependency-analysis-gradle-plugin:$dependencyAnalysisPluginVersion")
}
}
}

apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-root"

// Unfortunately, we can not make this validation part of our servicetalk-gradle-plugin-internal because it requires
// JDK11 while we build and package out plugin with JDK8.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/out/our

if (JavaVersion.current().isJava11Compatible()) {
apply plugin: "com.autonomousapps.dependency-analysis"

dependencyAnalysis {
issues {
all {
onAny {
severity("warn") // FIXME: switch to "fail" when all issues are addressed
Copy link
Member Author

Choose a reason for hiding this comment

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

This will change after all issues are resolved, will require a few follow-up PRs

exclude("com.google.code.findbugs:jsr305")
}
}
}
}

quality.dependsOn buildHealth
}

task validateLocalDocSite(type: Exec) {
group 'Documentation'
description 'Generate and validate servicetalk.io site documentation'
Expand All @@ -56,6 +88,8 @@ subprojects {
// mockito 5 only supports jdk11+
if (JavaVersion.current() < JavaVersion.VERSION_11) {
project.setProperty("mockitoCoreVersion", mockitoCorePreJdk11Version)
} else {
apply plugin: "com.autonomousapps.dependency-analysis"
}
// Used by ci-release.yaml to determine which modules need to be built/released with JDK11.
task printJavaTargetCompatibility {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ mockitoCoreVersion=5.14.2
# mockito version is overridden for <jdk11 due to incompatibilities with newer bytebuddy and class format
mockitoCorePreJdk11Version=4.11.0
spotbugsPluginVersion=5.0.13
dependencyAnalysisPluginVersion=2.6.1

apacheDirectoryServerVersion=1.5.7
commonsLangVersion=2.6
Expand Down
7 changes: 7 additions & 0 deletions servicetalk-data-jackson-jersey3-jakarta10/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ tasks.sourcesJar.dependsOn(copySourcesForJersey3)
tasks.compileJava.dependsOn(copySourcesForJersey3)
tasks.processTestResources.dependsOn(copySourcesForJersey3)
tasks.compileTestJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried many different ways to avoid this duplication. Unfortunately, nothing worked without bringing more problems. My gradle-foo is exhausted at this point 😢

dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE10}"
def actualJaxRsVersion = "${jaxRsVersionEE10}"
Expand Down
7 changes: 7 additions & 0 deletions servicetalk-data-jackson-jersey3-jakarta9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ tasks.sourcesJar.dependsOn(copySourcesForJersey3)
tasks.compileJava.dependsOn(copySourcesForJersey3)
tasks.processTestResources.dependsOn(copySourcesForJersey3)
tasks.compileTestJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE9}"
def actualJaxRsVersion = "${jaxRsVersionEE9}"
Expand Down
7 changes: 7 additions & 0 deletions servicetalk-data-protobuf-jersey3-jakarta10/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ tasks.compileJava.dependsOn(copySourcesForJersey3)
tasks.generateTestProto.dependsOn(copySourcesForJersey3)
tasks.processTestResources.dependsOn(copySourcesForJersey3)
tasks.compileTestJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE10}"
def actualJaxRsVersion = "${jaxRsVersionEE10}"
Expand Down
7 changes: 7 additions & 0 deletions servicetalk-data-protobuf-jersey3-jakarta9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ tasks.compileJava.dependsOn(copySourcesForJersey3)
tasks.generateTestProto.dependsOn(copySourcesForJersey3)
tasks.processTestResources.dependsOn(copySourcesForJersey3)
tasks.compileTestJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE9}"
def actualJavaxActivationVersion = "${javaxActivationVersionEE9}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ task copySourcesForJersey3(type: Copy) {
tasks.processResources.dependsOn(copySourcesForJersey3)
tasks.sourcesJar.dependsOn(copySourcesForJersey3)
tasks.compileJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE10}"
def actualJaxRsVersion = "${jaxRsVersionEE10}"
Expand Down
7 changes: 7 additions & 0 deletions servicetalk-http-router-jersey3-jakarta10/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ tasks.sourcesJar.dependsOn(copySourcesForJersey3)
tasks.compileJava.dependsOn(copySourcesForJersey3)
tasks.processTestResources.dependsOn(copySourcesForJersey3)
tasks.compileTestJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE10}"
def actualJavaxActivationVersion = "${javaxActivationVersionEE10}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ task copySourcesForJersey3(type: Copy) {
tasks.processResources.dependsOn(copySourcesForJersey3)
tasks.sourcesJar.dependsOn(copySourcesForJersey3)
tasks.compileJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE9}"
def actualJaxRsVersion = "${jaxRsVersionEE9}"
Expand Down
7 changes: 7 additions & 0 deletions servicetalk-http-router-jersey3-jakarta9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ tasks.sourcesJar.dependsOn(copySourcesForJersey3)
tasks.compileJava.dependsOn(copySourcesForJersey3)
tasks.processTestResources.dependsOn(copySourcesForJersey3)
tasks.compileTestJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE9}"
def actualJavaxActivationVersion = "${javaxActivationVersionEE9}"
Expand Down
7 changes: 7 additions & 0 deletions servicetalk-http-security-jersey3-jakarta10/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ tasks.sourcesJar.dependsOn(copySourcesForJersey3)
tasks.compileJava.dependsOn(copySourcesForJersey3)
tasks.processTestResources.dependsOn(copySourcesForJersey3)
tasks.compileTestJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE10}"
def actualJaxRsVersion = "${jaxRsVersionEE10}"
Expand Down
7 changes: 7 additions & 0 deletions servicetalk-http-security-jersey3-jakarta9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ tasks.sourcesJar.dependsOn(copySourcesForJersey3)
tasks.compileJava.dependsOn(copySourcesForJersey3)
tasks.processTestResources.dependsOn(copySourcesForJersey3)
tasks.compileTestJava.dependsOn(copySourcesForJersey3)
afterEvaluate {
if (tasks.findByName("projectHealth")) {
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
dependsOn(copySourcesForJersey3)
}
}
}

def actualJerseyVersion = "${jersey3VersionEE9}"
def actualJaxRsVersion = "${jaxRsVersionEE9}"
Expand Down
Loading