You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given I register a transform from attribute foo to attribute bar,
when I register another transform from attribute foo to attribute bar,
Gradle should fail the build, notifying me about the conflicting registrations.
Current Behavior (optional)
Boths transforms are registered. During transform execution the transform that was registered first is selected leading to surprising behavior.
Context
We have a pattern in our build for downloading and unpacking binaries. We use custom Ivy repositories to model GitHub release pages. Then in case we download an archive, we register transforms in order unpack the binary just once instead of having unpack tasks registered in each project. See the 'Modeling downloadable resources using Ivy repositories' section in this issue. Usually we create a plugin that deals with all of this logic. We might have a buildlogic.helm plugin that takes care of downloading the helm CLI, and then another plugin buildlogic.chromedriver that download chromedriver.
Recently I had to download GitHub CodeQL CLI which is provided as a Zip archive here. First I tried using org.gradle.api.internal.artifacts.transform.UnzipTransform for unpacking, because we use it in a few other places, but that didn't work, because UnzipTransform does not restore file permissions from the Zip. So I created my own transform that reads the file permissions from the archive and restores them on the file. The code looked something like this:
This code worked for most of the projects I applied the plugin to. However if failed for two projects reporting a file permission error. After lots of digging, I realized that for the two projects we register another "download executable plugin" and that plugin registers org.gradle.api.internal.artifacts.transform.UnzipTransform for the same attributes. Because the other plugin was registered first in the failing projects, Gradle selected the UnzipTransform and ignored the transform that would restore file permissions.
The workaround for this was to use a different to attribute setting to make transform registrations unique. However I think having multiple transforms registered for the same set of attributes should cause an error.
The text was updated successfully, but these errors were encountered:
Expected Behavior
Given I register a transform from attribute foo to attribute bar,
when I register another transform from attribute foo to attribute bar,
Gradle should fail the build, notifying me about the conflicting registrations.
Current Behavior (optional)
Boths transforms are registered. During transform execution the transform that was registered first is selected leading to surprising behavior.
Context
We have a pattern in our build for downloading and unpacking binaries. We use custom Ivy repositories to model GitHub release pages. Then in case we download an archive, we register transforms in order unpack the binary just once instead of having unpack tasks registered in each project. See the 'Modeling downloadable resources using Ivy repositories' section in this issue. Usually we create a plugin that deals with all of this logic. We might have a
buildlogic.helm
plugin that takes care of downloading the helm CLI, and then another pluginbuildlogic.chromedriver
that download chromedriver.Recently I had to download GitHub CodeQL CLI which is provided as a Zip archive here. First I tried using
org.gradle.api.internal.artifacts.transform.UnzipTransform
for unpacking, because we use it in a few other places, but that didn't work, becauseUnzipTransform
does not restore file permissions from the Zip. So I created my own transform that reads the file permissions from the archive and restores them on the file. The code looked something like this:This code worked for most of the projects I applied the plugin to. However if failed for two projects reporting a file permission error. After lots of digging, I realized that for the two projects we register another "download executable plugin" and that plugin registers
org.gradle.api.internal.artifacts.transform.UnzipTransform
for the same attributes. Because the other plugin was registered first in the failing projects, Gradle selected theUnzipTransform
and ignored the transform that would restore file permissions.The workaround for this was to use a different
to
attribute setting to make transform registrations unique. However I think having multiple transforms registered for the same set of attributes should cause an error.The text was updated successfully, but these errors were encountered: