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" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
buildFeatures { buildFeatures { compose = true }
compose = true
}
composeOptions { composeOptions {
useLiveLiterals = false useLiveLiterals = false
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()

View file

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

View file

@ -5,7 +5,8 @@
plugins { `kotlin-dsl` } 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) kotlin.jvmToolchain(jvmToolchainAction)

View file

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

View file

@ -12,7 +12,7 @@ class KtfmtPlugin : Plugin<Project> {
override fun apply(target: Project) { override fun apply(target: Project) {
val input = Callable { val input = Callable {
target.layout.projectDirectory.asFileTree.filter { file -> 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) } target.tasks.register<KtfmtFormatTask>("ktfmtFormat") { source(input) }