Callum Rogers
09/05/2024, 2:57 PMCaused by: java.lang.UnsupportedOperationException: Mutation of attributes is not allowed
at org.gradle.api.internal.attributes.DefaultImmutableAttributes.attribute(DefaultImmutableAttributes.java:116)
Is there any way to do this?Callum Rogers
09/05/2024, 3:02 PMattributes(… instead allows me to add it, but it still doesn’t run the transformation.Vampire
09/05/2024, 3:03 PMVampire
09/05/2024, 3:04 PMCallum Rogers
09/05/2024, 3:04 PMVampire
09/05/2024, 3:05 PMVampire
09/05/2024, 3:05 PMCallum Rogers
09/05/2024, 3:07 PMTransformAction only gives me a TransformOutputs , don’t I need to call outputs.file(name) then copy to that location?Callum Rogers
09/05/2024, 3:08 PMVampire
09/05/2024, 3:10 PMoutputs.file(inputArtifact), fullstopCallum Rogers
09/05/2024, 3:11 PMCallum Rogers
09/05/2024, 3:11 PMObject hehCallum Rogers
09/05/2024, 3:37 PMCallum Rogers
09/05/2024, 3:37 PMVampire
09/05/2024, 3:38 PMVampire
09/05/2024, 3:39 PMCallum Rogers
09/05/2024, 3:39 PMVampire
09/05/2024, 3:54 PMfalse, you are requesting the attribute to be false for that dependencyVampire
09/05/2024, 3:58 PMfalse for all jars, you for example miss
diff --git a/build.gradle b/build.gradle
index 5eba4c1..4b6e9de 100644
--- a/build.gradle
+++ b/build.gradle
@@ -20,12 +20,12 @@ dependencies {
attribute fooAttribute
}
- annotationProcessor('com.google.guava:guava:31.0.1-jre') {
- attributes {
- attribute fooAttribute, false
- }
+ artifactTypes.getByName("jar") {
+ attributes.attribute(fooAttribute, false)
}
+ annotationProcessor('com.google.guava:guava:31.0.1-jre')
+
registerTransform(TransformThrows) {
def artifactType = Attribute.of("artifactType", String.class)
from.attribute(fooAttribute, false).attribute(artifactType, 'jar')
@@ -44,4 +44,3 @@ task resolveConfigurationAndHopefullyRunTransformAndThrowException {
configurations.annotationProcessor.resolve()
}
}Callum Rogers
09/05/2024, 4:13 PMFailed to transform checker-qual-3.12.0.jar
Failed to transform error_prone_annotations-2.7.1.jar
etcCallum Rogers
09/05/2024, 4:13 PMCallum Rogers
09/05/2024, 4:14 PMtrue for all jars as we don’t want to transform them - code to do this (and then have guava with it’s own attribute set to false), which if we do here results in this exception:
> Could not resolve all files for configuration ':annotationProcessor'.
> No variants of com.google.guava:guava:31.0.1-jre match the consumer attributes:
- com.google.guava:guava:31.0.1-jre configuration runtime declares a library for use during runtime, packaged as a jar:
- Incompatible because this component declares a component, as well as attribute 'foo' with value 'true' and the consumer needed a component, as well as attribute 'foo' with value 'false'
which is a better error - but it hasn’t actually run the transform to move to the correct attributeCallum Rogers
09/05/2024, 4:14 PMVampire
09/05/2024, 4:17 PMCallum Rogers
09/05/2024, 4:18 PMCallum Rogers
09/05/2024, 4:18 PMVampire
09/05/2024, 4:18 PMCallum Rogers
09/05/2024, 4:18 PMVampire
09/05/2024, 4:18 PMVampire
09/05/2024, 4:19 PMfalse for only that dependency.
But I'm not sure whether this will be considered for input to the artifact transform.Vampire
09/05/2024, 4:19 PMCallum Rogers
09/05/2024, 4:28 PMVampire
09/05/2024, 4:43 PM