Can a ValueSource or BuildService use another BuildService?

i.e. can a buildservice be injected into some other instance constructed via gradle’s DI mechanism

if so, how?

Afair not injected, @ServiceReference only works for tasks and there also does the usesService boilerplate.

But you can just set a parameter.

Whether it works depends on the details.
For example if you use confguration cache and try to obtain the value source at configuration time, it will fail currently.

1 Like