Hey, I’m curious about something, while running s...
# gradle
c
Hey, I’m curious about something, while running some github actions, I noticed some of my jobs where taking very long time. I noticed that several of my libraries are having this actions against them:
Copy code
Transforming ui-tooling-1.3.3.aar (androidx.compose.ui:ui-tooling:1.3.3) with IdentityTransform
5918
Transforming ui-tooling-1.3.3.aar (androidx.compose.ui:ui-tooling:1.3.3) with ExtractAarTransform
5919
Transforming ui-tooling-1.3.3.aar (androidx.compose.ui:ui-tooling:1.3.3) with AarTransform
This happens literally hundreds of times. I do not understand. I had this linked to me https://docs.gradle.org/current/userguide/artifact_transforms.html And now I’m looking into the gradle implementation to see if I can understand further. Does anyone understand how to cache this values? I tried turning cache on, but it did not change anything. Thank you in advance
v
The build cache you can enable is just the task output cache, I don't think it has any effect on the artifact transforms. An artifact transform needs to be written so that it can be cached and declare it is cacheable, then Gradle will cache the result.
c
But then why would this be happening more than a hundred times for each library? I’m not exaggerating on the hundred.
v
ExtractAarTransform
for example is not defined cacheable: https://android.googlesource.com/platform/tools/base/+/refs/heads/mirror-goog-studio-mast[…]/build/gradle/internal/dependency/ExtractAarTransform.kt Which also would not make sense, as the transform anyway just unpacks an archive and caching that would not help in any way.
Why it happens so often I cannot tell without analyzing the build in question. It should only be done when necessary. The three lines you showed also were different transforms, not the same.
Maybe you need to ask in some Android community. Especially as your question is misplaced in this channel (see the subject) 😉
e
I believe it's expected to be faster to re-execute those transformations than it is to cache them
but yeah, the details are really more about the Android build system itself
c
This same three lines are showing up repeatedly, they are just a sample from a bigger file This finder here with a 100+ finds it’s just the
Transforming ui-tooling-1.3.3.aar (androidx.compose.ui:ui-tooling:1.3.3) with IdentityTransform
line
Aha, excuse me, I really thought this was gradle related
e
https://android.googlesource.com/platform/tools/base/+/mirror-goog-studio-main/build-syst[…]id/build/gradle/internal/dependency/IdentityTransform.kt this literally performs no I/O (beyond probing file existence, which should be cached): it tells gradle that the result is the same as the input
there is no issue with it running a million times
v
This same three lines are showing up repeatedly, they are just a sample from a bigger file
This finder here with a 100+ finds it’s just the
Transforming ui-tooling-1.3.3.aar (androidx.compose.ui:ui-tooling:1.3.3) with IdentityTransform
line
It's not, in the screenshot there are three of those lines and all are different transforms. I don't say the other lines are not the same, but what you show is not. 🙂
Aha, excuse me, I really thought this was gradle related
Even if it were, it would be misplaced here. Again, have a look at the channel subject line. ;-)
c
Thank you @Vampire and @ephemient, I will take the topic somewhere but it already game me light