I am writing a custom plugin and testing it, I want to introduce mock implementations. This is not only for testing, but also from the point of view of the API, I want to implement various implementations depending on the context. I am currently using Gradle 2.6, and I understand that it supports some form of Injection Dependency. I do not want to use Spring / Guice / HK2, since Gradle itself supports it. However, I cannot find any information on how to inject dependencies using the Gradle 2.6 API.
For example,
class CustomTask extends DefaultTask {
private SomeInterface interface
@Inject
CustomTask(SomeInterface interface) {}
@TaskAction
public void executeTask() {
interface.executeSomething()
}
}
So, in essence, I want to determine where to define the bindings for different instances SomeInterfaceand the mechanism for entering it into the task or elsewhere, like some custom classes.