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

Is it true that starting from Hilt version 2.45, the compiler cannot pass the arguments parameter of the project kapt? #4512

Open
xuexixuexijpg opened this issue Nov 21, 2024 · 1 comment

Comments

@xuexixuexijpg
Copy link

xuexixuexijpg commented Nov 21, 2024

The following picture is my builde gradle parameters:
Image

Output parameter diagram when executing kaptDebugKotlin task:
Image

Output parameter diagram when executing hiltJavaCompileDebug task:
Image
From the hiltJavaCompileDebug task, some project parameters are missing, which leads to errors in the judgment of project parameters obtained by Processors of other frameworks.

The following is one way to write the example. The temporary solution is to change other people's processing to prohibit throwing errors. I don't know why Hilt does not pass the project's arguments parameter.
Image

@danysantiago
Copy link
Member

This is indeed a bug where Hilt's final JavaCompileTask includes annotation processors configured by the users in KAPT / KSP but does not also copy processor arguments.

You should be able to workaround this by finding the task and applying the options:

// in a build.gradle.kts
tasks.withType<JavaCompile>().configureEach {
    if (name.startsWith("hiltJavaCompile")) {
        options.compilerArgs.add("-AModuleName=app")
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants