Declare YamlConfigWriterTask output so it can be used from other tasks.#159
Conversation
| private val fladleDir = projectLayout.fladleDir.get().asFile | ||
|
|
||
| @OutputFile | ||
| val fladleConfigFile: File = fladleDir.resolve("flank.yml") |
There was a problem hiding this comment.
is it possible to make this simply a property so that it can be lazily evaluated?
There was a problem hiding this comment.
Isn't creating a File almost free? It's only when you try to access it that it involves the IO.
I can make it lazy but I don't see the point (maybe I'm missing something)
|
|
||
| private val yamlWriter = YamlWriter() | ||
|
|
||
| private val fladleDir = projectLayout.fladleDir.get().asFile |
There was a problem hiding this comment.
Not necessary for this PR, just something to be aware of this will cause overlapping outputs when using multiple configs. I wanted to fix this with: #147
We could create a directory based on the config name to solve this.
There was a problem hiding this comment.
does this need to be annotated with @Internal? (check if there are build warnings around this)
There was a problem hiding this comment.
@Internal is not needed because private fields don't generate getters.
I usually make the output configurable, but I'm trying to do the minimum changes to the current behavior or I would make a very big PR.
I like to do something like:
@get:OutputDirectory
val outputDir: DirectoryProperty = objectFactory.directoryProperty().convention(layout.buildDirectory.dir("fladle"))
(the example is with a Directory because I copy&pasted from other plugin I maintain, but in this case it could be simply a file)
There was a problem hiding this comment.
yeah, i like your approach of making this minimal, we can always fix the other stuff later. thanks!
I wanted to declare the inputs to (so it would be able to check if it's up-to-date) but:
Caused by: org.gradle.internal.snapshot.ValueSnapshottingException: Could not serialize value of type FlankGradleExtensionIn any case this is useful so the yaml can be used as an input for FlankExecutionTask (one of many)