Gradle (in particular 4.x) and task progress

( #1

I have been trying out Gradle 4.0 with Grails… one thing that has historically confused users is that when you do gradle bootRun you get output like 85% EXECUTING. Even if the container is running. Gradle considers the build not complete until the bootRun task terminates. We have lived with it up until now but it is worse with Gradle 4.0 because now you get the seconds counter which is distracting

I was wondering if there was a way to feedback to Gradle that the build is complete instead of having this

<===========--> 85% EXECUTING [21m 18s]```

An API could be provided that allowed a task to mark progress as complete. This would avoid confusion for users of frameworks like Spring Boot and Grails. Thoughts?

(Daniel Lacasse) #2

Thanks for this question @Graeme_Rocher1. The percentage and time are meant to be related to the build session in Gradle. The way we would typically solve this in the past is to detach the execution of the server running from the Gradle build session to let Gradle run to completion. I understand there is some drawback to this solution. For example, you won’t be able to simply Ctrl-C Gradle to exit the server. However, this would typically kill the daemon too which hurt your performance. What I would suggest is the following options:

Option #1: You have a task to start the server and another one to stop the server. The server is started in the background and Gradle has the knowledge to locate the server.

Option #2: Gradle opens a new prompt in the context of the server and detaches it from the build session. You can then close the server by closing the prompt.

I would be leaning toward option #1 as you can wire your tasks in such a way that it ensure the server is stopped when the build expect it and start it when required.

Feel free to ask more questions,


(Eric Wendelin) #3

Thanks Graeme for the feedback.

I filed an issue for the very problem a couple weeks ago at — I also included a suggestion in there to show “WAITING” like we do for --continuous build.

What do you folks think of that?

(Sterling Greene) #4

I’ve opened, which I think is close to what Graeme is looking for. We want to be able to describe processes that Gradle can start, leave running and then optionally kill/wait for at the end of the build.

( #5

Thanks yes this looks like closest to my suggestion. It is very confusing for users when they see the EXECUTING message as they think the server hasn’t started. I think this would be a major improvement and impacts more than Grails (Play, Jetty plugin, Spring Boot, Tomcat plugin etc.)

(Eric Wendelin) #6

We currently have this at the top of the backlog for Gradle 4.2.

Will reply when we’ve made progress.

(Eric Wendelin) #7

One quick update for those following this. We don’t yet have a way to know which tasks are intended to execute indefinitely, so it seems that we’ll need to have task authors declare this information. We are considering a public API for this.