somewhat related question to the above. For years ...
# dependency-management
somewhat related question to the above. For years now, I've known it to be Evil ™️ to resolve dependencies during configuration. However, I only recently noticed this in a build scan. This differentiates between user- and gradle-initiated resolution. Is the latter "ok"? Or am I doing it wrong? Code snippet in thread
Copy code
val artifacts = configurations
tasks.register<ResolveDependenciesTask>("resolveDependencies") {
is defined as:
Copy code
private fun Configuration.artifactsFor(attrValue: String): ArtifactCollection = incoming

private fun ResolvableDependencies.artifactViewFor(attrValue: String): ArtifactView = artifactView {
  it.attributes.attribute(attributeKey, attrValue)
  it.componentFilter { componentIdentifier ->
    componentIdentifier is ModuleComponentIdentifier
note this is necessary because I'm dealing with an Android project
simply configuring that task resolves dependencies (by gradle)
I suppose this is because you're calling
on your artifact view at configuration time. How about doing that in a provider you pass to
instead? (such that it's only resolved at execution time)
👍 1
If I use
provider { artifactView.artifacts.artifactFiles }
, I still see this, which does look like it's resolving the dependencies at configuration time. What am I missing?
no matter what I try, it really wants to resolve these dependencies during configuration 😞