Iterating through a native binary's buildTypes in Gradle 2.5+

I have a task that iterates through each declared buildType, printing it’s name:

apply plugin: 'cpp'

model {
    buildTypes {

task printBuildTypes {
    println "Declared build types are:"
    buildTypes.all { buildType ->
        println "  ${}"

This task executes as I’d expect, printing ‘Debug’ then ‘Release’ to the screen, when using Gradle v2.4.

However when I run this task using Gradle v2.5 - v2.9, my declared buildTypes are not printed to screen.

I assume this has something to do with the changes for “Rule based model configuration” introduced in Gradle v2.5? How can I iterate through my declared build types using Gradle v2.5+ ?