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

Gradle 8.8-rc-1 is not compatible with Develocity plugin + Test Distribution #29013

Closed
rpalcolea opened this issue May 2, 2024 · 4 comments
Closed
Assignees
Milestone

Comments

@rpalcolea
Copy link
Contributor

Current Behavior

When applying Develocity plugin via a Settings plugin, ex.

buildscript {
    repositories {
        mavenCentral()
        maven {
            url = uri("https://plugins.gradle.org/m2/")
        }
    }
    dependencies {
        classpath 'com.gradle:develocity-gradle-plugin:3.17.2'
    }
}


apply plugin: MyPlugin

class MyPlugin implements Plugin<Settings> {

    @Override
    void apply(Settings settings) {
        settings.pluginManager.apply(com.gradle.develocity.agent.gradle.DevelocityPlugin)
    }
}

And configuring the test tasks to use testDistribution:

configure(subprojects) {
    apply plugin: 'java'

    repositories {
        mavenCentral()
    }

    dependencies {
        testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
        testImplementation 'org.junit.platform:junit-platform-launcher:1.10.2'
    }

    tasks.withType(Test) {
        useJUnitPlatform()
        develocity {
            testDistribution {
                enabled = true
                remoteExecutionPreferred = false
                maxLocalExecutors = 1
                maxRemoteExecutors = 0
            }
        }
    }
}

results in:


* Where:
Build file '/Users/rperezalcolea/Projects/github/rpalcolea/develocity-gradle-8_8-rc-1-issue/build.gradle' line: 32

* What went wrong:
A problem occurred evaluating root project 'develocity-gradle-8_8-issue'.
> Could not find method testDistribution() for arguments [build_f1zxr60n0efii4e7esqgee7dt$_run_closure1$_closure4$_closure6$_closure7@88f523c] on extension 'develocity' of type com.gradle.develocity.agent.gradle.internal.a_Decorated.

* Try:
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org.

It looks like the Test task is being decorated with com.gradle.develocity.agent.gradle.internal.DevelocityConfigurationInternal instead of com.gradle.develocity.agent.gradle.internal.test.DevelocityTestConfigurationInternal

Expected Behavior

It should decorate the Test task using DevelocityTestConfiguration and DevelocityTestConfigurationInternal accordingly

Context (optional)

No response

Steps to Reproduce

reproducer in https://github.com/rpalcolea/gradle-enterprise-plugin-test-distribution-issue/tree/main

Gradle version

8.8-rc.1

Gradle version that used to work

8.7

Build scan URL (optional)

No response

Your Environment (optional)

No response

@rpalcolea rpalcolea added a:regression This used to work to-triage labels May 2, 2024
@ov7a ov7a added this to the 8.8 milestone May 2, 2024
@ljacomet ljacomet modified the milestones: 8.8, 8.8 RC2 May 7, 2024
@ov7a
Copy link
Member

ov7a commented May 7, 2024

The issue is in the backlog of the relevant team and is prioritized by them.

@bamboo bamboo self-assigned this May 7, 2024
@bamboo
Copy link
Member

bamboo commented May 7, 2024

Thanks for the report @rpalcolea, this will be fixed in the next RC.

Notice however that the pattern tasks.withType(Test) { ... } causes all Test tasks on every subproject to be realized regardless of whether they will be actually used in a particular Gradle invocation.

In general, It's be better to use the tasks.withType(Test).configureEach { ... } pattern instead.

@rpalcolea
Copy link
Contributor Author

hi @bamboo ,

Yeah... I totally forgot when putting the thing together. We actually have some internal linting to continuously move build files that missed that, it is a great callout! thanks for bringing it up :) and also thanks for looking at this !

@bamboo
Copy link
Member

bamboo commented May 10, 2024

Fixed via #29083

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants