Slackbot
01/16/2024, 11:04 PMephemient
01/16/2024, 11:29 PMbuildscript {
dependencies {
classpath(platform("com.pinterest.ktlint:ktlint-bom:1.1.1"))
}
}
plugins {
id("org.jmailen.kotlinter") version "4.1.1"
}
and see that the plugin's dependencies are upgraded from ktlint:1.0.1 to ktlint:1.1.1, for exampletony
01/16/2024, 11:33 PMJustin Van Dort
01/17/2024, 12:17 AMadam
01/17/2024, 8:06 PMplugins { } and their dependencies and dependencies added via buildscript { } end up there (which also has its problems, but that's another topic)adam
01/17/2024, 8:07 PMtony
01/17/2024, 8:26 PMHasMultipleClassLoader or something? I have vague recollections from several years ago
for 2 and 3, I mean the plugins block doesn't support syntax to add arbitrary dependencies or arbitrary dependency constraints. For example
buildscript {
dependencies {
classpath("...") // for example
constraints { ... } // for example
}
}
plugins {
id("...") // this is all I can do
}
I am a fan of simplicity in build scripts, and so I try to eliminate buildscript {} blocks and have only a plugins {} block for build dependenciesadam
01/17/2024, 10:24 PMtony
01/17/2024, 11:01 PMbuildscript {
dependencies {
classpath(platform(libs.kotlinGradleBom))
}
}
here we apply a platform/BOM to our buildscript classpathtony
01/17/2024, 11:02 PMdependencies {
// This dependency resolves an issue that blocked AGP 7.1 usage. See dependencies.gradle.
classpath platform(deps.grpc_bom)
classpath enforcedPlatform(deps.kotlin.bom)
// Latest version of intellij-gradle plugin tries to push to newest Kotlin, so watch out!
classpath(deps.intellij) {
exclude group: 'org.jetbrains.kotlin'
}
classpath(deps.wire.gradle_plugin) {
// Wire 4.6.x leaks Kotlin 1.8.20
exclude group: 'org.jetbrains.kotlin'
}
constraints {
// Some plugins (e.g., Paparazzi) try to quietly upgrade the version of AGP and its dependencies that we use.
// Will eventually be fixed by <https://github.com/cashapp/paparazzi/pull/648>
classpath('com.android.tools.build:gradle') {
version {
strictly agpVersion
}
}
that is a snippet from a real projecttony
01/17/2024, 11:13 PM