Native binaries: how to disable/control built artifacts

I’m trying to disable the production of shared libraries for a NativeLibrarySpec, but can’t seem to find official documentation on the interface for doing so.

This apparently does not work:

    components {
        goodbye(NativeLibrarySpec) {
            sources {
                binaries.withType(SharedLibraryBinarySpec) { bin -> binaries.remove(bin) }
                cpp.lib library: 'hello', linkage: 'api'
            }
        }
    }

Also, I’d like to know whether it’s possible to control on a run-to-run basis what variants are produced? Say on a given run I’d only like to produce the 64-bit release static libraries, and on the next run, only produce the 32-bit debug shared libraries, and so on. Is this possible?

I’ve found this suggestion:

…which seems to work for specifically disabling a type of binary, and presumably I could add other variant condition tests to selectively disable a build based on runtime properties.

Is this still the best way to achieve what I’m looking for?

Thanks!

Must have skipped over the <component-name>DebugStaticLibrary and other tasks generated by the model.

Never mind!