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

Can't fail build in gradle.taskGraph.whenReady(Action) #6900

Closed
eskatos opened this issue Sep 26, 2018 · 3 comments
Closed

Can't fail build in gradle.taskGraph.whenReady(Action) #6900

eskatos opened this issue Sep 26, 2018 · 3 comments
Assignees
Milestone

Comments

@eskatos
Copy link
Member

eskatos commented Sep 26, 2018

@dsvoronin commented on Tue Sep 25 2018

Expected Behavior

Following code in build.gradle.kts should fail build in the end of configuration phase:

gradle.taskGraph.whenReady {
    throw GradleException("!!!")
}

Current Behavior

Build successful with any type of exception thrown

same code in groovy fails build as expected

gradle.taskGraph.whenReady {
    throw new GradleException("!!!")
}

Context

I'm trying to configure fail fast properties validation for plugin

Your Environment

I'm using gradle 4.10.1 (also tried with .2 version)
It's just a sample Android studio project with provided sample added into root build.gradle.kts


@bamboo commented on Tue Sep 25 2018

Thanks for the report, @dsvoronin.

Curiously enough the Closure overload fails the build as expected:

gradle.taskGraph.whenReady(closureOf<TaskExecutionGraph> {
    throw GradleException("!!!")
})

@dsvoronin commented on Tue Sep 25 2018

Yep, closureOf variant works for me now (somehow failed when i tried)

@mkobit
Copy link
Contributor

mkobit commented Sep 26, 2018

I think can confirm this works on Gradle 4.9 and now fails on 4.10+. We have code that used to work with this.

For completeness, the Groovy example also fails when cast to use the Action method:

gradle.taskGraph.whenReady({
  throw new GradleException("!!!")
} as Action)

@adammurdoch adammurdoch self-assigned this Oct 23, 2018
@adammurdoch adammurdoch added this to the 5.0 RC1 milestone Oct 23, 2018
@adammurdoch
Copy link
Member

This is the same problem as #7329.

@adammurdoch
Copy link
Member

Fixed via #7510. The fix will be in Gradle 5.0.

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

No branches or pull requests

3 participants