-
Notifications
You must be signed in to change notification settings - Fork 304
Upgrade gradle to v8.14.2 #8950
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
base: master
Are you sure you want to change the base?
Changes from all commits
7dbe654
8687a76
5f70c40
1ce7f27
5901131
c92a468
0fc2f41
0bb8eab
b2d3f3b
581e03a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
apply from: "$rootDir/gradle/java.gradle" | ||
|
||
// JUnit5 5.3.0+ version is needed because of the fix in the TestInheritance test suite names. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The updates to the latest version of JUnit Jupiter and Platform address the error:
I'm honestly not quite sure why the gradle upgrade initiated this. Others have faced the same problem (unplanned junit issue) and also resolved it by switching the versions. |
||
|
@@ -33,9 +32,9 @@ dependencies { | |
|
||
// versions used below are not the minimum ones that we support, | ||
// but the tests need to use them in order to be compliant with Spock 2.x | ||
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.9.2' | ||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.9.2' | ||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.9.2' | ||
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.13.1' | ||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.13.1' | ||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.13.1' | ||
|
||
latestDepTestImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '+' | ||
latestDepTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '+' | ||
|
@@ -44,8 +43,8 @@ dependencies { | |
|
||
configurations.matching({ it.name.startsWith('test') }).each({ | ||
it.resolutionStrategy { | ||
force group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.9.2' | ||
force group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.9.2' | ||
force group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.9.2' | ||
force group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.13.1' | ||
force group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.13.1' | ||
force group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.13.1' | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import datadog.trace.agent.test.base.AbstractPromiseTest | ||
import io.netty.util.concurrent.DefaultEventExecutorGroup | ||
import io.netty.util.concurrent.Future | ||
import io.netty.util.concurrent.GenericProgressiveFutureListener | ||
import io.netty.util.concurrent.ProgressiveFuture | ||
import io.netty.util.concurrent.ProgressivePromise | ||
import spock.lang.Shared | ||
|
||
|
@@ -61,15 +61,12 @@ class NettyProgressivePromiseTest extends AbstractPromiseTest<ProgressivePromise | |
when: | ||
runUnderTrace("parent") { | ||
def listeners = iterations.collect { int i -> | ||
return new GenericProgressiveFutureListener<Future<?>>() { | ||
|
||
@Override | ||
void operationComplete(Future<?> future) throws Exception { | ||
return new GenericProgressiveFutureListener<ProgressiveFuture<?>>() { | ||
void operationComplete(ProgressiveFuture<?> future) throws Exception { | ||
runUnderTrace("listen$i") {} | ||
} | ||
|
||
@Override | ||
void operationProgressed(Future<?> future, long progress, long total) throws Exception { | ||
void operationProgressed(ProgressiveFuture<?> future, long progress, long total) throws Exception { | ||
runUnderTrace("progress$i") {} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GenericProgressiveFutureListener argument extends ProgressiveFuture (ref), and for some reason with the Gradle upgrade, I get the error: |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ final testTasks = scalaVersions.collect { scalaLibrary -> | |
def (major, minor) = version.split('_').collect(Integer.&valueOf) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changes in this file address aesthetic comments in the previous Gradle upgrade #8886 |
||
final javaConcatenation = major > 2 || minor > 11 // after 2.11 scala uses java.lang.StringBuilder to perform concatenation | ||
|
||
final configuration = configurations.create("${version}Implementation") { | ||
final implementationConfiguration = configurations.create("${version}Implementation") { | ||
canBeConsumed = false | ||
canBeResolved = false | ||
canBeDeclared = true | ||
|
@@ -36,14 +36,14 @@ final testTasks = scalaVersions.collect { scalaLibrary -> | |
canBeConsumed = false | ||
canBeResolved = true | ||
canBeDeclared = false | ||
extendsFrom(configuration) | ||
extendsFrom(implementationConfiguration) | ||
} | ||
|
||
dependencies { handler -> | ||
handler.add(configuration.name, scalaLibrary) | ||
handler.add(configuration.name, libs.slf4j) | ||
handler.add(implementationConfiguration.name, scalaLibrary) | ||
handler.add(implementationConfiguration.name, libs.slf4j) | ||
if (javaConcatenation) { | ||
handler.add(configuration.name, project(':dd-java-agent:instrumentation:java-lang')) | ||
handler.add(implementationConfiguration.name, project(':dd-java-agent:instrumentation:java-lang')) | ||
} | ||
} | ||
|
||
|
@@ -59,7 +59,7 @@ final testTasks = scalaVersions.collect { scalaLibrary -> | |
.filter { !it.toString().contains('scala-library') } // exclude default scala-library | ||
.minus(files(sourceSets.test.scala.classesDirectory)) // exclude default /build/classes/scala/test folder | ||
.plus(customSourceSet.output.classesDirs) // add /build/classes/scala/${version} folder | ||
.plus(classPathConfiguration) // add new scala-library configuration | ||
.plus(classPathConfiguration) // add new scala-library configuration | ||
systemProperty('uses.java.concat', javaConcatenation) | ||
dependsOn(tasks.named("compile${version.capitalize()}Scala")) | ||
group = 'verification' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ class GradleLauncherSmokeTest extends AbstractGradleTest { | |
]) | ||
String[] command = ["./gradlew", "--no-daemon", "--info"] | ||
if (gradleDaemonCmdLineParams) { | ||
command += "-Dorg.gradle.jvmargs=$gradleDaemonCmdLineParams" | ||
command += "-Dorg.gradle.jvmargs=$gradleDaemonCmdLineParams".toString() | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This resolves errors I was getting with assigning GStringImpl to String[] (others' experiences: apache issue, stackoverflow issue). Seems like this should be resolved with groovy 3.0.7+, but I guess not… |
||
return shellCommandExecutor.executeCommand(IOUtils::readFully, command) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import org.gradle.api.internal.provider.PropertyFactory | ||
import org.gradle.jvm.toolchain.internal.SpecificInstallationToolchainSpec | ||
|
||
apply plugin: 'java-library' | ||
|
@@ -164,7 +165,7 @@ project.afterEvaluate { | |
def testJvmHomePath = getJavaHomePath(testJvmHome) | ||
// Only change test JVM if it's not the one we are running the gradle build with | ||
if (currentJavaHomePath != testJvmHomePath) { | ||
def jvmSpec = new SpecificInstallationToolchainSpec(project.getObjects(), file(testJvmHomePath)) | ||
def jvmSpec = new SpecificInstallationToolchainSpec(project.services.get(PropertyFactory), file(testJvmHomePath)) | ||
// The provider always says that a value is present so we need to wrap it for proper error messages | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is needed due to the introduced error |
||
Provider<JavaLauncher> launcher = providers.provider { | ||
try { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ okhttp-legacy = "[3.0,3.12.12]" # 3.12.x is last version to support Java7 | |
okio = "1.17.6" # Datadog fork | ||
|
||
spock = "2.3-groovy-3.0" | ||
groovy = "3.0.17" | ||
groovy = "3.0.24" | ||
junit5 = "5.9.2" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When upgrading from Gradle <= 8.13, Groovy needs to be upgraded to 3.0.24: https://docs.gradle.org/current/userguide/upgrading_version_8.html#upgrade_to_groovy_3_0_24 |
||
logback = "1.2.3" | ||
bytebuddy = "1.17.5" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import org.gradle.api.plugins.jvm.JvmTestSuite | ||
|
||
ext.addTestSuiteExtendingForDir = (String testSuiteName, String parentSuiteName, String dirName) -> { | ||
ext.addTestSuiteExtendingForDir = { testSuiteName, parentSuiteName, dirName -> | ||
testing { | ||
suites { | ||
create(testSuiteName, JvmTestSuite, { | ||
|
@@ -27,16 +27,12 @@ ext.addTestSuiteExtendingForDir = (String testSuiteName, String parentSuiteName, | |
} | ||
} | ||
} | ||
dependencies { | ||
implementation project(project.path) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
configurations { | ||
def extendConf = { | ||
String suffix -> | ||
def extendConf = { suffix -> | ||
def config = named("${testSuiteName}${suffix}") | ||
def parentConfig = named("${parentSuiteName}${suffix}") | ||
if (parentConfig.present) { | ||
|
@@ -65,12 +61,16 @@ ext.addTestSuiteExtendingForDir = (String testSuiteName, String parentSuiteName, | |
from(sourceSets.named(testSuiteName).get().output) | ||
archiveClassifier = testSuiteName | ||
} | ||
|
||
project.dependencies { | ||
"${testSuiteName}Implementation"(project(project.path)) | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Project dependencies was separated out due to the error |
||
|
||
ext.addTestSuiteForDir = (String testSuiteName, String dirName) -> { | ||
ext.addTestSuiteForDir = { testSuiteName, dirName -> | ||
ext.addTestSuiteExtendingForDir(testSuiteName, 'test', dirName) | ||
} | ||
|
||
ext.addTestSuite = (String testSuiteName) -> { | ||
ext.addTestSuite = { testSuiteName -> | ||
ext.addTestSuiteForDir(testSuiteName, testSuiteName) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,15 +157,15 @@ class MetricPeriodicActionTest extends Specification { | |
|
||
class DefaultMetricPeriodicAction extends MetricPeriodicAction { | ||
|
||
private final MetricCollector<Metric> collector | ||
private final MetricCollector<MetricCollector.Metric> collector | ||
|
||
DefaultMetricPeriodicAction(@NonNull final MetricCollector<Metric> collector) { | ||
DefaultMetricPeriodicAction(@NonNull final MetricCollector<MetricCollector.Metric> collector) { | ||
AlexeyKuznetsov-DD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.collector = collector | ||
} | ||
|
||
@Override | ||
@NonNull | ||
MetricCollector<Metric> collector() { | ||
MetricCollector<MetricCollector.Metric> collector() { | ||
return collector | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For some reason, upgrading Gradle leads to the new(?) error |
||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying to
./gradlew clean assemble
, I ran across the errorincompatible types: org.gradle.internal.service.scopes.BuildScopeServices cannot be converted to org.gradle.internal.service.DefaultServiceRegistry
. Explicitly setting thebuildScopeServices
type toDefaultServiceRegistry
(which is what injectCiVisibilityGradleListener takes) resolves this.I'm thinking that the Gradle upgrade has led to stricter type resolution as seen from errors->updates made below 🤔