hey folks. is anyone aware of a way to register a ...
# gradle
d
hey folks. is anyone aware of a way to register a Gradle task such that it runs in continuous mode i.e. as if
--continuous
had been passed?
v
If you want
--continuous
behavior, why don't you use
--continuous
? Or what behavior do you actually want?
d
Just to generally save the trouble of passing the flag e.g. when clicking from the Gradle task pane in IntelliJ. Also, the task is intended to only be used continuously
v
The programmatic way would be to set
gradle.startParameter.continuous
to
true
, but you cannot do that early enough. Even if I set it in an init script, it has no effect.
d
Thanks Bjorn. I'll have a play around. At the least I might be able to detect whether the flag is set and then prompt the user to pass the flag.
v
It's Björn or Bjoern, not Bjorn. ;-) Yes, querying and complaining should work fine if that's enough for your use-case. I just wonder what use-case it is, that should require that flag. Mind elaboration? I'm curious.
w
I actually have a use case too - a gradle plugin registers a task to format code, one per module. It's good if such format task fails if some code could not be formatted. At the same time if I run it for all modules at once, I'd like it to format all of them and not stop when it fails on one of them
v
That's
--continue
not
--continuous
d
My use case is a continuous file generation task in a Gradle plugin for a tool I am working on. I'd prefer a dedicated continuous generation task rather than just running the generate task with
--continuous
because the semantics will be different than running generate on its own
v
I don't understand why the semantics should be different, but yeah, just check the flag and fail, it alternatively behave differently if the flag is set