java - How to depend on all *compile and *testCompile tasks in Gradle -


i have in animalsniffer plugin 1 task depend on compilation of production classes (java, groovy, scala) in sourcesets , second depend on compilation of test classes in sourcesets (possibly separate test , integrationtest).

i wouldn't depend on *classes tasks *classes tasks should depend animalsniffer tasks (which detects java version api incompatibilities after compilation , can stop build).

is there better way in gradle achieve checking if instance of abstractcompile task name starts "compiletest"?

you can use tasks.withtype(abstractcompile) returns compile tasks source sets (which includes java, groovy, scala). can filter on eliminating tasks have test in them suggested in other answer.

for specific task depend on these, can following:

mytask.dependson tasks.withtype(abstractcompile).matching {     !it.name.tolowercase().contains("test") } 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -