Can we somewhat disable/"unregister" a Processor that previously registered either via @AutoService or META-INF?
My case is I want to disable some processor from kapt when running unit test because it's unnecessary to execute them. Thanks
t
tapchicoma
10/23/2023, 7:56 PM
could you describe your issue a little more? AFAIK you need explicitly specify kapt processors for tests annotation processing.
s
statmark56
11/01/2023, 1:44 AM
Hi @tapchicoma!
I'm terribly sorry for the late reply since I sign-out from the workplace a while ago.
Given:
Copy code
// build.gradle
dependencies {
kapt(libraryA)
}
When I run the unit test, I can see the kapt libraryA is running (main classpath) which I don't think it's necessary to run since my unit test simply doesn't need any of its generated codes.
My question is can I skip this particular kapt when running unit test? Currently I just apply the conditional check:
Copy code
dependencies {
if (task is not unit test) {
kapt(libraryA)
}
}
It works but I'm just wondering for more cleaner way if any.
t
tapchicoma
11/03/2023, 8:28 AM
hm, probably cleaner way would be to split you code that does not require annotation processor into separate Gradle sub-project and include it into the code that require annotation processor as project dependency