Creating execution specifications

There are three base classes for execution specifications

In most cases a AbstractExecSpec is the minimum what you’ll need to set up.

If you want to implement tasks around an executable that uses commands then you need AbstractCommandExecSpec. AN example of this is something like terraform or `packer.

If you want to implement tasks around an executable that executes scripts then you need AbstractScriptExecSpec.

Creating a command specification

Use this when the external executable is command-driven i.e. terraform apply or npm install.

This can start as simple as

@CompileStatic
class MyCmdExecSpec extends AbstractCommandExecSpec<MyCmdExecSpec> {
    MyCmdExecSpec(ConfigCacheSafeOperations po) {
        super(ConfigCacheSafeOperations.from(po))
    }
}

You can also do something like

@Inject
MyCmdExecSpec(Project project) {
    super(ConfigCacheSafeOperations.from(project))
}

The latter will allow you to do project.objects.newInstance(MyCmdExecSpec).