tony
03/14/2022, 9:08 PMtony
03/14/2022, 9:10 PMval artifacts = configurations
.getByName("compileClasspath")
.artifactsFor("jar")
tasks.register<ResolveDependenciesTask>("resolveDependencies") {
setCompileClasspath(artifacts)
}
where artifactsFor()
is defined as:
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 projecttony
03/14/2022, 9:11 PMThomas Broyer
03/15/2022, 9:37 AM.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)tony
03/15/2022, 8:27 PMprovider { artifactView.artifacts.artifactFiles }
, I still see this, which does look like it's resolving the dependencies at configuration time. What am I missing?tony
03/15/2022, 9:16 PM