Yep, sorry String was a bad example. The question was about exposing internal Properties.
Assuming you have an @get:OutputFile val outputFile: RegularFileProperty, how do you forward that to other parts of the build? I find it somewhat convenient to expose the outputFile itself which then makes it possible to set it without going through the functions and disallowChanges. Maybe not a huge problem but I bumped into this lately and wasn't sure if there was a more idiomatic way.
Yep, sorry String was a bad example. The question was about exposing internal Properties.
Assuming you have an
@get:OutputFile val outputFile: RegularFileProperty
, how do you forward that to other parts of the build? I find it somewhat convenient to expose theoutputFile
itself which then makes it possible to set it without going through the functions anddisallowChanges
. Maybe not a huge problem but I bumped into this lately and wasn't sure if there was a more idiomatic way.I think that
disallowChanges()
is more for user-facing API. I do what you're suggesting all the time. E.g., in a task configuration block:Those properties aren't meant to be used by users, so if they mess with the properties, that's on them, Undefined Behavior.
I see, thanks!