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

RoomSchema workaround not working as expected #376

Closed
vikasraimeesho opened this issue Nov 24, 2022 · 9 comments
Closed

RoomSchema workaround not working as expected #376

vikasraimeesho opened this issue Nov 24, 2022 · 9 comments

Comments

@vikasraimeesho
Copy link

I have added the room workaround block in the app module but looks like its not working.

room {
    schemaLocationDir = file("roomSchemas")
}

Here are the details

Task Setup Issues

Task declares the same output directory as task hiltJavaCompileDebug from dagger.hilt.android.plugin: '/Users/vikasrai/AndroidStudioProjects/supply_android/app/build/roomSchemas/compileDebugJavaWithJavac'.

Plugin: com.android.application
Task: compileDebugJavaWithJavac
Task type: org.gradle.api.tasks.compile.JavaCompile
Issues for the same task were detected in 1 module(s), total execution time was 9.5s (2.8%), by module:
  Execution mode: FULL, time: 9.5s (2.8%), determines build duration: true, on critical path: true, issues: Task Setup Issues

====Build information:====
Execution date: 25/11/22, 12:36 AM
Total build duration: 342.9s
Configuration time: 2.7s (0.8%)
Critical path tasks time: 338.7s (98.8%)
Critical path tasks size: 45
AGP versions: 7.2.2, 7.2.0
====Platform information:====
AI-213.7172.25.2113.9123335, JRE 11.0.13+0-b1751.21-8125866x64 JetBrains s.r.o., OS Mac OS X(aarch64) v12.0, screens 3456.0x2234.0; Retina

AS: Dolphin | 2021.3.1 Patch 1
Kotlin plugin: 213-1.7.20-release-for-android-studio-AS6777.52
Android Gradle Plugin: 7.2.2
Gradle: 7.3.3
Gradle JDK: version 11.0.13
NDK: from local.properties: (not specified), latest from SDK: (not found)
CMake: from local.properties: (not specified), latest from SDK: 3.18.1-g262b901, from PATH: (not found)
@runningcode
Copy link
Contributor

Hi @vikasraimeesho , we have tested the RoomSchema workaround with Gradle 7.3.3 and AGP 7.2.2. Can you clarify what you mean by "not working". What was the expected result and what actually happened? Where does this message you are sharing come from?

@vikasraimeesho
Copy link
Author

@runningcode
We’re getting this warning in the Android Studio's build analyzer tool. This is warning message
Screenshot 2022-11-25 at 4 10 10 PM

I was under the impression cache fix plugin will fix this issue. Not sure if its really related to cache fix plugin or dagger hilt issue. Looks like hiltJavaCompileDebug and compileDebugJavaWithJavac trying to use the same output directory.
I have checked with the local build cache disabled and removing the cache fix plugin then there was no such warning in the same scenario.

@runningcode
Copy link
Contributor

This is a bug in the Hilt Gradle Plugin. It copies CommandLineArgumentProviders from the main JavaCompile tasks to it's own JavaCompile tasks. If any one of these CommandLineArgumentProviders declares an output, it will be overlapping when the second task also receives the same output directory.

See this bug for more details: google/dagger#3546

Could you try using the task configuration avoidance API in your project to see if the overlapping outputs goes away?

@vikasraimeesho
Copy link
Author

Thanks for the clarification. Sure, I'll try this.

@vikasraimeesho vikasraimeesho changed the title RoomSchema workaround not working RoomSchema workaround not working as expected Nov 28, 2022
@vikasraimeesho
Copy link
Author

Do you mean to use task configuration avoidance api for hiltJavaCompileDebug?

https://github.com/google/dagger/blob/master/java/dagger/hilt/android/plugin/main/src/main/kotlin/dagger/hilt/android/plugin/HiltGradlePlugin.kt#L384

But here in the code they're using task configuration avoidance api.

@runningcode
Copy link
Contributor

I mean in your buildscript source code as well as all your third party plugins, make sure that none are using eager task configuration in order to avoid this issue.

@cdsap
Copy link
Member

cdsap commented Jan 10, 2023

hi, Hilt team merged the fix google/dagger@b7c0d3e creating a new HiltCommandLineArgumentProvider. Will test again when they publish new release

@vikasraimeesho
Copy link
Author

@cdsap Thanks for the update

@cdsap
Copy link
Member

cdsap commented Apr 3, 2023

@cdsap cdsap closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants