Martin
12/22/2025, 10:59 PMorg.gradle.usage: nmcp as an attribute both on the consumer and on the producer side.
This has been serving me well until today where I bumped into an outgoingVariant that does not set org.gradle.usage and therefore get collected (because a missing attribute is compatible). What's the best way to fix this?Martin
12/22/2025, 11:03 PMorg.gradle.usage ?tony
12/23/2025, 12:08 AMtony
12/23/2025, 12:09 AMVampire
12/23/2025, 2:00 AMVampire
12/23/2025, 2:04 AMPhilip W
12/23/2025, 9:26 AMMartin
12/23/2025, 12:08 PMorg.gradle.usage missing: https://github.com/gradle/gradle/issues/36124Martin
12/23/2025, 12:10 PMat what point does an error occur? can you check the artifact in a task action before trying to manipulate it?@tony this is all happening when creating the zip to upload to Maven Central. The zip contains some source files. I could filter them out in the task before uploading but that feels a bit fragile...
you indeed could programmatically check and filter for the variants that actually do have the attribute set, it's just a bit tedious to do@Vampire do you have an example of how to do this by any chance?
Vampire
12/23/2025, 6:00 PMVampire
12/23/2025, 6:01 PMMartin
12/23/2025, 7:05 PMVampire
12/23/2025, 8:19 PMVampire
12/23/2025, 8:25 PM.resolvedArtifacts.map {
it.filter { artifactResult ->
val variantAttributes = artifactResult.variant.attributes
variantAttributes
.keySet()
.filter { it.name == OPERATING_SYSTEM_ATTRIBUTE.name }
.also {
if (it.size > 1) {
throw AssertionError("Multiple attributes with same name are not expected")
}
}
.singleOrNull()
?.let { variantAttributes.getAttribute(it) }
?.let {
when (it) {
is OperatingSystemFamily -> it.name
is String -> it
else -> null
}
} == os
}.map { artifactResult ->
artifactResult.file
}Vampire
12/23/2025, 8:26 PMwhen is necessary, because the type can be both, depending on whether it was added on-the-fly in the current build or whether it comes from a GMM fileMartin
12/23/2025, 11:20 PMPhilip W
12/24/2025, 8:07 AMVampire
12/24/2025, 2:17 PMcategory should be the one everyone sets I think.
And within the category then attributes must be good and significant.
For example the configurations for test results or jacoco results that are used for their aggregation also do not have usage set, but within category verification that is probably fine.Philip W
12/24/2025, 2:35 PMVampire
12/24/2025, 2:50 PMVampire
12/24/2025, 2:53 PMtony
12/24/2025, 5:30 PMMartin
12/24/2025, 6:02 PMorg.gradle.usage and org.gradle.category are too loosely defined. I'd like an attribute that maps 1:1 with who's creating/consuming the variant.tony
12/24/2025, 6:39 PMdagp.internal or something like that, so... yeah I agree haha