-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileCollection.elements fail under load. #29147
Comments
bamboo
added
in:configuration-model
lazy api, domain object container
and removed
to-triage
labels
May 15, 2024
Stacktrace :
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current Behavior
When using the Large-Android project (which is our synthetic large android project with 1000s of modules), the
FileCollection.elements
API fails to carry the tasks dependencies attached to the underlyingFileCollection
instance.For instance, say a
FileCollection
instance depends on some other project's output, when using theFileCollection.elements
to get aProvider<List<FilesystemLocation>>>
will fail to carry the tasks dependency and eventually, when thatProvider
is resolved by callingfiles()
on it, you will get a failure like :The key thing here is that if you do use use the
FileCollection.files
instead ofFileCollection.elements
, it works fine so it seems to be related to theelements
API. Also this is only reproducible in the Large-Android project, I tried to repro in smaller projects but that worked fine.So say you have a FileCollection coming from a Configuration, something like :
and a Task defined like :
wired with :
and you will get the exception above.
However if you use that task :
wired with :
then it will just works fine !
To reproduce the issue, you can just take the attached project (careful, it's big), unzip the file.
In
build-logic
, you will find a custom plugin, in particular aCustomPlugin.kt
which sets up both functional and dysfunctional tasks so you can experience both the failure and success whether you use theFileCollection
directly or theFileCollection.elements
.To reproduce the issue, just run :
if you want to experience the successful run using the
FileCollection
in the task, just runObviously, using
FileCollection
is a workaround, the issue though is that ourVariant
API is relying onRegularFile
andDirectory
types for type safety. So we need to transforms incomingFileCollection
instances intoProvider<List<RegularFile>>
andProvider<List<Directory>>
using theFileCollection.elements
.Expected Behavior
it should work wether you use
FileCollection.files()
orFileCollection.elements.files()
APIs.Context (optional)
No response
Steps to Reproduce
download the repro project from here
unzip the zip, in the project folder, run
Gradle version
8.7
Build scan URL (optional)
No response
Your Environment (optional)
No response
The text was updated successfully, but these errors were encountered: