Collection<ModuleSourceSet> () { Collection<ModuleSourceSet> result = super.getAffectedSourceSets(); return myIncludeTests? result : result.stream().filter(set -> !set.getType().isTest()).collect(Collectors.toList()); }