Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add annotation-processor to clientcore ci.yml #43886

Merged
merged 21 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix source version
  • Loading branch information
samvaity committed Jan 27, 2025
commit eb924c82cf95e5f3d6181f57ad9ca97b63457bfe
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
Expand All @@ -49,8 +51,20 @@
* Annotation processor that generates client code based on annotated interfaces.
*/
@SupportedAnnotationTypes("io.clientcore.core.annotation.*")
@SupportedSourceVersion(SourceVersion.RELEASE_8)
public class AnnotationProcessor extends AbstractProcessor {

@Override
public SourceVersion getSupportedSourceVersion() {
// Reflective fallback if SourceVersion.RELEASE_8 isn't available at compile time
try {
return SourceVersion.valueOf("RELEASE_8");
} catch (IllegalArgumentException e) {
// Fallback to the latest supported version
return SourceVersion.latest();
}
}

@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
// We iterate through each interface annotated with @ServiceInterface separately.
Expand Down
2 changes: 1 addition & 1 deletion sdk/parents/clientcore-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@
</compilerArgs>
<generatedSourcesDirectory>${project.build.directory}/generated-test-sources/</generatedSourcesDirectory>
<annotationProcessors>
<annotationProcessor>io.clientcore.tools.codegen.AnnotationProcessor</annotationProcessor>
<annotationProcessor>io.clientcore.annotation.processor.AnnotationProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
<executions>
Expand Down