Remove native build tasks


in my project I want to remove the generated native build tasks but I can’t seem to get anywhere.

To explain what I’m doing, this is my build file, its a subproject of a larger set of projects:

It uses the java and cpp plugins and I want to enable only the shared library builds as well as selectively be able to skip single native builds when a property is set in the file.

The way I solved it atm is that I use gradle.startParameter.excludedTaskNames and add the names of the generated platform tasks (e.g. windows_x86BulletjmeStaticLibrary etc.). The problem with that is when I build another subproject it complains that “Task ‘windows_x86BulletjmeStaticLibrary’ not found in project ‘:jme3-android’.”. When I build the main project the result is exactly what I want though.

I already tried to use tasks.remove(taskname) in various combinations (in a task to be run at config time, in the root of the build file etc.) but because the task is being generated by the cpp plugin it cannot be found for removal.

Any ideas on what I could do here? I also generally didn’t find a way to completely disable the build of static libraries with the native compilation, the use of gradle.startParameter.excludedTaskNames seemed to be the only way for that as well but also leads to the aforementioned issues.

Thanks for any help, Normen

What you can do is set the unwanted binaries to not be buildable. For instance:

binaries.withType(StaticLibraryBinarySpec) {
    buildable = false

setBuildable is an internal interface right now, but in the future, it will go away and there will be some sort of public interface for a binary that allows you to disable building it (e.g. something like “enabled = false”).

Ah, thanks, going that route works, I can disable all static libs with that and when I don’t want the shared libs to be built according to the setting I simply set this to false for the shared libs too.

For reference, this is my build file after the changes.

Thanks again, Normen