Skip to content

Commit e4e2c13

Browse files
authored
Merge branch 'master' into master
2 parents cf56839 + 7c5277f commit e4e2c13

File tree

33 files changed

+681
-387
lines changed

33 files changed

+681
-387
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: |
3636
if (( JAVA_VERSION < 19 ));
3737
then
38-
mvn clean test -pl "!:avaje-http-nima-generator"
38+
mvn clean package -pl "!:avaje-http-nima-generator"
3939
else
40-
mvn clean test
40+
mvn clean package
4141
fi

.github/workflows/jdk-ea.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ jobs:
3737
- name: Maven version
3838
run: mvn --version
3939
- name: Build with Maven
40-
run: mvn clean verify
40+
run: mvn clean verify package
4141

http-api/pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,4 @@
1515
<tag>avaje-http-parent-1.19</tag>
1616
</scm>
1717

18-
<dependencies>
19-
20-
<dependency>
21-
<groupId>io.avaje</groupId>
22-
<artifactId>junit</artifactId>
23-
<version>1.1</version>
24-
<scope>test</scope>
25-
</dependency>
26-
27-
</dependencies>
28-
2918
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove from module-info all content after: // SHADED:

http-generator-client/src/main/java/io/avaje/http/generator/client/ClientProcessor.java

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
package io.avaje.http.generator.client;
22

3-
import io.avaje.http.api.Client;
4-
import io.avaje.http.generator.core.ControllerReader;
5-
import io.avaje.http.generator.core.JsonBUtil;
6-
import io.avaje.http.generator.core.ProcessingContext;
3+
import java.io.IOException;
4+
import java.io.Writer;
5+
import java.util.LinkedHashSet;
6+
import java.util.List;
7+
import java.util.Set;
78

89
import javax.annotation.processing.AbstractProcessor;
910
import javax.annotation.processing.ProcessingEnvironment;
1011
import javax.annotation.processing.RoundEnvironment;
12+
import javax.annotation.processing.SupportedAnnotationTypes;
1113
import javax.lang.model.SourceVersion;
1214
import javax.lang.model.element.AnnotationMirror;
1315
import javax.lang.model.element.AnnotationValue;
1416
import javax.lang.model.element.Element;
1517
import javax.lang.model.element.TypeElement;
1618
import javax.tools.FileObject;
17-
import java.io.IOException;
18-
import java.io.Writer;
19-
import java.util.LinkedHashSet;
20-
import java.util.List;
21-
import java.util.Set;
2219

20+
import io.avaje.http.generator.core.ClientPrism;
21+
import io.avaje.http.generator.core.ControllerReader;
22+
import io.avaje.http.generator.core.ImportPrism;
23+
import io.avaje.http.generator.core.JsonBUtil;
24+
import io.avaje.http.generator.core.ProcessingContext;
25+
26+
@SupportedAnnotationTypes({ClientPrism.PRISM_TYPE, ImportPrism.PRISM_TYPE})
2327
public class ClientProcessor extends AbstractProcessor {
2428

2529
private static final String METAINF_SERVICES_PROVIDER = "META-INF/services/io.avaje.http.client.HttpApiProvider";
@@ -43,14 +47,6 @@ public SourceVersion getSupportedSourceVersion() {
4347
return SourceVersion.latest();
4448
}
4549

46-
@Override
47-
public Set<String> getSupportedAnnotationTypes() {
48-
Set<String> annotations = new LinkedHashSet<>();
49-
annotations.add(Client.class.getCanonicalName());
50-
annotations.add(Client.Import.class.getCanonicalName());
51-
return annotations;
52-
}
53-
5450
@Override
5551
public synchronized void init(ProcessingEnvironment processingEnv) {
5652
super.init(processingEnv);
@@ -60,18 +56,20 @@ public synchronized void init(ProcessingEnvironment processingEnv) {
6056

6157
@Override
6258
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment round) {
63-
for (Element controller : round.getElementsAnnotatedWith(Client.class)) {
59+
for (final Element controller :
60+
round.getElementsAnnotatedWith(ctx.typeElement(ClientPrism.PRISM_TYPE))) {
6461
writeClient(controller);
6562
}
66-
for (Element importedElement : round.getElementsAnnotatedWith(Client.Import.class)) {
63+
for (final Element importedElement :
64+
round.getElementsAnnotatedWith(ctx.typeElement(ImportPrism.PRISM_TYPE))) {
6765
writeForImported(importedElement);
6866
}
6967
if (round.processingOver()) {
7068
writeServicesFile();
7169
}
7270
return false;
7371
}
74-
72+
7573
private void writeServicesFile() {
7674
try {
7775
final FileObject metaInfWriter = ctx.createMetaInfWriter(METAINF_SERVICES_PROVIDER);

http-generator-client/src/main/java/module-info.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
provides javax.annotation.processing.Processor with io.avaje.http.generator.client.ClientProcessor;
44

5-
requires transitive io.avaje.http.generator.core;
65
requires java.compiler;
6+
7+
// SHADED: All content after this line will be removed at package time
8+
requires transitive io.avaje.http.generator.core;
9+
710
}

http-generator-core/pom.xml

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,53 +17,87 @@
1717

1818
<dependencies>
1919

20-
<dependency>
21-
<groupId>jakarta.inject</groupId>
22-
<artifactId>jakarta.inject-api</artifactId>
23-
<version>2.0.0</version>
24-
</dependency>
2520

2621
<dependency>
27-
<groupId>javax.validation</groupId>
28-
<artifactId>validation-api</artifactId>
29-
<version>2.0.1.Final</version>
22+
<groupId>io.avaje</groupId>
23+
<artifactId>avaje-prisms</artifactId>
24+
<version>1.3</version>
25+
<optional>true</optional>
26+
<scope>provided</scope>
3027
</dependency>
3128

3229
<dependency>
3330
<groupId>io.avaje</groupId>
3431
<artifactId>avaje-http-api</artifactId>
3532
<version>1.26-SNAPSHOT</version>
33+
<optional>true</optional>
34+
<scope>provided</scope>
3635
</dependency>
3736

3837
<dependency>
3938
<groupId>io.swagger.core.v3</groupId>
4039
<artifactId>swagger-models</artifactId>
4140
<version>${swagger.version}</version>
41+
<exclusions>
42+
<exclusion>
43+
<groupId>com.fasterxml.jackson.core</groupId>
44+
<artifactId>jackson-annotations</artifactId>
45+
</exclusion>
46+
</exclusions>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>jakarta.validation</groupId>
51+
<artifactId>jakarta.validation-api</artifactId>
52+
<version>3.0.2</version>
53+
<optional>true</optional>
54+
<scope>provided</scope>
4255
</dependency>
4356

57+
<dependency>
58+
<groupId>javax.validation</groupId>
59+
<artifactId>validation-api</artifactId>
60+
<version>2.0.1.Final</version>
61+
<optional>true</optional>
62+
<scope>provided</scope>
63+
</dependency>
64+
65+
<dependency>
66+
<groupId>jakarta.inject</groupId>
67+
<artifactId>jakarta.inject-api</artifactId>
68+
<version>2.0.1</version>
69+
<optional>true</optional>
70+
<scope>provided</scope>
71+
</dependency>
72+
73+
4474
<dependency>
4575
<groupId>io.swagger.core.v3</groupId>
4676
<artifactId>swagger-annotations</artifactId>
4777
<version>${swagger.version}</version>
78+
<optional>true</optional>
79+
<scope>provided</scope>
4880
</dependency>
4981

5082
</dependencies>
5183

5284
<build>
5385
<plugins>
86+
5487
<plugin>
5588
<groupId>org.apache.maven.plugins</groupId>
5689
<artifactId>maven-compiler-plugin</artifactId>
57-
<version>3.10.1</version>
5890
<configuration>
59-
<source>11</source>
60-
<target>11</target>
61-
<!-- Turn off annotation processing for building -->
62-
<compilerArgument>-proc:none</compilerArgument>
91+
<annotationProcessorPaths>
92+
<path>
93+
<groupId>io.avaje</groupId>
94+
<artifactId>avaje-prisms</artifactId>
95+
<version>1.3</version>
96+
</path>
97+
</annotationProcessorPaths>
6398
</configuration>
6499
</plugin>
65100
</plugins>
66101
</build>
67102

68-
69103
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove from module-info all content after: // SHADED:

http-generator-core/src/main/java/io/avaje/http/generator/core/BaseProcessor.java

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.avaje.http.generator.core;
22

33
import java.io.IOException;
4-
import java.util.LinkedHashSet;
54
import java.util.Set;
65

76
import javax.annotation.processing.AbstractProcessor;
@@ -12,12 +11,7 @@
1211
import javax.lang.model.element.Element;
1312
import javax.lang.model.element.TypeElement;
1413

15-
import io.avaje.http.api.Controller;
16-
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
17-
import io.swagger.v3.oas.annotations.tags.Tag;
18-
import io.swagger.v3.oas.annotations.tags.Tags;
19-
20-
@SupportedOptions({"useJavax","useSingleton"})
14+
@SupportedOptions({"useJavax", "useSingleton"})
2115
public abstract class BaseProcessor extends AbstractProcessor {
2216

2317
protected ProcessingContext ctx;
@@ -29,10 +23,7 @@ public SourceVersion getSupportedSourceVersion() {
2923

3024
@Override
3125
public Set<String> getSupportedAnnotationTypes() {
32-
Set<String> annotations = new LinkedHashSet<>();
33-
annotations.add(Controller.class.getCanonicalName());
34-
annotations.add(OpenAPIDefinition.class.getCanonicalName());
35-
return annotations;
26+
return Set.of(ControllerPrism.PRISM_TYPE, OpenAPIDefinitionPrism.PRISM_TYPE);
3627
}
3728

3829
@Override
@@ -41,9 +32,7 @@ public synchronized void init(ProcessingEnvironment processingEnv) {
4132
this.ctx = new ProcessingContext(processingEnv, providePlatformAdapter());
4233
}
4334

44-
/**
45-
* Provide the platform specific adapter to use for Javalin, Helidon etc.
46-
*/
35+
/** Provide the platform specific adapter to use for Javalin, Helidon etc. */
4736
protected abstract PlatformAdapter providePlatformAdapter();
4837

4938
@Override
@@ -54,7 +43,8 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
5443
readTagDefinitions(round);
5544
}
5645

57-
Set<? extends Element> controllers = round.getElementsAnnotatedWith(Controller.class);
46+
final Set<? extends Element> controllers =
47+
round.getElementsAnnotatedWith(ctx.typeElement(ControllerPrism.PRISM_TYPE));
5848
for (Element controller : controllers) {
5949
writeControllerAdapter(controller);
6050
}
@@ -66,24 +56,26 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
6656
}
6757

6858
private void readOpenApiDefinition(RoundEnvironment round) {
69-
Set<? extends Element> elements = round.getElementsAnnotatedWith(OpenAPIDefinition.class);
59+
final Set<? extends Element> elements =
60+
round.getElementsAnnotatedWith(ctx.typeElement(OpenAPIDefinitionPrism.PRISM_TYPE));
7061
for (Element element : elements) {
7162
ctx.doc().readApiDefinition(element);
7263
}
7364
}
7465

7566
private void readTagDefinitions(RoundEnvironment round) {
76-
Set<? extends Element> elements = round.getElementsAnnotatedWith(Tag.class);
67+
Set<? extends Element> elements =
68+
round.getElementsAnnotatedWith(ctx.typeElement(TagPrism.PRISM_TYPE));
7769
for (Element element : elements) {
7870
ctx.doc().addTagDefinition(element);
7971
}
8072

81-
elements = round.getElementsAnnotatedWith(Tags.class);
73+
elements = round.getElementsAnnotatedWith(ctx.typeElement(TagsPrism.PRISM_TYPE));
8274
for (Element element : elements) {
8375
ctx.doc().addTagsDefinition(element);
8476
}
8577
}
86-
78+
8779
private void writeOpenAPI() {
8880
ctx.doc().writeApi();
8981
}

0 commit comments

Comments
 (0)