https://github.com/anthonycr/incremental
A resource generator for incremental annotation processors
https://github.com/anthonycr/incremental
Last synced: 5 months ago
JSON representation
A resource generator for incremental annotation processors
- Host: GitHub
- URL: https://github.com/anthonycr/incremental
- Owner: anthonycr
- License: apache-2.0
- Created: 2018-04-28T00:54:59.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-12T02:42:09.000Z (over 6 years ago)
- Last Synced: 2024-11-07T20:52:01.290Z (7 months ago)
- Language: Kotlin
- Size: 91.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Incremental
A resource generator for incremental annotation processors## Abstract
Incremental annotation processing is supported by the Gradle build system after [version 4.7](https://docs.gradle.org/4.7/userguide/java_plugin.html#sec:incremental_annotation_processing). In order for annotation processors to participate in incremental compilation, they must register with the compiler through resources. An entry for each incremental processor, specifying its qualified name and behavior (isolating or aggregating), must be made in the `META-INF/gradle/incremental.annotation.processors` file. The Incremental library makes this easier by automatically managing these entries for you.
## Usage
Annotation processors should include both the annotations and the compiler
```groovy
implementation project(':incremental')
annotationProcessor project(':incremental-compiler')
```Isolating processors should use the `@AutoIsolating` annotation.
```kotlin
package com.example@AutoIsolating
class IsolatingProcessor : AbstractProcessor() {override fun process(annotations: Set, roundEnv: RoundEnvironment): Boolean {
...
}}
```Incremental will then generate the following resource entry.
```
com.example.IsolatingProcessor,isolating
```Aggregating processors should use the `@AutoAggregating` annotation.
```kotlin
package com.example@AutoAggregating
class AggregatingProcessor : AbstractProcessor() {override fun process(annotations: Set, roundEnv: RoundEnvironment): Boolean {
...
}}
```Incremental will then generate the following resource entry.
```
com.example.AggregatingProcessor,aggregating
```Processors that determine if they are isolating or aggregating at runtime should use the `@AutoDynamic` annotation.
```kotlin
package com.example@AutoDynamic
class DynamicProcessor : AbstractProcessor() {override fun getSupportedOptions(): Set = setOf(
"org.gradle.annotation.processing.aggregating" // "org.gradle.annotation.processing.isolating"
)override fun process(annotations: Set, roundEnv: RoundEnvironment): Boolean {
...
}}
```Incremental will then generate the following resource entry.
```
com.example.DynamicProcessor,dynamic
```## Debugging
Turn on debug logging by enabling a compiler option in the gradle build file.
```gradle
kapt {
arguments {
arg("incremental.debug", true)
}
}
```## License
```
Copyright 2018 Anthony RestainoLicensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
```