Public private task


(Trung Vo) #1

Hi guys,

is there away to indicate public/private tasks in gradle
I need public/private tasks to make tasks API and so developers can tell which tasks to use and which tasks they shouldn’t use.

Cheers,
Tony


(Mark Vieira) #2

If the task is on the classpath there’s no real good way of stopping someone from directly using it. You have a few options for indicating this as such though:

  1. Put private tasks in an “internal” package (i.e. com.foo.tasks.internal)
  2. If generating JavaDoc or other documentation, omit private tasks
  3. Leverage something like tasks.whenTaskAdded() to issue a warning when users attempt to add a private task to the task container