Does the upcoming variants implementation match that of Android's gradle plugin?

As many of you probably know, the Android Gradle plugin had support for build types and variants from the beginning. Their implementation meant two things:

  1. The creation of a BuildConfig.java class at build time, which contains information about the current build type/flavor and can be accessed from your code (ex, check BuildConfig.DEBUG if true as a switch in your code). 2. Support for different versions of a file depending on the build type/flavor. (ex, src/main/config.file for release, src/debug/config.file for debug)

My question is, are these 2 features going to be supported in the official Gradle implementation of build variants as well? If not, please consider doing so, as literally any Java project can and would benefit from having these 2 features. Currently I’m working on a web app and I seriously need feature 2, if not even both. As currently neither Maven, nor Gradle support something like this, implementing it officially for Gradle would completely blow Maven out of the water.

Hi Andrei,

It is something we are actively working on. We are working to support the notion of variants in a general way, so that there will be a consistent approach across domains. It’s a deep, deep, change though so there is a lot involved.

You can expect to see aspects of this rolling out in Gradle 2.5 and on.

Hi Luke. I know it’s a massive change and it is a work in progress. I just wanted to know if your implementation will allow for those 2 cases I mentioned.

It doesn’t currently out of the box support case 1, but does case 2.

OK, thanks a lot for the reply. Its really great to hear that it will support case 2, as that is a generic case for any type of project. Indeed, case 1 is probably not so generic, so I suppose a gradle plugin would best suit it.