Precompile step for native builds

I am trying to use the plugin from here and having some trouble porting it to use with Gradle v4.8. The plugin implements a pre-compile step to generate source that becomes part of the build.

There is a problem with model rule QtPlugin#createQtMocTask(ModelMap, File).
Type-only model reference of type org.gradle.model.ModelMap<org.gradle.nativeplatform.NativeBinarySpec> (parameter 1) is ambiguous as multiple model elements are available for this type:
- binaries (created by: BinaryBasePlugin.Rules#binaries(BinaryContainer))
- components (created by: ComponentBasePlugin.PluginRules#components(ComponentSpecContainer))

I have made a few changes in an attempt to resolve the problem. I replaced use of BinarySpec with NativeBinarySpec in the QtPlugin but that didn’t help.

Can someone provide some guidance on porting this plugin to work with newer Gradle version.

Appreciate your time!!