fix(build): adjust ktfmt path filtering to allow formatting build.gradle.kts files

This commit is contained in:
Harsh Shandilya 2023-07-06 12:38:56 +05:30
parent 053eb4e883
commit f583939635
No known key found for this signature in database
5 changed files with 6 additions and 11 deletions

View file

@ -29,9 +29,7 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
compose = true
}
buildFeatures { compose = true }
composeOptions {
useLiveLiterals = false
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()

View file

@ -23,9 +23,7 @@ android {
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
languageVersion.set(KotlinVersion.KOTLIN_1_7)
}
compilerOptions { languageVersion.set(KotlinVersion.KOTLIN_1_7) }
}
dependencies {

View file

@ -5,7 +5,8 @@
plugins { `kotlin-dsl` }
private val jvmToolchainAction = Action<JavaToolchainSpec> { languageVersion.set(JavaLanguageVersion.of(17)) }
private val jvmToolchainAction =
Action<JavaToolchainSpec> { languageVersion.set(JavaLanguageVersion.of(17)) }
kotlin.jvmToolchain(jvmToolchainAction)

View file

@ -6,9 +6,7 @@
rootProject.name = "build-logic"
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
}
plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" }
dependencyResolutionManagement {
repositories {

View file

@ -12,7 +12,7 @@ class KtfmtPlugin : Plugin<Project> {
override fun apply(target: Project) {
val input = Callable {
target.layout.projectDirectory.asFileTree.filter { file ->
file.extension == "kt" || file.extension == "kts" && !file.canonicalPath.contains("build")
file.extension == "kt" || file.extension == "kts" && !file.canonicalPath.contains("build/")
}
}
target.tasks.register<KtfmtFormatTask>("ktfmtFormat") { source(input) }