BuildTypes and its missingMethod groovy function

During what I would call “casual glancing” on the gradle src files, I found the BuildTypes.groovy class.

After digging, I find it pretty cool

For those wondering, it is used in the main build.gradle file of the gradle distribution

extensions.buildTypes = new BuildTypes(project)

buildTypes {
fullTest “runtimeTests”, “runtimeIntegTests”, useIncomingDistributions: true, defaultIntegTestExecuter: “forking”, testAllVersions: true

}

Thanks to groovy goodness, if the task ‘fullTest’ is called, it will add the provided string as tasks to the task that will be executed, and also the provided map elements as project properties.
All the various buildTypes are regrouped in a task group called ‘Build Type’

I’m surprised that this feature is not publicly exposed in the user guide, because it’s pretty cool.
As a build script writer, I tend to create meta tasks to regroup more low level tasks, and tell my users to launch only those meta tasks.
=> This is exaclty what the BuildTypes do !

Some improvements I could think of for this functionality are:

  • the possibility to easily add a description to each BuildType task
  • the possibility to hide all the other tasks (to force users to launch predefined build ‘stories’, i.e. tasks organized by the build writers in a certain way)

This was an experiment that we did to make our own CI configuration simpler. We do want to turn this into a proper feature in the future, but it just hasn’t bubbled up high enough on the “prioritised backlog”.

I know this hasn’t been discussed for awhile but we’ve been using this for years. I just upgraded our build to 7.3.3 and it still works using the BuildTypes code that was around in 2.2: gradle/BuildTypes.groovy at REL_2.2 · gradle/gradle · GitHub

I attempted to move to 7.4 but this no longer works. Is there an equivalent functionality that I can now use?

For example, we do:`buildTypes {
codeQuality ‘assemble’, ‘spotbugsMain’, ‘spotbugsTest’, enableCodeQuality: true

farmBuild ‘build’, ‘carbgen’, ‘publishCarbPublicationToMavenLocal’

itest ‘build’, ‘carbgen’, ‘publishCarbPublicationToMavenLocal’, ‘:itest:install-server:devinstall’, ‘:itest:jrf-ws-qa-tests:runTests’, ‘:itest:wls-ws-drts:runTests’

ciCodeQualityNightly ‘build’, ‘spotbugsMain’, ‘jacocoCodeCoverage’, ‘:javadoc-generation:docs’, enableCodeQuality: true
}