Is there any way to apply a certain plugin only fo...
# gradle
a
Is there any way to apply a certain plugin only for tests?
v
Can you elaborate on what you mean?
c
Gradle plugins are applied to Projects, not Components, Sourcesets, Tasks, etc. It’s up to the plugin to configure itself for those, if needed, so you would probably need to dig into the plugin source code to see if there’s a way to configure it to run only for test sourcesets. A bit of a hack would be to simply disable/skip the tasks for non-test sourcesets, though that might cause problems if it produces Outputs that other non-disabled tasks depend on. As a last resort, you might need to move those particular tests into their own Gradle module and apply the plugin there.
a
Got it thanks. My use case is to utilize the kotlin-parcelize plugin only in android tests. Will probably extract to a separate module.