This message was deleted.
# dependency-management
s
This message was deleted.
t
Copy code
val artifacts = configurations
  .getByName("compileClasspath")
  .artifactsFor("jar")
tasks.register<ResolveDependenciesTask>("resolveDependencies") {
  setCompileClasspath(artifacts)
}
where
artifactsFor()
is defined as:
Copy code
private fun Configuration.artifactsFor(attrValue: String): ArtifactCollection = incoming
  .artifactViewFor(attrValue)
  .artifacts

private fun ResolvableDependencies.artifactViewFor(attrValue: String): ArtifactView = artifactView {
  it.attributes.attribute(attributeKey, attrValue)
  it.lenient(true)
  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)
t
I suppose this is because you're calling
.artifacts
on your artifact view at configuration time. How about doing that in a provider you pass to
setCompileClasspath
instead? (such that it's only resolved at execution time)
👍 1
t
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 😞