google / dagger

A fast dependency injector for Android and Java.
https://dagger.dev
Apache License 2.0
17.44k stars 2.02k forks source link

AggregateDepsTask cache miss due to inconsistent order #3636

Open alextu opened 1 year ago

alextu commented 1 year ago

We saw on several occasion a remote cache miss:

The miss is caused by classpath files of AggregateDepsTask being ordered differently in the 2 builds, see screenshot below: image

A quick initial investigation lead me to this suspect: https://github.com/google/dagger/blob/master/java/dagger/hilt/android/plugin/main/src/main/kotlin/dagger/hilt/android/plugin/util/AggregatedPackagesTransform.kt#L49

walkTopDown() does not return files in a consistent order between platforms (or even JDKs ?).

kuanyingchou commented 1 year ago

Hi, @alextu , thanks for reporting this! I've submitted 5b5fcc82c2d031be6bc6607bc9882fb667563559 that sorts walkTopDown(). It should be included in the next release.

alextu commented 1 year ago

Thanks for the quick response!