mulesoft-labs / mule-gradle-plugin

Plugin for building mule apps with the gradle build system.
Apache License 2.0
24 stars 14 forks source link

Allow applying components multiple times #47

Closed sohrab- closed 9 years ago

sohrab- commented 9 years ago

I actually thought this is how mule.components {} already works but turns out it was not.

This will come in handy especially when working on multi-project solutions. For example, I have a custom Gradle plugin that applies mule-gradle-plugin and sets up some common modules, etc. Each Mule project then applies this custom plugin and adds not so common stuff, say a web service adapter does mule.components { modules += 'ws' }.

This way I can still use the default dependencies set by mule-gradle-plugin and also can use the nice DSL of mule.components {} to add more stuff multiple times.

Current work-around is for me to setup everything directly into the arrays and make sure no one uses components() unless it is the last project in the dependency chain.

Obvious backward compatibility issue would be if anyone is touching mule.components directly at the moment, e.g. mule.components = { .. }.

Do you see any issues with this change? I thought through how this plays out, especially considering ordering of closures when executing. For my scenario at least, this works fairly well since custom plugin closure would apply first and then any closures set by the Mule project itself. Not sure if there is another scenario where this would not work as well?

juancavallotti commented 9 years ago

@sohrab- Thanks for this, it is already merged.