On 10/02/2012, at 3:16 AM, Luke Daley wrote:

> 
> On 09/02/2012, at 4:08 PM, [email protected] wrote:
> 
>> Wouldn't you just want to add a withBaseDir() to FileOperations so you could 
>> do project.fileOperations.withBaseDir() instead of having a 
>> fileOperationsWithBaseDir() method?
> 
> The complication is that many objects might implement FileOperations, and a 
> method called withBaseDir() is kinda ambiguous. For example, 
> project.withBaseDir().

Given that you would do something with the return value, it's not too bad:

withBaseDir 'build' copy { from 'classes' to 'new-classes' }
def classpath = withBaseDir('build').fileTree(dir: 'classes', include: 
'**/*.class')

> 
> The other option is to not have so many other domain objects implement 
> FileOperations, which also has some appeal. This would mean methods like 
> project.copy() would become project.fileOperations.copy().

This is my preference. The only type that should extend/implement 
FileOperations is Script, so that the file methods are available without 
qualification in build/init/settings scripts. Everything else should have-a 
FileOperations. And the only candidate that I can think of there is Project.


--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com

Reply via email to