Expose annotated packages as mutable list?
JakeWharton opened this issue · 1 comments
Right now I do
annotatedPackages.add('com.example')
but it seems more common and DSL-y for Gradle in Groovy to do
annotatedPackages += 'com.example'
and/or
annotatedPackages += [ 'com.example.foo', 'com.example.bar' ]
The ListProperty
allows, among other things, linking the property on the task-level extension to the project-level extension (without using private/deprecated Gradle APIs).
Gradle does some bytecode manipulation (or however it's done) to generate setters, allowing setting those Property
properties using =
rather than .set()
in the Groovy DSL, so you'd want to ask them to possibly add Groovy extensions to ListProperty
(or HasMultipleValues
) to allow using the <<
and +=
operators (same could be done for Kotlin too btw).
Fwiw, I'll probably be migrating the net.ltgt.errorprone
plugin to use lazy properties too, this will allow things like:
tasks.withType<JavaCompile>().configureEach {
options.errorprone.nullaway.severity.set(options.errorprone.isCompilingTestOnlyCode.map {
if (it) CheckSeverity.INFO else CheckSeverity.ERROR
})
}
to assign a severity depending whether this is test code or main code, independently of initialization order of that isCompilingTestOnlyCode
property, so e.g. without the need for afterEvaluate
in an Android project.