From 0e9c1abda020cb35041a96ec2062160f94bc0634 Mon Sep 17 00:00:00 2001 From: Goooler Date: Mon, 12 Sep 2022 03:55:07 +0800 Subject: [PATCH] Add resolutionStrategy to limit ktlint version (#1449) --- build.gradle.kts | 9 ++++++++- gradle/libs.versions.toml | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1a351f40dd..038788b4c1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,6 +17,14 @@ buildscript { classpath(libs.gradlePlugin.kotlin) classpath(libs.gradlePlugin.mavenPublish) } + + configurations.classpath { + resolutionStrategy.eachDependency { + when (requested.group) { + libs.ktlint.get().module.group -> useVersion(libs.versions.ktlint.get()) + } + } + } } // https://youtrack.jetbrains.com/issue/KTIJ-19369 @@ -52,7 +60,6 @@ allprojects { apply(plugin = "org.jmailen.kotlinter") kotlinter { - version = rootProject.libs.versions.ktlint disabledRules = arrayOf( "annotation", "argument-list-wrapping", diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 405516653e..5237200ea3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ androidx-test = "1.4.0" compose = "1.2.1" composeCompiler = "1.3.1" coroutines = "1.6.4" -ktlint = "0.47.0" +ktlint = "0.47.1" okhttp = "4.10.0" okio = "3.2.0" @@ -51,6 +51,8 @@ junit = "junit:junit:4.13.2" kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test-junit" } +ktlint = { module = "com.pinterest.ktlint:ktlint-core", version.ref = "ktlint" } + material = "com.google.android.material:material:1.6.1" okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }