This message was deleted.
# community-support
s
This message was deleted.
v
Should work like that automatically since 4.0: https://github.com/gradle/gradle/issues/1818
j
This is about the log output, not about the stdout/stderr of the process. At least I see the interleaved output with Gradle 7.4.2.
v
The stdout / stderr of a task should land in the log on a specified level. By default LIFECYCLE, but you can configure it per task.
If it is interleaved, maybe you found a regression. Or there is more to it I don't remember. šŸ™‚
j
I've tried to build a local reproducer, but failed. At least in that small project the output of the
Exec
tasks is behaving exactly as you've described. šŸ¤”
Copy code
āÆ bat settings.gradle build.gradle sub1/build.gradle script.sh
───────┬──────────────────────────────────────────────
       │ File: settings.gradle
       │ Size: 74 B
───────┼──────────────────────────────────────────────
   1   │ rootProject.name = 'gradle-exec'
   2   │
   3   │ (1..5).each { i -> include("sub${i}") }
───────┓──────────────────────────────────────────────
───────┬──────────────────────────────────────────────
       │ File: build.gradle
       │ Size: 86 B
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ tasks.register("execAll") {
   2   │     group = "Exec"
   3   │     description = "Execute all exec tasks"
   4   │ }
───────┓──────────────────────────────────────────────
───────┬──────────────────────────────────────────────
       │ File: sub1/build.gradle
       │ Size: 222 B
───────┼──────────────────────────────────────────────
   1   │ def execTask = tasks.register("exec" + project.name, Exec) {
   2   │     group = "Exec"
   3   │     description = "Execute exec task"
   4   │     commandLine "/bin/sh", rootProject.file("script.sh"), project.name
   5   │ }
   6   │ rootProject.execAll.dependsOn(execTask)
───────┓──────────────────────────────────────────────
───────┬──────────────────────────────────────────────
       │ File: script.sh
       │ Size: 95 B
───────┼──────────────────────────────────────────────
   1   │ #!/bin/sh
   2   │ echo "$1 starts"
   3   │ for i in `seq 10`
   4   │ do
   5   │     echo "$1 -- $i"
   6   │     sleep 1
   7   │ done
   8   │ echo "$1 ended"
───────┓──────────────────────────────────────────────
Back to the drawing board! šŸ˜‰
FWIW, output of the project above.
v
šŸ‘ŒšŸ™‚
Did you see the other behaviour also when running locally, or when running through CI or similar? I mean to remember that there was maybe a difference, so that the grouping is maybe just done with
rich
console, but not with
plain
console.
j
At least locally it also looks fine with
plain
console.
šŸ‘Œ 1
What's interesting is that one task's output is always trickling in due to the
sleep
command in the script (for example
:sub4:execsub4
) but the other ones (
:sub1:execsub1
) are only printed completely.
v
Maybe the first that prints is printed live and the the others parallel running ones are collected and then printed in total. idk, never looked at that code.
One more thing you could try, maybe the difference was if a terminal is attached. So you could try redirecting stdin and stdout and check whether it is still grouped properly.
j
Thanks for the idea. I've tried it but the also is also cohesive there.
Copy code
./gradlew --no-daemon --max-workers 4 --parallel --console plain execAll > output.txt
šŸ‘Œ 1
@Vampire Thanks for your help! I'll look into the "real" build a bit more. Maybe I'm also misinterpreting the output. šŸ¤”
šŸ‘ 1