我可以确定,通过添加以下内容:
kapt.verbose=true
在根项目的
gradle.properties
文件中,这会导致在控制台上打印出以下内容,例如在更改公共方法时:
Javac options: {}
[incremental apt] Changed files: [/Users/me/workspace/my-project/core/common/build/tmp/kapt3/stubs/foo/bar/ChangedClassName.java]
...
[INFO] Need to discovery annotation processors in the AP classpath
[INFO] Annotation processors: toothpick.compiler.factory.FactoryProcessor, toothpick.compiler.memberinjector.MemberInjectorProcessor
[INFO] Processing java sources with annotation processors: /Users/me/workspace/my-project/core/common/build/tmp/kapt3/stubs/foo/bar/ChangedClassName.java
[INFO] Annotation processing complete, errors: 0, warnings: 0
[INFO] Annotation processor stats:
[INFO] IncrementalProcessor: total: 61 ms, init: 1 ms, 3 round(s): 59 ms, 0 ms, 1 ms
[INFO] IncrementalProcessor: total: 1 ms, init: 1 ms, 3 round(s): 0 ms, 0 ms, 0 ms
这是增量注释处理被使用的时候。
进行全新构建时,会打印出以下内容:
Javac options: {}
[incremental apt] Changed files: []
...
[INFO] Need to discovery annotation processors in the AP classpath
[INFO] Annotation processors: toothpick.compiler.factory.FactoryProcessor, toothpick.compiler.memberinjector.MemberInjectorProcessor
[INFO] Processing java sources with annotation processors: [ALL THE FILES IN THE MODULE ARE LISTED HERE]
[INFO] Annotation processing complete, errors: 0, warnings: 0
[INFO] Annotation processor stats:
[INFO] IncrementalProcessor: total: 124 ms, init: 1 ms, 3 round(s): 122 ms, 1 ms, 0 ms
[INFO] IncrementalProcessor: total: 1 ms, init: 0 ms, 3 round(s): 1 ms, 0 ms, 0 ms
我使用的是Toothpick依赖注入框架,2.x版本开始支持增量注解处理。
如果有一个不支持增量处理的注解处理器,则会输出以下内容:
[INFO] Incremental KAPT support is disabled. Processors that are not incremental: butterknife.compiler.ButterKnifeProcessor.