More control over generated tasks for native components

Hallo there,

I’ve made a good experience with Gradle for Groovy/Java projects and I try now to set up a C/C++ project with Gradle in my company. My project has 10 different subprojects, each of this subproject is a static library, that uses a gtest plug-in to write unit tests. Project should also run on different platforms, e.g. based on arm cpu. So far so good.

Now calling gradle tasks I can see, that gradle creates for each of my subproject 6 different tasks:


If I also use different build types, then it will be even more.

Is there any way to specify, which tasks I want to have and which not or to disable tasks somehow? I do not use shared libraries in my project at all and unit testing on arm platform also doesn’t make much sense from my point of view.

I hope someone has an idea :slight_smile:

Best Regards,

You can disable tasks with

task disableMe << {
println ‘This should not be printed if the task is disabled.’
disableMe.enabled = false

(also I removed the tag on your topic)


Hallo François,

thanks a lot for your help! I disable tasks with following code:

tasks.whenTaskAdded { task ->

if (task.getName().contains (“SharedLibrary”)) {
task.setEnabled (false)

but I still see all disabled tasks, if I call gradle tasks from the cmd. Did I miss something?

Thanks in advance,

Hi @Anton1

To hide a task from the ./gradlew tasks execution, you can set its group attribute to an empty string
e.g on the build task

build {
 group = ''

The task will still be listed through ./gradlew tasks --all though.