Use Gradle's task configuration avoidance APIs

This can avoid creating an additional 736 tasks (previously 502 out of
1591 were not created). That's not all that important as the build time
is essentially the same, but this lets us see the poor behavior of the
protobuf plugin in our own project and increase our understanding of how
to avoid task creation when developing the plugin. Of the tasks still
being created, protobuf is the highest contributor with 165 tasks,
followed by maven-publish with 76 and appengine with 53. The remaining
59 are from our own build, but indirectly caused by maven-publish.
This commit is contained in:
Eric Anderson 2022-07-01 15:48:38 -07:00
parent e767905f4a
commit 0ff9f37b9e
28 changed files with 210 additions and 161 deletions

View File

@ -36,7 +36,7 @@ dependencies {
api subprojects.minus([project(':grpc-protobuf-lite')]) api subprojects.minus([project(':grpc-protobuf-lite')])
} }
javadoc { tasks.named("javadoc").configure {
classpath = files(subprojects.collect { subproject -> classpath = files(subprojects.collect { subproject ->
subproject.javadoc.classpath subproject.javadoc.classpath
}) })
@ -49,7 +49,7 @@ javadoc {
} }
} }
task jacocoMerge(type: JacocoMerge) { tasks.register("jacocoMerge", JacocoMerge) {
dependsOn(subprojects.jacocoTestReport.dependsOn) dependsOn(subprojects.jacocoTestReport.dependsOn)
dependsOn(project(':grpc-interop-testing').jacocoTestReport.dependsOn) dependsOn(project(':grpc-interop-testing').jacocoTestReport.dependsOn)
mustRunAfter(subprojects.jacocoTestReport.mustRunAfter) mustRunAfter(subprojects.jacocoTestReport.mustRunAfter)
@ -60,7 +60,7 @@ task jacocoMerge(type: JacocoMerge) {
.filter { f -> f.exists() } .filter { f -> f.exists() }
} }
jacocoTestReport { tasks.named("jacocoTestReport").configure {
dependsOn(jacocoMerge) dependsOn(jacocoMerge)
reports { reports {
xml.required = true xml.required = true
@ -78,4 +78,4 @@ coveralls {
sourceDirs = subprojects.sourceSets.main.allSource.srcDirs.flatten() sourceDirs = subprojects.sourceSets.main.allSource.srcDirs.flatten()
} }
tasks.coveralls { dependsOn(jacocoTestReport) } tasks.named("coveralls").configure { dependsOn tasks.named("jacocoTestReport") }

View File

@ -52,28 +52,28 @@ configureProtoCompilation()
import net.ltgt.gradle.errorprone.CheckSeverity import net.ltgt.gradle.errorprone.CheckSeverity
[compileJava, compileTestJava].each() { [tasks.named("compileJava"), tasks.named("compileTestJava")]*.configure {
// protobuf calls valueof. Will be fixed in next release (google/protobuf#4046) // protobuf calls valueof. Will be fixed in next release (google/protobuf#4046)
it.options.compilerArgs += [ options.compilerArgs += [
"-Xlint:-deprecation" "-Xlint:-deprecation"
] ]
// ALTS returns a lot of futures that we mostly don't care about. // ALTS returns a lot of futures that we mostly don't care about.
it.options.errorprone.check("FutureReturnValueIgnored", CheckSeverity.OFF) options.errorprone.check("FutureReturnValueIgnored", CheckSeverity.OFF)
} }
javadoc { tasks.named("javadoc").configure {
exclude 'io/grpc/alts/internal/**' exclude 'io/grpc/alts/internal/**'
exclude 'io/grpc/alts/Internal*' exclude 'io/grpc/alts/Internal*'
} }
jar { tasks.named("jar").configure {
// Must use a different archiveClassifier to avoid conflicting with shadowJar // Must use a different archiveClassifier to avoid conflicting with shadowJar
archiveClassifier = 'original' archiveClassifier = 'original'
} }
// We want to use grpc-netty-shaded instead of grpc-netty. But we also want our // We want to use grpc-netty-shaded instead of grpc-netty. But we also want our
// source to work with Bazel, so we rewrite the code as part of the build. // source to work with Bazel, so we rewrite the code as part of the build.
shadowJar { tasks.named("shadowJar").configure {
archiveClassifier = null archiveClassifier = null
dependencies { dependencies {
exclude(dependency {true}) exclude(dependency {true})

View File

@ -101,7 +101,7 @@ project.tasks['check'].dependsOn checkStyleMain, checkStyleTest
import net.ltgt.gradle.errorprone.CheckSeverity import net.ltgt.gradle.errorprone.CheckSeverity
tasks.withType(JavaCompile) { tasks.withType(JavaCompile).configureEach {
options.compilerArgs += [ options.compilerArgs += [
"-Xlint:-cast" "-Xlint:-cast"
] ]

View File

@ -42,7 +42,7 @@ dependencies {
testImplementation libraries.truth testImplementation libraries.truth
} }
task javadocs(type: Javadoc) { tasks.register("javadocs", Javadoc) {
source = android.sourceSets.main.java.srcDirs source = android.sourceSets.main.java.srcDirs
classpath += files(android.getBootClasspath()) classpath += files(android.getBootClasspath())
classpath += files({ classpath += files({
@ -58,12 +58,13 @@ task javadocs(type: Javadoc) {
} }
} }
task javadocJar(type: Jar, dependsOn: javadocs) { tasks.register("javadocJar", Jar) {
dependsOn javadocs
archiveClassifier = 'javadoc' archiveClassifier = 'javadoc'
from javadocs.destinationDir from javadocs.destinationDir
} }
task sourcesJar(type: Jar) { tasks.register("sourcesJar", Jar) {
archiveClassifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs from android.sourceSets.main.java.srcDirs
} }

View File

@ -28,7 +28,7 @@ dependencies {
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
} }
javadoc { tasks.named("javadoc").configure {
// We want io.grpc.Internal, but not io.grpc.Internal* // We want io.grpc.Internal, but not io.grpc.Internal*
exclude 'io/grpc/Internal?*.java' exclude 'io/grpc/Internal?*.java'
} }

View File

@ -29,17 +29,17 @@ dependencies {
signature "org.codehaus.mojo.signature:java17:1.0@signature" signature "org.codehaus.mojo.signature:java17:1.0@signature"
} }
jar { tasks.named("jar").configure {
classifier = 'original' classifier = 'original'
} }
// TODO(ashithasantosh): Remove javadoc exclusion on adding authorization // TODO(ashithasantosh): Remove javadoc exclusion on adding authorization
// interceptor implementations. // interceptor implementations.
javadoc { tasks.named("javadoc").configure {
exclude "io/grpc/authz/*" exclude "io/grpc/authz/*"
} }
shadowJar { tasks.named("shadowJar").configure {
classifier = null classifier = null
dependencies { dependencies {
exclude(dependency {true}) exclude(dependency {true})
@ -74,4 +74,6 @@ publishing {
} }
} }
publishMavenPublicationToMavenRepository.enabled = false tasks.named("publishMavenPublicationToMavenRepository").configure {
enabled = false
}

View File

@ -9,10 +9,7 @@ plugins {
description = "grpc Benchmarks" description = "grpc Benchmarks"
startScripts.enabled = false tasks.named("jmh").configure {
run.enabled = false
jmh {
jvmArgs = ["-server", "-Xms2g", "-Xmx2g"] jvmArgs = ["-server", "-Xms2g", "-Xmx2g"]
} }
@ -46,7 +43,7 @@ dependencies {
import net.ltgt.gradle.errorprone.CheckSeverity import net.ltgt.gradle.errorprone.CheckSeverity
compileJava { tasks.named("compileJava").configure {
// The Control.Void protobuf clashes // The Control.Void protobuf clashes
options.errorprone.check("JavaLangClash", CheckSeverity.OFF) options.errorprone.check("JavaLangClash", CheckSeverity.OFF)
} }
@ -60,7 +57,15 @@ def vmArgs = [
"-XX:+PrintGCDetails" "-XX:+PrintGCDetails"
] ]
task qps_client(type: CreateStartScripts) { tasks.named("startScripts").configure {
enabled = false
}
tasks.named("run").configure {
enabled = false
}
def qps_client = tasks.register("qps_client", CreateStartScripts) {
mainClass = "io.grpc.benchmarks.qps.AsyncClient" mainClass = "io.grpc.benchmarks.qps.AsyncClient"
applicationName = "qps_client" applicationName = "qps_client"
defaultJvmOpts = vmArgs defaultJvmOpts = vmArgs
@ -68,7 +73,7 @@ task qps_client(type: CreateStartScripts) {
classpath = startScripts.classpath classpath = startScripts.classpath
} }
task openloop_client(type: CreateStartScripts) { def openloop_client = tasks.register("openloop_client", CreateStartScripts) {
mainClass = "io.grpc.benchmarks.qps.OpenLoopClient" mainClass = "io.grpc.benchmarks.qps.OpenLoopClient"
applicationName = "openloop_client" applicationName = "openloop_client"
defaultJvmOpts = vmArgs defaultJvmOpts = vmArgs
@ -76,14 +81,14 @@ task openloop_client(type: CreateStartScripts) {
classpath = startScripts.classpath classpath = startScripts.classpath
} }
task qps_server(type: CreateStartScripts) { def qps_server = tasks.register("qps_server", CreateStartScripts) {
mainClass = "io.grpc.benchmarks.qps.AsyncServer" mainClass = "io.grpc.benchmarks.qps.AsyncServer"
applicationName = "qps_server" applicationName = "qps_server"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScripts.classpath classpath = startScripts.classpath
} }
task benchmark_worker(type: CreateStartScripts) { def benchmark_worker = tasks.register("benchmark_worker", CreateStartScripts) {
mainClass = "io.grpc.benchmarks.driver.LoadWorker" mainClass = "io.grpc.benchmarks.driver.LoadWorker"
applicationName = "benchmark_worker" applicationName = "benchmark_worker"
defaultJvmOpts = vmArgs defaultJvmOpts = vmArgs

View File

@ -85,7 +85,7 @@ dependencies {
import net.ltgt.gradle.errorprone.CheckSeverity import net.ltgt.gradle.errorprone.CheckSeverity
tasks.withType(JavaCompile) { tasks.withType(JavaCompile).configureEach {
options.compilerArgs += [ options.compilerArgs += [
"-Xlint:-cast" "-Xlint:-cast"
] ]
@ -94,7 +94,7 @@ tasks.withType(JavaCompile) {
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF) options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
} }
task javadocs(type: Javadoc) { tasks.register("javadocs", Javadoc) {
source = android.sourceSets.main.java.srcDirs source = android.sourceSets.main.java.srcDirs
classpath += files(android.getBootClasspath()) classpath += files(android.getBootClasspath())
classpath += files({ classpath += files({
@ -110,12 +110,13 @@ task javadocs(type: Javadoc) {
} }
} }
task javadocJar(type: Jar, dependsOn: javadocs) { tasks.register("javadocJar", Jar) {
dependsOn javadocs
archiveClassifier = 'javadoc' archiveClassifier = 'javadoc'
from javadocs.destinationDir from javadocs.destinationDir
} }
task sourcesJar(type: Jar) { tasks.register("sourcesJar", Jar) {
archiveClassifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs from android.sourceSets.main.java.srcDirs
} }

View File

@ -29,7 +29,7 @@ subprojects {
mavenLocal() mavenLocal()
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile).configureEach {
it.options.compilerArgs += [ it.options.compilerArgs += [
"-Xlint:all", "-Xlint:all",
"-Xlint:-options", "-Xlint:-options",
@ -42,7 +42,7 @@ subprojects {
} }
} }
tasks.withType(GenerateModuleMetadata) { tasks.withType(GenerateModuleMetadata).configureEach {
// Module metadata, introduced in Gradle 6.0, conflicts with our publishing task for // Module metadata, introduced in Gradle 6.0, conflicts with our publishing task for
// grpc-alts and grpc-compiler. // grpc-alts and grpc-compiler.
enabled = false enabled = false
@ -82,7 +82,7 @@ subprojects {
if (rootProject.childProjects.containsKey('grpc-compiler')) { if (rootProject.childProjects.containsKey('grpc-compiler')) {
// Only when the codegen is built along with the project, will we be able to run // Only when the codegen is built along with the project, will we be able to run
// the grpc code generator. // the grpc code generator.
task syncGeneratedSources { } def syncGeneratedSources = tasks.register("syncGeneratedSources") { }
project.protobuf { project.protobuf {
plugins { grpc { path = javaPluginPath } } plugins { grpc { path = javaPluginPath } }
generateProtoTasks { generateProtoTasks {
@ -97,16 +97,20 @@ subprojects {
} }
dependsOn "generate${source}Proto" dependsOn "generate${source}Proto"
} }
syncGeneratedSources.dependsOn syncTask syncGeneratedSources.configure {
dependsOn syncTask
}
task.dependsOn ':grpc-compiler:java_pluginExecutable' task.configure {
// Recompile protos when the codegen has been changed dependsOn ':grpc-compiler:java_pluginExecutable'
task.inputs.file javaPluginPath // Recompile protos when the codegen has been changed
task.plugins { grpc { option 'noversion' } } inputs.file javaPluginPath
if (isAndroid) { plugins { grpc { option 'noversion' } }
task.plugins { if (isAndroid) {
grpc { plugins {
option 'lite' grpc {
option 'lite'
}
} }
} }
} }
@ -114,7 +118,9 @@ subprojects {
} }
} }
// Re-sync as part of a normal build, to avoid forgetting to run the sync // Re-sync as part of a normal build, to avoid forgetting to run the sync
assemble.dependsOn syncGeneratedSources tasks.named("assemble").configure {
dependsOn syncGeneratedSources
}
} else { } else {
// Otherwise, we just use the checked-in generated code. // Otherwise, we just use the checked-in generated code.
if (isAndroid) { if (isAndroid) {
@ -129,7 +135,7 @@ subprojects {
} }
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile).configureEach {
appendToProperty( appendToProperty(
it.options.errorprone.excludedPaths, it.options.errorprone.excludedPaths,
".*/src/generated/[^/]+/java/.*" + ".*/src/generated/[^/]+/java/.*" +
@ -152,7 +158,7 @@ subprojects {
// Disable JavaDoc doclint on Java 8. It's annoying. // Disable JavaDoc doclint on Java 8. It's annoying.
if (JavaVersion.current().isJava8Compatible()) { if (JavaVersion.current().isJava8Compatible()) {
allprojects { allprojects {
tasks.withType(Javadoc) { tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet') options.addStringOption('Xdoclint:none', '-quiet')
} }
} }
@ -174,7 +180,7 @@ subprojects {
} }
} else { } else {
// Disable Error Prone // Disable Error Prone
tasks.withType(JavaCompile) { tasks.withType(JavaCompile).configureEach {
options.errorprone.enabled = false options.errorprone.enabled = false
} }
} }
@ -189,36 +195,40 @@ subprojects {
libraries.truth libraries.truth
} }
compileTestJava { tasks.named("compileTestJava").configure {
// serialVersionUID is basically guaranteed to be useless in our tests // serialVersionUID is basically guaranteed to be useless in our tests
options.compilerArgs += [ options.compilerArgs += [
"-Xlint:-serial" "-Xlint:-serial"
] ]
} }
jar.manifest { tasks.named("jar").configure {
attributes('Implementation-Title': name, manifest {
'Implementation-Version': version) attributes('Implementation-Title': name,
'Implementation-Version': project.version)
}
} }
javadoc.options { tasks.named("javadoc").configure {
encoding = 'UTF-8' options {
use = true encoding = 'UTF-8'
links 'https://docs.oracle.com/javase/8/docs/api/' use = true
source = "8" links 'https://docs.oracle.com/javase/8/docs/api/'
source = "8"
}
} }
checkstyleMain { tasks.named("checkstyleMain").configure {
source = fileTree(dir: "$projectDir/src/main", include: "**/*.java") source = fileTree(dir: "$projectDir/src/main", include: "**/*.java")
} }
checkstyleTest { tasks.named("checkstyleTest").configure {
source = fileTree(dir: "$projectDir/src/test", include: "**/*.java") source = fileTree(dir: "$projectDir/src/test", include: "**/*.java")
} }
// At a test failure, log the stack trace to the console so that we don't // At a test failure, log the stack trace to the console so that we don't
// have to open the HTML in a browser. // have to open the HTML in a browser.
test { tasks.named("test").configure {
testLogging { testLogging {
exceptionFormat = 'full' exceptionFormat = 'full'
showExceptions true showExceptions true
@ -234,7 +244,7 @@ subprojects {
} }
} }
compileJava { tasks.named("compileJava").configure {
// This project targets Java 7 (no method references) // This project targets Java 7 (no method references)
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF) options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
// This project targets Java 7 (no time.Duration class) // This project targets Java 7 (no time.Duration class)
@ -243,7 +253,7 @@ subprojects {
// The warning fails to provide a source location // The warning fails to provide a source location
options.errorprone.check("MissingSummary", CheckSeverity.OFF) options.errorprone.check("MissingSummary", CheckSeverity.OFF)
} }
compileTestJava { tasks.named("compileTestJava").configure {
// LinkedList doesn't hurt much in tests and has lots of usages // LinkedList doesn't hurt much in tests and has lots of usages
options.errorprone.check("JdkObsolete", CheckSeverity.OFF) options.errorprone.check("JdkObsolete", CheckSeverity.OFF)
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF) options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
@ -267,7 +277,7 @@ subprojects {
requireUpperBoundDepsMatch(configurations.runtimeClasspath, project) requireUpperBoundDepsMatch(configurations.runtimeClasspath, project)
} }
} }
tasks.named('compileJava') { tasks.named('compileJava').configure {
dependsOn checkUpperBoundDeps dependsOn checkUpperBoundDeps
} }
} }
@ -275,11 +285,11 @@ subprojects {
plugins.withId("me.champeau.jmh") { plugins.withId("me.champeau.jmh") {
// invoke jmh on a single benchmark class like so: // invoke jmh on a single benchmark class like so:
// ./gradlew -PjmhIncludeSingleClass=StatsTraceContextBenchmark clean :grpc-core:jmh // ./gradlew -PjmhIncludeSingleClass=StatsTraceContextBenchmark clean :grpc-core:jmh
compileJmhJava { tasks.named("compileJmhJava").configure {
sourceCompatibility = 1.8 sourceCompatibility = 1.8
targetCompatibility = 1.8 targetCompatibility = 1.8
} }
jmh { tasks.named("jmh").configure {
warmupIterations = 10 warmupIterations = 10
iterations = 10 iterations = 10
fork = 1 fork = 1
@ -296,7 +306,7 @@ subprojects {
} }
plugins.withId("com.github.johnrengelman.shadow") { plugins.withId("com.github.johnrengelman.shadow") {
tasks.named("shadowJar") { tasks.named("shadowJar").configure {
// Do a dance to remove Class-Path. This needs to run after the doFirst() from the // Do a dance to remove Class-Path. This needs to run after the doFirst() from the
// shadow plugin that adds Class-Path and before the core jar action. Using doFirst will // shadow plugin that adds Class-Path and before the core jar action. Using doFirst will
// have this run before the shadow plugin, and doLast will run after the core jar // have this run before the shadow plugin, and doLast will run after the core jar
@ -442,7 +452,8 @@ subprojects {
} }
// Add a japicmp task that compares the current .jar with baseline .jar // Add a japicmp task that compares the current .jar with baseline .jar
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: jar) { tasks.register("japicmp", me.champeau.gradle.japicmp.JapicmpTask) {
dependsOn jar
oldClasspath = files(baselineArtifact) oldClasspath = files(baselineArtifact)
newClasspath = files(jar.archivePath) newClasspath = files(jar.archivePath)
onlyBinaryIncompatibleModified = false onlyBinaryIncompatibleModified = false

View File

@ -20,7 +20,7 @@ dependencies {
libraries.opencensus.impl libraries.opencensus.impl
} }
javadoc { tasks.named("javadoc").configure {
failOnError false // no public or protected classes found to document failOnError false // no public or protected classes found to document
exclude 'io/grpc/census/internal/**' exclude 'io/grpc/census/internal/**'
exclude 'io/grpc/census/Internal*' exclude 'io/grpc/census/Internal*'

View File

@ -152,11 +152,11 @@ sourceSets {
} }
} }
compileTestJava { tasks.named("compileTestJava").configure {
options.errorprone.excludedPaths = ".*/build/generated/source/proto/.*" options.errorprone.excludedPaths = ".*/build/generated/source/proto/.*"
} }
compileTestLiteJava { tasks.named("compileTestLiteJava").configure {
options.compilerArgs = compileTestJava.options.compilerArgs options.compilerArgs = compileTestJava.options.compilerArgs
options.compilerArgs += [ options.compilerArgs += [
"-Xlint:-cast" "-Xlint:-cast"
@ -177,16 +177,24 @@ protobuf {
} }
generateProtoTasks { generateProtoTasks {
all().each { task -> all().each { task ->
task.dependsOn 'java_pluginExecutable' task.configure {
task.inputs.file javaPluginPath dependsOn 'java_pluginExecutable'
} inputs.file javaPluginPath
ofSourceSet('test')*.plugins { grpc {} }
ofSourceSet('testLite')*.each { task ->
task.builtins {
java { option 'lite' }
} }
task.plugins { }
grpc { option 'lite' } ofSourceSet('test').each { task ->
task.configure {
plugins { grpc {} }
}
}
ofSourceSet('testLite').each { task ->
task.configure {
builtins {
java { option 'lite' }
}
plugins {
grpc { option 'lite' }
}
} }
} }
} }
@ -195,7 +203,7 @@ protobuf {
println "*** Building codegen requires Protobuf version ${libs.versions.protobuf.get()}" println "*** Building codegen requires Protobuf version ${libs.versions.protobuf.get()}"
println "*** Please refer to https://github.com/grpc/grpc-java/blob/master/COMPILING.md#how-to-build-code-generation-plugin" println "*** Please refer to https://github.com/grpc/grpc-java/blob/master/COMPILING.md#how-to-build-code-generation-plugin"
task buildArtifacts(type: Copy) { tasks.register("buildArtifacts", Copy) {
dependsOn 'java_pluginExecutable' dependsOn 'java_pluginExecutable'
from("$buildDir/exe") { from("$buildDir/exe") {
if (osdetector.os != 'windows') { if (osdetector.os != 'windows') {
@ -207,7 +215,7 @@ task buildArtifacts(type: Copy) {
archivesBaseName = "$protocPluginBaseName" archivesBaseName = "$protocPluginBaseName"
task checkArtifacts { def checkArtifacts = tasks.register("checkArtifacts") {
dependsOn buildArtifacts dependsOn buildArtifacts
doLast { doLast {
if (!usingVisualCpp) { if (!usingVisualCpp) {
@ -290,11 +298,15 @@ def configureTestTask(Task task, String dep, String extraPackage, String service
"$projectDir/src/test${dep}/golden/${serviceName}.java.txt" "$projectDir/src/test${dep}/golden/${serviceName}.java.txt"
} }
task testGolden(type: Exec) tasks.register("testGolden", Exec) {
task testLiteGolden(type: Exec) configureTestTask(it, '', '', 'TestService')
task testDeprecatedGolden(type: Exec) }
task testDeprecatedLiteGolden(type: Exec) tasks.register("testLiteGolden", Exec) {
configureTestTask(testGolden, '', '', 'TestService') configureTestTask(it, 'Lite', '', 'TestService')
configureTestTask(testLiteGolden, 'Lite', '', 'TestService') }
configureTestTask(testDeprecatedGolden, '', '', 'TestDeprecatedService') tasks.register("testDeprecatedGolden", Exec) {
configureTestTask(testDeprecatedLiteGolden, 'Lite', '', 'TestDeprecatedService') configureTestTask(it, '', '', 'TestDeprecatedService')
}
tasks.register("testDeprecatedLiteGolden", Exec) {
configureTestTask(it, 'Lite', '', 'TestDeprecatedService')
}

View File

@ -46,7 +46,7 @@ dependencies {
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
} }
javadoc { tasks.named("javadoc").configure {
exclude 'io/grpc/internal/**' exclude 'io/grpc/internal/**'
exclude 'io/grpc/inprocess/Internal*' exclude 'io/grpc/inprocess/Internal*'
// Disabled until kinda stable. // Disabled until kinda stable.
@ -87,7 +87,7 @@ def replaceConstant(File file, String needle, String replacement) {
} }
plugins.withId("java") { plugins.withId("java") {
compileJava { tasks.named("compileJava").configure {
doLast { doLast {
// Replace value of Signature Attribute. // Replace value of Signature Attribute.
// https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.9 // https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.9
@ -109,13 +109,13 @@ plugins.withId("java") {
} }
} }
compileJmhJava { tasks.named("compileJmhJava").configure {
// This project targets Java 7 (no method references) // This project targets Java 7 (no method references)
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF) options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
} }
} }
task versionFile() { tasks.register("versionFile") {
doLast { doLast {
new File(buildDir, "version").write("${project.version}\n") new File(buildDir, "version").write("${project.version}\n")
} }

View File

@ -55,7 +55,7 @@ dependencies {
runtimeOnly libraries.netty.tcnative, libraries.netty.tcnative.classes runtimeOnly libraries.netty.tcnative, libraries.netty.tcnative.classes
} }
compileJava { tasks.named("compileJava").configure {
// Disable "No processor claimed any of these annotations: org.junit.Ignore" // Disable "No processor claimed any of these annotations: org.junit.Ignore"
options.compilerArgs += ["-Xlint:-processing"] options.compilerArgs += ["-Xlint:-processing"]
} }
@ -118,7 +118,8 @@ String getAppUrl(String project, String service, String version) {
return "http://${version}.${service}.${project}.appspot.com" return "http://${version}.${service}.${project}.appspot.com"
} }
task runInteropTestRemote(dependsOn: 'appengineDeploy') { tasks.register("runInteropTestRemote") {
dependsOn appengineDeploy
doLast { doLast {
// give remote app some time to settle down // give remote app some time to settle down
sleep(20000) sleep(20000)

View File

@ -8,7 +8,7 @@ plugins {
description = "gRPC: Google Cloud Platform Observability" description = "gRPC: Google Cloud Platform Observability"
[compileJava].each() { tasks.named("compileJava").configure {
it.options.compilerArgs += [ it.options.compilerArgs += [
// only has AutoValue annotation processor // only has AutoValue annotation processor
"-Xlint:-processing" "-Xlint:-processing"

View File

@ -25,11 +25,11 @@ dependencies {
configureProtoCompilation() configureProtoCompilation()
javadoc { tasks.named("javadoc").configure {
exclude 'io/grpc/grpclb/Internal*' exclude 'io/grpc/grpclb/Internal*'
} }
jacocoTestReport { tasks.named("jacocoTestReport").configure {
classDirectories.from = sourceSets.main.output.collect { classDirectories.from = sourceSets.main.output.collect {
fileTree(dir: it, fileTree(dir: it,
exclude: [ exclude: [

View File

@ -8,9 +8,6 @@ plugins {
} }
description = "gRPC: Integration Testing" description = "gRPC: Integration Testing"
startShadowScripts.enabled = false
installDist.dependsOn(installShadowDist)
installDist.enabled = false
configurations { configurations {
alpnagent alpnagent
@ -63,17 +60,17 @@ configureProtoCompilation()
import net.ltgt.gradle.errorprone.CheckSeverity import net.ltgt.gradle.errorprone.CheckSeverity
compileJava { tasks.named("compileJava").configure {
// This isn't a library; it can use beta APIs // This isn't a library; it can use beta APIs
options.errorprone.check("BetaApi", CheckSeverity.OFF) options.errorprone.check("BetaApi", CheckSeverity.OFF)
} }
jar { tasks.named("jar").configure {
// Must use a different archiveClassifier to avoid conflicting with shadowJar // Must use a different archiveClassifier to avoid conflicting with shadowJar
archiveClassifier = 'original' archiveClassifier = 'original'
} }
def xdsPrefixName = 'io.grpc.xds' def xdsPrefixName = 'io.grpc.xds'
shadowJar { tasks.named("shadowJar").configure {
archiveClassifier = null archiveClassifier = null
dependencies { dependencies {
exclude(dependency {true}) exclude(dependency {true})
@ -81,94 +78,104 @@ shadowJar {
relocate 'com.github.xds', "${xdsPrefixName}.shaded.com.github.xds" relocate 'com.github.xds', "${xdsPrefixName}.shaded.com.github.xds"
} }
test { tasks.named("test").configure {
// For the automated tests, use Jetty ALPN. // For the automated tests, use Jetty ALPN.
jvmArgs "-javaagent:" + configurations.alpnagent.asPath jvmArgs "-javaagent:" + configurations.alpnagent.asPath
} }
tasks.named("startShadowScripts").configure {
enabled = false
}
tasks.named("installDist").configure {
dependsOn installShadowDist
enabled = false
}
// For the generated scripts, use Netty tcnative (i.e. OpenSSL). // For the generated scripts, use Netty tcnative (i.e. OpenSSL).
// Note that OkHttp currently only supports ALPN, so OpenSSL version >= 1.0.2 is required. // Note that OkHttp currently only supports ALPN, so OpenSSL version >= 1.0.2 is required.
var startScriptsClasspath = shadowJar.outputs.files + configurations.shadow def startScriptsClasspath = provider {
shadowJar.outputs.files + configurations.shadow
}
task test_client(type: CreateStartScripts) { def test_client = tasks.register("test_client", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.TestServiceClient" mainClass = "io.grpc.testing.integration.TestServiceClient"
applicationName = "test-client" applicationName = "test-client"
defaultJvmOpts = [ defaultJvmOpts = [
"-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name "-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name
] ]
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
doLast { doLast {
unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\'"\$APP_HOME"\'/lib/') unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\'"\$APP_HOME"\'/lib/')
windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\') windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\')
} }
} }
task test_server(type: CreateStartScripts) { def test_server = tasks.register("test_server", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.TestServiceServer" mainClass = "io.grpc.testing.integration.TestServiceServer"
applicationName = "test-server" applicationName = "test-server"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
} }
task reconnect_test_client(type: CreateStartScripts) { def reconnect_test_client = tasks.register("reconnect_test_client", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.ReconnectTestClient" mainClass = "io.grpc.testing.integration.ReconnectTestClient"
applicationName = "reconnect-test-client" applicationName = "reconnect-test-client"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
} }
task stresstest_client(type: CreateStartScripts) { def stresstest_client = tasks.register("stresstest_client", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.StressTestClient" mainClass = "io.grpc.testing.integration.StressTestClient"
applicationName = "stresstest-client" applicationName = "stresstest-client"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
defaultJvmOpts = [ defaultJvmOpts = [
"-verbose:gc", "-verbose:gc",
"-XX:+PrintFlagsFinal" "-XX:+PrintFlagsFinal"
] ]
} }
task http2_client(type: CreateStartScripts) { def http2_client = tasks.register("http2_client", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.Http2Client" mainClass = "io.grpc.testing.integration.Http2Client"
applicationName = "http2-client" applicationName = "http2-client"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
} }
task grpclb_long_lived_affinity_test_client(type: CreateStartScripts) { def grpclb_long_lived_affinity_test_client = tasks.register("grpclb_long_lived_affinity_test_client", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.GrpclbLongLivedAffinityTestClient" mainClass = "io.grpc.testing.integration.GrpclbLongLivedAffinityTestClient"
applicationName = "grpclb-long-lived-affinity-test-client" applicationName = "grpclb-long-lived-affinity-test-client"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
defaultJvmOpts = [ defaultJvmOpts = [
"-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true" "-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true"
] ]
} }
task grpclb_fallback_test_client (type: CreateStartScripts) { def grpclb_fallback_test_client = tasks.register("grpclb_fallback_test_client", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.GrpclbFallbackTestClient" mainClass = "io.grpc.testing.integration.GrpclbFallbackTestClient"
applicationName = "grpclb-fallback-test-client" applicationName = "grpclb-fallback-test-client"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
defaultJvmOpts = [ defaultJvmOpts = [
"-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true" "-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true"
] ]
} }
task xds_test_client(type: CreateStartScripts) { def xds_test_client = tasks.register("xds_test_client", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.XdsTestClient" mainClass = "io.grpc.testing.integration.XdsTestClient"
applicationName = "xds-test-client" applicationName = "xds-test-client"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
} }
task xds_test_server(type: CreateStartScripts) { def xds_test_server = tasks.register("xds_test_server", CreateStartScripts) {
mainClass = "io.grpc.testing.integration.XdsTestServer" mainClass = "io.grpc.testing.integration.XdsTestServer"
applicationName = "xds-test-server" applicationName = "xds-test-server"
outputDir = new File(project.buildDir, 'tmp/scripts/' + name) outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
classpath = startScriptsClasspath classpath = startScriptsClasspath.get()
} }
distributions.shadow.contents.into("bin") { distributions.shadow.contents.into("bin") {

View File

@ -47,7 +47,7 @@ configureProtoCompilation()
import net.ltgt.gradle.errorprone.CheckSeverity import net.ltgt.gradle.errorprone.CheckSeverity
compileJava { tasks.named("compileJava").configure {
// This isn't a library; it can use beta APIs // This isn't a library; it can use beta APIs
options.errorprone.check("BetaApi", CheckSeverity.OFF) options.errorprone.check("BetaApi", CheckSeverity.OFF)
} }

View File

@ -69,12 +69,12 @@ dependencies {
import net.ltgt.gradle.errorprone.CheckSeverity import net.ltgt.gradle.errorprone.CheckSeverity
[compileJava, compileTestJava].each() { [tasks.named("compileJava"), tasks.named("compileTestJava")]*.configure {
// Netty retuns a lot of futures that we mostly don't care about. // Netty retuns a lot of futures that we mostly don't care about.
it.options.errorprone.check("FutureReturnValueIgnored", CheckSeverity.OFF) options.errorprone.check("FutureReturnValueIgnored", CheckSeverity.OFF)
} }
javadoc { tasks.named("javadoc").configure {
options.links 'http://netty.io/4.1/api/' options.links 'http://netty.io/4.1/api/'
exclude 'io/grpc/netty/Internal*' exclude 'io/grpc/netty/Internal*'
} }
@ -83,17 +83,17 @@ project.sourceSets {
main { java { srcDir "${projectDir}/third_party/netty/java" } } main { java { srcDir "${projectDir}/third_party/netty/java" } }
} }
test { tasks.named("test").configure {
// Allow testing Jetty ALPN in TlsTest // Allow testing Jetty ALPN in TlsTest
jvmArgs "-javaagent:" + configurations.alpnagent.asPath jvmArgs "-javaagent:" + configurations.alpnagent.asPath
} }
jmh { tasks.named("jmh").configure {
// Workaround // Workaround
// https://github.com/melix/jmh-gradle-plugin/issues/97#issuecomment-316664026 // https://github.com/melix/jmh-gradle-plugin/issues/97#issuecomment-316664026
includeTests = true includeTests = true
} }
checkstyleMain { tasks.named("checkstyleMain").configure {
source = source.minus(fileTree(dir: "src/main", include: "**/Http2ControlFrameLimitEncoder.java")) source = source.minus(fileTree(dir: "src/main", include: "**/Http2ControlFrameLimitEncoder.java"))
} }

View File

@ -63,12 +63,12 @@ dependencies {
} }
} }
jar { tasks.named("jar").configure {
// Must use a different archiveClassifier to avoid conflicting with shadowJar // Must use a different archiveClassifier to avoid conflicting with shadowJar
archiveClassifier = 'original' archiveClassifier = 'original'
} }
shadowJar { tasks.named("shadowJar").configure {
archiveClassifier = null archiveClassifier = null
dependencies { dependencies {
include(project(':grpc-netty')) include(project(':grpc-netty'))
@ -120,14 +120,18 @@ publishing {
} }
} }
task testShadow(type: Test) { tasks.register("testShadow", Test) {
testClassesDirs = sourceSets.testShadow.output.classesDirs testClassesDirs = sourceSets.testShadow.output.classesDirs
classpath = sourceSets.testShadow.runtimeClasspath classpath = sourceSets.testShadow.runtimeClasspath
} }
compileTestShadowJava.options.compilerArgs = compileTestJava.options.compilerArgs tasks.named("compileTestShadowJava").configure {
compileTestShadowJava.options.encoding = compileTestJava.options.encoding options.compilerArgs = compileTestJava.options.compilerArgs
options.encoding = compileTestJava.options.encoding
}
test.dependsOn testShadow tasks.named("test").configure {
dependsOn tasks.named("testShadow")
}
/** /**
* A Transformer which updates the Netty JAR META-INF/ resources to accurately * A Transformer which updates the Netty JAR META-INF/ resources to accurately

View File

@ -32,15 +32,17 @@ project.sourceSets {
test { java { srcDir "${projectDir}/third_party/okhttp/test/java" } } test { java { srcDir "${projectDir}/third_party/okhttp/test/java" } }
} }
checkstyleMain.exclude '**/io/grpc/okhttp/internal/**' tasks.named("checkstyleMain").configure {
exclude '**/io/grpc/okhttp/internal/**'
}
javadoc { tasks.named("javadoc").configure {
options.links 'http://square.github.io/okhttp/2.x/okhttp/' options.links 'http://square.github.io/okhttp/2.x/okhttp/'
exclude 'io/grpc/okhttp/Internal*' exclude 'io/grpc/okhttp/Internal*'
exclude 'io/grpc/okhttp/internal/**' exclude 'io/grpc/okhttp/internal/**'
} }
jacocoTestReport { tasks.named("jacocoTestReport").configure {
classDirectories.from = sourceSets.main.output.collect { classDirectories.from = sourceSets.main.output.collect {
fileTree(dir: it, fileTree(dir: it,
exclude: [ exclude: [

View File

@ -21,7 +21,7 @@ dependencies {
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
} }
compileTestJava { tasks.named("compileTestJava").configure {
options.compilerArgs += [ options.compilerArgs += [
"-Xlint:-cast" "-Xlint:-cast"
] ]

View File

@ -28,4 +28,6 @@ dependencies {
signature "org.codehaus.mojo.signature:java17:1.0@signature" signature "org.codehaus.mojo.signature:java17:1.0@signature"
} }
javadoc.options.links 'https://developers.google.com/protocol-buffers/docs/reference/java/' tasks.named("javadoc").configure {
options.links 'https://developers.google.com/protocol-buffers/docs/reference/java/'
}

View File

@ -26,7 +26,7 @@ dependencies {
signature "org.codehaus.mojo.signature:java17:1.0@signature" signature "org.codehaus.mojo.signature:java17:1.0@signature"
} }
[compileJava].each() { tasks.named("compileJava").configure {
it.options.compilerArgs += [ it.options.compilerArgs += [
// only has AutoValue annotation processor // only has AutoValue annotation processor
"-Xlint:-processing", "-Xlint:-processing",
@ -37,7 +37,7 @@ dependencies {
"|") "|")
} }
javadoc { tasks.named("javadoc").configure {
// Do not publish javadoc since currently there is no public API. // Do not publish javadoc since currently there is no public API.
failOnError false // no public or protected classes found to document failOnError false // no public or protected classes found to document
exclude 'io/grpc/lookup/v1/**' exclude 'io/grpc/lookup/v1/**'
@ -45,7 +45,7 @@ javadoc {
exclude 'io/grpc/rls/Internal*' exclude 'io/grpc/rls/Internal*'
} }
jacocoTestReport { tasks.named("jacocoTestReport").configure {
classDirectories.from = sourceSets.main.output.collect { classDirectories.from = sourceSets.main.output.collect {
fileTree(dir: it, exclude: ['**/io/grpc/lookup/**']) fileTree(dir: it, exclude: ['**/io/grpc/lookup/**'])
} }

View File

@ -8,7 +8,7 @@ plugins {
description = "gRPC: Services" description = "gRPC: Services"
[compileJava].each() { tasks.named("compileJava").configure {
// v1alpha of reflection.proto is deprecated at the file level. // v1alpha of reflection.proto is deprecated at the file level.
// Without this workaround, the project can not compile. // Without this workaround, the project can not compile.
it.options.compilerArgs += [ it.options.compilerArgs += [
@ -37,12 +37,12 @@ dependencies {
configureProtoCompilation() configureProtoCompilation()
javadoc { tasks.named("javadoc").configure {
exclude 'io/grpc/services/Internal*.java' exclude 'io/grpc/services/Internal*.java'
exclude 'io/grpc/services/internal/*' exclude 'io/grpc/services/internal/*'
} }
jacocoTestReport { tasks.named("jacocoTestReport").configure {
classDirectories.from = sourceSets.main.output.collect { classDirectories.from = sourceSets.main.output.collect {
fileTree(dir: it, fileTree(dir: it,
exclude: [ exclude: [

View File

@ -6,7 +6,7 @@ pluginManagement {
id "com.github.kt3k.coveralls" version "2.12.0" id "com.github.kt3k.coveralls" version "2.12.0"
id "com.google.cloud.tools.jib" version "3.2.1" id "com.google.cloud.tools.jib" version "3.2.1"
id "com.google.osdetector" version "1.7.0" id "com.google.osdetector" version "1.7.0"
id "com.google.protobuf" version "0.8.18" id "com.google.protobuf" version "0.8.19"
id "digital.wup.android-maven-publish" version "3.6.3" id "digital.wup.android-maven-publish" version "3.6.3"
id "me.champeau.gradle.japicmp" version "0.3.0" id "me.champeau.gradle.japicmp" version "0.3.0"
id "me.champeau.jmh" version "0.6.6" id "me.champeau.jmh" version "0.6.6"

View File

@ -17,6 +17,6 @@ dependencies {
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
} }
javadoc { tasks.named("javadoc").configure {
exclude 'io/grpc/stub/Internal*' exclude 'io/grpc/stub/Internal*'
} }

View File

@ -26,9 +26,9 @@ dependencies {
project(':grpc-core').sourceSets.test.output project(':grpc-core').sourceSets.test.output
} }
javadoc { exclude 'io/grpc/internal/**' } tasks.named("javadoc").configure { exclude 'io/grpc/internal/**' }
jacocoTestReport { tasks.named("jacocoTestReport").configure {
classDirectories.from = sourceSets.main.output.collect { classDirectories.from = sourceSets.main.output.collect {
fileTree(dir: it, fileTree(dir: it,
exclude: [ exclude: [

View File

@ -109,7 +109,7 @@ dependencies {
configureProtoCompilation() configureProtoCompilation()
compileThirdpartyJava { tasks.named("compileThirdpartyJava").configure {
options.errorprone.enabled = false options.errorprone.enabled = false
options.compilerArgs += [ options.compilerArgs += [
// valueOf(int) in RoutingPriority has been deprecated // valueOf(int) in RoutingPriority has been deprecated
@ -117,11 +117,11 @@ compileThirdpartyJava {
] ]
} }
checkstyleThirdparty { tasks.named("checkstyleThirdparty").configure {
enabled = false enabled = false
} }
[compileJava].each() { tasks.named("compileJava").configure {
it.options.compilerArgs += [ it.options.compilerArgs += [
// TODO: remove // TODO: remove
"-Xlint:-deprecation", "-Xlint:-deprecation",
@ -134,12 +134,12 @@ checkstyleThirdparty {
"|") "|")
} }
jar { tasks.named("jar").configure {
archiveClassifier = 'original' archiveClassifier = 'original'
from sourceSets.thirdparty.output from sourceSets.thirdparty.output
} }
javadoc { tasks.named("javadoc").configure {
// Exclusions here should generally also be relocated // Exclusions here should generally also be relocated
exclude 'com/github/udpa/**' exclude 'com/github/udpa/**'
exclude 'com/github/xds/**' exclude 'com/github/xds/**'
@ -159,7 +159,7 @@ javadoc {
} }
def prefixName = 'io.grpc.xds' def prefixName = 'io.grpc.xds'
shadowJar { tasks.named("shadowJar").configure {
archiveClassifier = null archiveClassifier = null
dependencies { dependencies {
include(project(':grpc-xds')) include(project(':grpc-xds'))
@ -180,7 +180,8 @@ shadowJar {
exclude "**/*.proto" exclude "**/*.proto"
} }
task checkPackageLeakage(dependsOn: shadowJar) { def checkPackageLeakage = tasks.register("checkPackageLeakage") {
dependsOn shadowJar
doLast { doLast {
def jarEntryPrefixName = prefixName.replaceAll('\\.', '/') def jarEntryPrefixName = prefixName.replaceAll('\\.', '/')
shadowJar.outputs.getFiles().each { jar -> shadowJar.outputs.getFiles().each { jar ->
@ -203,11 +204,11 @@ task checkPackageLeakage(dependsOn: shadowJar) {
} }
} }
test { tasks.named("test").configure {
dependsOn checkPackageLeakage dependsOn checkPackageLeakage
} }
jacocoTestReport { tasks.named("jacocoTestReport").configure {
classDirectories.from = sourceSets.main.output.collect { classDirectories.from = sourceSets.main.output.collect {
fileTree(dir: it, fileTree(dir: it,
exclude: [ // Exclusions here should generally also be relocated exclude: [ // Exclusions here should generally also be relocated