nebula-plugins / nebula-project-plugin

Healthy defaults for a standard Gradle project
Apache License 2.0
93 stars 19 forks source link

annotationProcessor gradle configuration should be inherited by integTestAnnotationProcessor #52

Closed jvmlet closed 5 years ago

jvmlet commented 5 years ago

Please make integTestAnnotationProcessor to inherit from testAnnotationProcessor to make lombok seamlessly available in integration test as well.

rpalcolea commented 5 years ago

Hi @jvmlet

Thanks for reporting this

This should be fixed now in v6.1.0

tbroyer commented 5 years ago

This is a wrong move here.

Just because I use an annotation processor for my unit tests does not mean that I use it for my integration tests; in the exact same way that just because I use an annotation processor for my main source does not mean that I'll use it for my unit tests (the reason why testAnnotationProcessor does not extend annotationProcessor)

If you want Lombok on all your sourcesets, than configure it as such; but by the way, the io.freefair.lombok Gradle plugin will setup all source sets' annotationProcessor configuration to extend the lombok configuration, so lombok is automatically enabled in all source sets, without this change (and it's always been that way: https://github.com/freefair/gradle-plugins/commit/74592f937d14bed3d69126df9fcb678db21a9793#diff-57c58553341173b0058fd8a40823e0b3R51-R53)

jvmlet commented 5 years ago

@tbroyer, I wonder what do you think about implementation dependency inheritance of integration test configuration. Is it wrong move as well?

tbroyer commented 5 years ago

testImplementation extends implementation (https://docs.gradle.org/current/userguide/java_plugin.html#tab:configurations), and there aren't much choices as there's no testApi, only testImplementation. To me, integTest extends test just like test extends main.

If you're asking about whether integTest should somehow "extend" test (as it is today) or not, that's another debate; and the new java-test-fixtures plugin in Gradle 5.6 possibly reshuffles the cards. That being said, nebula.integtest is a simple default configuration of nebula.facet, so if one prefers integTest to be entirely separate from test, that's easy to do with nebula.facet; and if one wants them to somehow share code through another facet, that's possible too (it might be easier to create a new facet instead of configuring test to reuse the shared facet), and if you're not publishing the project you could also use java-test-fixtures as the shared facet.

jvmlet commented 5 years ago

Bottom line: if integTest inherits test, then integTestAnnotationProcessor should inherit testAnnitationProcessor.

tbroyer commented 5 years ago

Counter argument: test inherits main yet testAnnotationProcessor does not inherit annotationProcessor.

And the argument invoked in favor of changing the plugin's behavior had no basis.