Instantiate File Tree in groovy class supporting custom plugin

How can I instantiate a file tree when I lack access to the project?

I have a task class which uses a BuildResultsValidator.groovy class. I want to pass it a File and then create a file tree but I don’t see any way to instantiate a file tree unless I’m in the groovy-gradle task class.

What’s the proper way to do this? Pass down project to any supporting class I write that needs to create file tree?

Thanks

Peter

You could make it more specific than that since you really only need an instance of ‘FileOperations’. This is a slightly less coupled implementation.

new MySupportingClass((FileOperations) getProject());