This message was deleted.
# community-support
s
This message was deleted.
a
Using
frameworkVersion.get()
will cause the property to be evaluated too early. Instead, use
frameworkVersion.map {}
and
dependencies.create()
to create a Dependency lazily, and use
dependencies.addProvider(...)
to add it to 'implementation'.
s
Thank you! This got me very close to the solution. Now the question is how I add a
implementation(platform(...))
dependency instead of just
implementation
What do I give here instead of
implementation
dependencies.addProvider("implementation",  extensionProps.frameworkVersion.map {s -> "com.company:bom:$s })
v
implementation
is
implementation
is
implementation
.
platform(...)
is part of the dependency.
s
Any pointers to how I can get
platform()
dependency here?
v
dependencies.platform(...)
s
Hmm I am confused.
dependencies.platform()
returns a
Dependency
.
dependencies.addProvider
expects a
dependencyNotation
. Any way to get a
dependencyNotation
from a
Dependency
This worked -
Copy code
configurations.implementation.get().dependencies.addAllLater(extensionProps.frameworkVersion.map { listOf(dependencies.platform("com.company:bom:$it))})
t
I'd say this should work:
Copy code
dependencies {
    implementation(extensionProps.frameworkVersion.map { dependencies.platform("com.company:bom:$it") })
}
(according to the docs, you can use a provider with the standard
add
or the equivalent type-safe accessors: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html#N17255)
👍 1
v
And if you are inside
dependencies{ ... }
also just
platform(...)
instead of
dependencies.platform(...)
should work.
👍 2
s
Thanks! This worked too