This message was deleted.
# kotlin-dsl
s
This message was deleted.
j
i am doing
Copy code
import org.gradle.kotlin.dsl.add as ktAdd
to avoid resolving to the built-in groovy DependencyHandler methods, but when i call
Copy code
ktAdd(name,project.dependencies.enforcedPlatform("mydep")){
                    version {
                        bomConstraints.add(this)
                    }
                }
it will only resolve to the non-generic version that takes a string dependency
is there a way to specify the right extension method to use?
v
T : org.gradle.api.artifacts.ModuleDependency
interface ModuleDependency extends Dependency
Dependency enforcedPlatform(
j
ahh id have to cast the the result of enforcedPlatform?
i found i can also do this:
Copy code
project.dependencies.apply {
                add(name, project.dependencies.enforcedPlatform("mydep"), closureOf<ExternalModuleDependency> {
                    version {
                        bomConstraints.add(this)
                    }
                })
            }
to just use the raw groovy function
v
Yeah, that might work indeed if
enforcedPlatform
actually returns an
ExternalDependency
. In that case casting the
enforcedPlatform
result to
ExternalDependency
should also work.
👍 1
j
thanks
👌 1