kotlinx-knit icon indicating copy to clipboard operation
kotlinx-knit copied to clipboard

Improve compatibility with Gradle Provider API

Open aSemy opened this issue 2 years ago • 0 comments

Currently the properties that Knit considers are not compatible with Gradle lazy configuration

https://github.com/Kotlin/kotlinx-knit/blob/c4e77da4dfc4a863c71f7d09fe7c566d2ee39936/src/KnitPlugin.kt#L97-L104

This is a particular problem with the Knit files. I would like to be able to share the Markdown files using Gradle best practices, but because the Knit files use FileCollection, not a ConfigurableFileCollection, the files must be evaluated instantly, not on-demand.

Here is an example of how the properties could be made compatible with the Gradle Provider API

abstract class KnitPluginExtension {
    abstract val knitVersion: Property<String>
    abstract val siteRoot: Property<String>
    abstract val moduleRoots: ListProperty<String>
    abstract val moduleMarkers: ListProperty<String>
    abstract val moduleDocs: Property<String>
    abstract val files: ConfigurableFileCollection
    abstract val rootDir: RegularFileProperty
    abstract val dokkaMultiModuleRoot: Property<String>
    abstract val defaultLineSeparator: Property<String>
}

aSemy avatar Nov 13 '22 14:11 aSemy