From 5e8558a441f7f58a189d670e025cc1cc790919a4 Mon Sep 17 00:00:00 2001 From: gbrodman Date: Tue, 29 Sep 2026 16:32:54 +0000 Subject: [PATCH] Make VKeyProcessor an isolating processor (#3240) Register VKeyProcessor as an ISOLATING incremental annotation processor in META-INF/gradle/incremental.annotation.processors and pass the annotated TypeElement as the originating element when generating VKeyConverter classes via JavaPoet. Previously, because VKeyProcessor was not declared incremental, Gradle disabled incremental Java compilation for both :core:compileJava and :core:compileTestJava, forcing a full recompilation of all ~3,000 source and generated classes in :core on every edit. This is because without knowing that the processor's input is isolated to a single test class, Gradle had to recompile everything. This cuts recompilation time (after you make, say, a one-line change) from like 20-30 seconds to like 3-5 seconds --- .../java/google/registry/processors/VKeyProcessor.java | 8 +++++++- .../META-INF/gradle/incremental.annotation.processors | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 processor/src/main/resources/META-INF/gradle/incremental.annotation.processors diff --git a/processor/src/main/java/google/registry/processors/VKeyProcessor.java b/processor/src/main/java/google/registry/processors/VKeyProcessor.java index 2967b13c5..b4ecf0d60 100644 --- a/processor/src/main/java/google/registry/processors/VKeyProcessor.java +++ b/processor/src/main/java/google/registry/processors/VKeyProcessor.java @@ -105,6 +105,7 @@ public class VKeyProcessor extends AbstractProcessor { } try { createJavaFile( + annotatedTypeElement, getPackageName(annotatedTypeElement), String.format(CONVERTER_CLASS_NAME_TEMP, simpleTypeName), TypeName.get(entityType), @@ -118,7 +119,11 @@ public class VKeyProcessor extends AbstractProcessor { } private static JavaFile createJavaFile( - String packageName, String converterClassName, TypeName entityType, TypeName keyType) { + TypeElement annotatedTypeElement, + String packageName, + String converterClassName, + TypeName entityType, + TypeName keyType) { ParameterizedTypeName attributeConverter = ParameterizedTypeName.get( ClassName.get("google.registry.persistence.converter", "VKeyConverter"), @@ -143,6 +148,7 @@ public class VKeyProcessor extends AbstractProcessor { TypeSpec.Builder classBuilder = TypeSpec.classBuilder(converterClassName) + .addOriginatingElement(annotatedTypeElement) .addAnnotation(AnnotationSpec.builder(ClassName.get(Converter.class)).build()) .addModifiers(Modifier.FINAL, Modifier.PUBLIC) .superclass(attributeConverter) diff --git a/processor/src/main/resources/META-INF/gradle/incremental.annotation.processors b/processor/src/main/resources/META-INF/gradle/incremental.annotation.processors new file mode 100644 index 000000000..bf79f5bfa --- /dev/null +++ b/processor/src/main/resources/META-INF/gradle/incremental.annotation.processors @@ -0,0 +1 @@ +google.registry.processors.VKeyProcessor,ISOLATING