toolbox icon indicating copy to clipboard operation
toolbox copied to clipboard

BuildResult#task(<taskPath>) should have good error message when task path is not absolute

Open lacasseio opened this issue 2 years ago • 0 comments

As a developer using Gradle Runner Kit, I want an accurate error message when the task path is not absolute so I can find the API usage issue easily.

An even better solution would be to make it a compiler error; however, I don't think that would be possible. We could use something like BuildResult#task(String firstTaskPathSegment, String... otherTaskPathSegment), ex: result.task('UpToDateCheck', 'AppDebug'). However, I prefer something else to this. We could model the TaskPath to something like TaskPath.absolute(String path) where the path specified implicitly starts with :. Or at least something that signals to the user the path is absolute (not relative). We should probably start with an internal model and simply convert the specified taskPath into the model, which should take care of the exception handling.

Acceptance Criteria

  • [ ] Given a relative task path MyProject:myTask, when calling BuildResult#task an exception should be thrown explaining the specified path is relative (in Gradle terms), and it needs to be absolute.

lacasseio avatar Mar 21 '23 14:03 lacasseio