El Zhang
02/05/2023, 12:05 PMConfiguration and collect some meta data from those dependencies that are added with it (must be Android AAR package). for example:
val caliperDependenciesConfiguration = project.configurations.maybeCreate("caliper").apply {
description = "..."
}
project.tasks.named("preBuild").configure {
doLast {
logger.lifecycle("preBuild doLast!")
val attributesAction =
Action<AttributeContainer> {
attribute(AndroidArtifacts.ARTIFACT_TYPE, "android-java-res")
}
val size = caliperDependenciesConfiguration.incoming
.artifactView {
this.lenient(true)
attributes(attributesAction)
}
.artifacts
.artifactFiles
.files
.size
logger.lifecycle("preBuild $size")
}
}
However it does not work as expected, any ideas about what’s wrong with above code snippet? Or at least how does it work in Java projects to collect dependencies data? Much thanks!