google / protobuf-gradle-plugin

Protobuf Plugin for Gradle
Other
1.76k stars 274 forks source link

Avoid eagerly resolving input files in ProtobufExtract #713

Closed gavra0 closed 1 year ago

gavra0 commented 1 year ago

Rely on FileCollection.getElements() (available in Gradle 5.6+) to ensure no files are accessed eagerly during configuration. This also ensures configuration cache key does not depend on them.

Fixes issue #711.

Test: Added "testProjectDependent proto extraction with configuration cache" with Gradle 8.1

gavra0 commented 1 year ago

@ejona86 You analysis is correct: during task graph building Gradle had to compute return value of providerFactory.provider and to invoke get() on this provider. With FileCollection.getElements() the dependency information is already in that provider and it does not need to do a get() on it.

Thanks for a quick review :)