Skip to content
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

Eager configuration of Tasks produces incorrect compiler arguments for HiltJavaCompile #3546

Closed
cdsap opened this issue Aug 24, 2022 · 1 comment · Fixed by #3658
Closed

Comments

@cdsap
Copy link

cdsap commented Aug 24, 2022

Hi, thanks for the plugin.

In a project using Hilt, kapt and Databinding, we noticed that Hilt tasks were causing overlapping outputs in the Gradle builds:

Screen Shot 2022-08-24 at 3 26 26 PM

We analyzed the different possible causes and we found that Hilt is copying the compiler arguments of the original compile task: https://github.com/google/dagger/blob/master/java/dagger/hilt/android/plugin/main/src/main/kotlin/dagger/hilt/android/plugin/HiltGradlePlugin.kt#L384
This action should be correct, however given the following scenario:

  • Databinding
  • Kapt
  • Hilt
  • Java >=9

an eager configuration of the JavaCompile tasks produces Hilt tasks with compiler arguments of databinding:
Screen Shot 2022-08-24 at 3 32 59 PM
This situation makes the hilt tasks no cacheable.

I created this repository: https://github.com/cdsap/HiltDatabindingIssue to reproduce the issue.
The action that triggers the early task configuration is:
https://github.com/cdsap/HiltDatabindingIssue/blob/main/app/build.gradle#L56

I'm not sure is Hilt bug, but I found interesting to share with you

@kuanyingchou
Copy link
Collaborator

Hi, @cdsap , thanks for creating the issue and the repro. I can reproduce this on my side, but still need more time to figure out the problem. I will update you as soon as possible.

copybara-service bot pushed a commit that referenced this issue Dec 5, 2022
Passing compiler args from other libraries are causing overlapping outputs and
cache misses. Here we filter out args we don't use in hope to reduce the chance
of that.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
copybara-service bot pushed a commit that referenced this issue Dec 6, 2022
Passing compiler args from other libraries are causing overlapping outputs and
cache misses. Here we filter out args we don't use in hope to reduce the chance
of that.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
copybara-service bot pushed a commit that referenced this issue Dec 6, 2022
Passing compiler args from other libraries are causing overlapping outputs and
cache misses. Here we filter out args we don't use in hope to reduce the chance
of that.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
copybara-service bot pushed a commit that referenced this issue Dec 6, 2022
Passing compiler args from other libraries are causing overlapping outputs and
cache misses. Here we filter out args we don't use in hope to reduce the chance
of that.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
copybara-service bot pushed a commit that referenced this issue Dec 6, 2022
Passing compiler args from other libraries are causing overlapping outputs and
cache misses. Here we filter out args we don't use in hope to reduce the chance
of that.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
copybara-service bot pushed a commit that referenced this issue Dec 7, 2022
Passing compiler args from other libraries are causing overlapping outputs and
cache misses. Here we filter out args we don't use in hope to reduce the chance
of that.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
copybara-service bot pushed a commit that referenced this issue Dec 7, 2022
Passing compiler args from other libraries are causing overlapping outputs and
cache misses. Here we filter out args we don't use in hope to reduce the chance
of that.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
copybara-service bot pushed a commit that referenced this issue Dec 20, 2022
Passing CommandLineArgumentProviders from other libraries are causing
overlapping outputs and cache misses. Here we filter out the providers
we don't use in hope to reduce the chance of that.

This CL also moved all processor flags added by Hilt to a single
CommandLineArgumentProvider.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
copybara-service bot pushed a commit that referenced this issue Dec 22, 2022
Passing CommandLineArgumentProviders from other libraries are causing
overlapping outputs and cache misses. Here we filter out the providers
we don't use in hope to reduce the chance of that.

This CL also moved all processor flags added by Hilt to a single
CommandLineArgumentProvider.

Fixes: #3546
RELNOTES=N/A
PiperOrigin-RevId: 492215422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants