This message was deleted.
# community-support
s
This message was deleted.
t
Shared Build Services would work well for this. You can load it, attach it to the tasks that require it, and then make it autocloseable. It will automatically close at some point at after the last task that depends on it finishes. The only thing you can’t currently do is fully wait until the end of the build, but if you know a very late task in your build you can make that task depend on the build service.
thank you 1
👍 3
v
The only thing you can’t currently do is fully wait until the end of the build
That's wrong. Just register the service as operation completion listener, then the close call will be between the last task finished and the build finishes.
t
Where’s that documented? I couldn’t find that anywhere in any docs
t
That gives you on task completion
It doesn’t actually give you the last task
Oh I get what you mean
Ok yeah that would work
You just ignore the listener callbacks it gives you
v
As it will receive events for all executed tasks, it stays alive until the last task finished and thus is closed after the last task and before the build finishes.
t
That makes sense. Just not super obvious at a high level
v
It also is the "official" CC compatible replacement for
gradle.buildFinished { ... }
t
Yeah. I hadn’t thought about using the close signal. So it gets closer to replacing buildFinished
Still doesn’t replace one of my use cases, but maybe something else will
v
Which one?
t
Knowing the build status
v
Well, you get the status of each task, isn't that enough for your use-case?
Just remember whether any had a failed status
t
I guess yeah that would work. Annoying but would work.
Close. But I need to be able to get the actual exception if the task failed due to an exception. Which that event doesn't provide. And the prior use case was using entirely public types, so it was doing something fully supported by gradle.
v
If you need the exceptions, you probably need to wrap all task actions with a decorator that gives you this information, similar to this: https://gradle-community.slack.com/archives/CA745PZHN/p1669199537726369?thread_ts=1669143228.172079&cid=CA745PZHN
t
Yeah... Thats not something I'm willing to do. I'll just wait for a proper solution, as this is an active regression from something legitimately supported. For now I'll just keep using the deprecated build listener. My code will never be configuration cache compatible anyway, since its still using the software model native plugins.
Also, taskActions is an internal API. I already use too many of those, would prefer to not use more.
v
Yeah, bad example by Jendrik, use
actions
instead of
taskActions
and you stay on the public side.
since its still using the software model native plugins.
Maybe your should have a look at Nokee. :-)
t
My use case is still unsupported by Nokee. I know it’s being worked on, and much more promising then the new gradle cpp plugins, but still has some gaps for our setup. He knows though, and I try to keep up and see when things finally get support for the things we need.
👌 1