Slackbot
01/24/2024, 11:43 AMVampire
01/24/2024, 3:23 PMconfigurations.runtimeClasspath.flatMap {
it.incoming.artifacts.resolvedArtifacts.map {
it.filter {
it.variant.attributes.getAttribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE) != null
}.map {
it.file
}
}
}Vampire
02/12/2024, 11:52 PM@CachedRule and attributes coming from module metadata file are primitve and not longer typed. So you have to check for actual OPERATING_SYSTEM_ATTRIBUTE attribute and a String typed version of it, or get the attribute keys and match by name.Vampire
02/13/2024, 12:19 AMconfigurations.runtimeClasspath.flatMap {
it.incoming.artifacts.resolvedArtifacts.map { artifactResults ->
artifactResults.filter { artifactResult ->
val variantAttributes = artifactResult.variant.attributes
variantAttributes
.keySet()
.filter { it.name == OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE.name }
.also {
if (it.size > 1) {
throw AssertionError("Multiple attributes with same name are not expected")
}
}
.singleOrNull()
?.let { variantAttributes.getAttribute(it) }
?.takeIf {
(it is OperatingSystemFamily) || (it is String)
} != null
}.map { artifactResult ->
artifactResult.file
}
}
}melix
02/13/2024, 12:58 PMmelix
02/13/2024, 12:58 PMVampire
02/13/2024, 12:59 PMmelix
02/13/2024, 1:00 PMVampire
02/13/2024, 1:01 PM