Skip to content

Make incremental compile efficient in the presence of Annotation Processors #1320

@eriwen

Description

@eriwen

Migrated from GRADLE-3259 which had 19 votes

Compile avoidance was introduced in Gradle 3.4 (<= Users please read this). One can improve performance somewhat by separate annotation processors from the compile classpath.

Expected Behavior

Incremental Java compilation should avoid full rebuild when annotation processors are present.

Current Behavior

Currently we fall back to a full recompile when annotation processors are used. The reason for this is that we don't know which source files they need as an input. The APT API allows processor to access other source files then the one containing the annotation being processed.

Context

We could instrument the compiler to find out which files the annotation processors are actually reading and use this information to run them incrementally as well.

In cases where an annotation processor is taking the whole source tree as an input, we could warn the user (e.g. in build scans) that this is causing slower builds. Many developers might not even be aware of the trade-off between "saving time writing code" and "saving time running the build" they have to make.

Design Spec

Since this is a bigger feature, you can download the design spec as a PDF.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions