Slackbot
02/01/2023, 7:09 PMJohn
02/01/2023, 7:10 PMimport org.gradle.kotlin.dsl.add as ktAdd
to avoid resolving to the built-in groovy DependencyHandler methods, but when i call
ktAdd(name,project.dependencies.enforcedPlatform("mydep")){
version {
bomConstraints.add(this)
}
}
it will only resolve to the non-generic version that takes a string dependencyJohn
02/01/2023, 7:10 PMVampire
02/01/2023, 7:17 PMT : org.gradle.api.artifacts.ModuleDependency
Vampire
02/01/2023, 7:17 PMinterface ModuleDependency extends Dependency
Vampire
02/01/2023, 7:18 PMDependency enforcedPlatform(
John
02/01/2023, 7:27 PMJohn
02/01/2023, 7:27 PMproject.dependencies.apply {
add(name, project.dependencies.enforcedPlatform("mydep"), closureOf<ExternalModuleDependency> {
version {
bomConstraints.add(this)
}
})
}
John
02/01/2023, 7:27 PMVampire
02/02/2023, 11:50 AMenforcedPlatform
actually returns an ExternalDependency
.
In that case casting the enforcedPlatform
result to ExternalDependency
should also work.John
02/02/2023, 3:32 PM