Slackbot
01/28/2024, 3:25 PMPhilip W
01/28/2024, 4:20 PMInputChanges and checking for caches${File.separatorChar}modules-2${File.separatorChar}files-2.1, I just hope this (strange) path is stable...
@get:InputFiles
@get:Incremental
@get:Classpath
abstract val libs: ConfigurableFileCollectionVampire
01/28/2024, 4:47 PMCopySpec, for example using eachFile { ... }.
The path you are checking is stable as long as you stay within the same Gradle version.
But I think it is an implementation detail and could change with any minor version, for example if they feel the need to change the structure of those cache directories again, which is why they are versioned.Vampire
01/28/2024, 4:48 PMPhilip W
01/28/2024, 4:49 PMPhilip W
01/28/2024, 4:49 PMPhilip W
01/28/2024, 5:31 PMval resourcesJars: Provider<ResolvableConfiguration>
val nameAndFiles: Provider<Map<String, File>> = resourcesJars.flatMap { it.incoming.artifacts.resolvedArtifacts }.map {
it.associateBy({
val owner = it.variant.owner
if (owner is ModuleComponentIdentifier) {
"${owner.group}.${owner.module}.${owner.version}.jar"
} else {
it.file.name
}
}) {
it.file
}
})Vampire
01/28/2024, 5:52 PMHow can you rename the module names of external dependencies explicitly?I still meant in some copy-spec. Or actually maybe better using some artifact transform.
I think, I found a better solution using artifactView:Why do you use an artifact view while not changing anything in the view? That seems quite useless. Just
.incoming.artifacts should do the same.Philip W
01/28/2024, 5:54 PMI still meant in some copy-spec.But how do I get the gav/the id in a copy-spec? EachFile still returns the (unstable) cache file path.
Just .incoming.artifacts should do the same.Oh yes, forgot to remove it after my experiments.
Vampire
01/28/2024, 5:59 PMBut how do I get the gav/the id in a copy-spec? EachFile still returns the (unstable) cache file path.Sure, same as with the logic you came up with. You just asked whether you can do it with a
CopySpec instead of with a custom task with InputChanges and you can.Vampire
01/28/2024, 6:01 PM