On 03/01/2013, at 7:30 AM, Luke Daley wrote:

> Hi,
> 
> I recently hit a case that made me reevaluate the way that we use 
> propertyMissing() to auto create items in container DSLs. 
> 
> In short: when configuring a container, if you reference a var that does not 
> exist on the container or the closure owner, an item will be created 
> automatically.
> 
> The code is here: 
> https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/groovy/org/gradle/api/internal/ConfigureDelegate.java#L75
> 
> The issue I hit was that I was trying to create a configuration called 'idea' 
> when the 'idea' plugin was applied. Given that we typically use a 
> delegate_first strategy everywhere, I expected this to work without fuss. I 
> understand why this can't really use proper delegate_first resolution.
> 
> I think we should deprecate this behaviour and force element creation to be 
> done via a method call, even if it's with an empty configure block. This is a 
> small amount of convenience to sacrifice for a increased understandability 
> and the reduced risk of confusing behaviour.
> 
> I'm proposing changing:
> 
> configurations {
>       custom
> }
> 
> to:
> 
> configurations {
>       custom { }
> }

Sound like a good idea. Can you add a jira issue for this?


--
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