hello, I'm writing custom task that accepts as inp...
# gradle
d
hello, I'm writing custom task that accepts as input some file. I'd like to provide an option to pass it through command line (which I guess requires String) and also allow to set the file directly through DSL. Currently I expose those as two separate properties ->
Copy code
// set from command line
@Input
@Optional
@Option(option = "targetFileName", description = "target file")
val targetFileName: Property<String> = project.objects.property(String::class.java)

// set from DSL
@Input
@Optional
val targetFile: RegularFileProperty = project.objects.fileProperty()
Is there a better way? If not, is there a way to hide
targetFileName
from the DSL?
o
perhaps marking it as
internal
will be sufficient? that makes it public in the JVM, but KDSL won't see it. I don't know about groovy dsl
d
nope, by using
internal
I got an exception about missing getter
guess there is no harm in having both of those options available in
build.gradle