Custom Native BuildTypes Ignored When Task Name Matches Build Type Name

Hi, I’m noticing that when I try to build with custom build types in Gradle 2.4, that they are ignored if I define a task with the same name as one of the build types.

Here is my build.gradle:

apply plugin: 'cpp'

model { 
    buildTypes {
    flavors {
    components {

task wrapper(type: Wrapper) {
    gradleVersion = '2.4'

task release() {

When building I get the following output:

$ ./gradlew build
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
:check UP-TO-DATE


Total time: 2.539 secs

And here are the results in the build/binaries directory:

$ tree ./build/binaries
└── mainExecutable
    ├── chocolate
    │   └── main
    └── mint
        └── main

3 directories, 2 files

I expected to get binaries for the following variants:

  • debugChocolate
  • releaseChocolate
  • debugMint
  • releaseMint

Here is a link to a project that demonstrates the issue.

What’s happening here is that instead of creating a new build type, release is simply referring to the project task named ‘release’. You can either a) rename the ‘release’ task or b) be more explicit when creating the build type.

model {
    buildTypes {
        create 'release'