-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for creating tasks to format .gradle.kts
files
#337
Comments
I think this is a great idea. If we searched recursively for all .kts files, it would be a bit weird for nested multi-module projects. Because the parent project would also format the gradle scripts of subprojects. What do you think? |
Yeah that's a good point, so we get the top level |
For an ad-hoc solution, I've implented this in my val scriptFiles = fileTree(projectDir) { include("*.kts") }
val ktfmtFormatScript by
tasks.registering(KtfmtFormatTask::class) {
description = "Run Ktfmt formatter for script files on project '${project.name}'."
source = scriptFiles
}
tasks.ktfmtFormat { dependsOn(ktfmtFormatScript) }
val ktfmtCheckScript by
tasks.registering(KtfmtCheckTask::class) {
description =
"Run Ktfmt formatter validation for script files on project '${project.name}'."
source = scriptFiles
}
tasks.ktfmtCheck { dependsOn(ktfmtCheckScript) } |
I know but I think we can add support for |
Co-authored-by: Nicola Corti <[email protected]>
We should create tasks that format the gradle.kts files (like
ktfmtFormatKotlinScript
andktfmtCheckKotlinScript
) and hook them inside thektfmtFormat
andktfmtCheck
tasks.💡 Describe the solution you'd like
Could be implemented in a number of ways. Happy to discuss any approach
🤚 Do you want to develop this feature yourself?
This is up for grab :)
The text was updated successfully, but these errors were encountered: