Another use-case for Provider<ExternalModuleDepend...
# declarative-gradle
p
Another use-case for ProviderExternalModuleDependency support: https://github.com/gradle/gradle/issues/37814
Copy code
interface DependenciesExtension : Dependencies {
  val api: DependencyCollector
  val implementation: DependencyCollector

  val myLibVersion: Property<String> // has a convention value

  fun libA(): Provider<ExternalModuleDependency> {
    return myLibVersion.map { dependencyFactory.create("org.example.foo:bar:$it") }
  }
  fun libB(): Provider<ExternalModuleDependency> {
    return myLibVersion.map { dependencyFactory.create("org.example.foo:baz:$it") }
  }
}
IMHO thats the better approach instead of using an enum for different dependencies (sorry, kotlin ecosystem)
j
What enum are you referring to?
j
I am missing the point, can you clarify?
p
The current design (due to the missing Gradle feature) is:
Copy code
serialization {
  version = "1.11.0"
  formats = listOf("json", "cbor") // what configuration is the target?
}
I would prefer:
Copy code
dependencies {
  serialization {
    version = "1.11.0"
  }
  implementation(serialization.json)
  compileOnly(serialization.cbor)
}
👍 1
j
I think it is a bit overkill the need of that explicit version over using the old way and/or including a BOM.
Copy code
dependencies {
  implementation(libs.serialization.json)
  compileOnly(libs.serialization.cbor)
}
p
version has a default value
j
I don't know how the ecosystem will reply, but in my case I am pretty sure I will specify a version + getting instant updates with Renovate.
p
Well, that's true, but having an included "version catalog" is also nice
👍 1
j
On another hand, probably updating the gradle plugin will update that default version too, so it can be redundant. What I would prefer is to have a standard, because Kotlin can have this behavior, other languages or libraries do not, and can be a bit annoying over the other one that just work in any case because it just uses the versioning + dependency resolution system Gradle uses.