diff --git a/README.MD b/README.MD index cc6b3ca..139889a 100644 --- a/README.MD +++ b/README.MD @@ -22,7 +22,7 @@ Make sure you include the repository as well. com.github.qlsolutions.JavalinFly javalinfly-core - 0.1.10b2 + 0.2.0 ``` @@ -37,7 +37,7 @@ Make sure you include the repository as well. com.github.qlsolutions.JavalinFly javalinfly-core - 0.1.10b2 + 0.2.0 @@ -51,7 +51,7 @@ Make sure you include the repository as well. com.github.qlsolutions.JavalinFly javalinfly-kotlin - 0.1.10b2 + 0.2.0 ``` @@ -69,20 +69,20 @@ Make sure you include the repository as well. - Dependency ```groovy - implementation 'com.github.qlsolutions.JavalinFly:javalinfly-core:0.1.10b2' + implementation 'com.github.qlsolutions.JavalinFly:javalinfly-core:0.2.0' ``` - Annotation processor ```groovy - annotationProcessor 'com.github.qlsolutions.JavalinFly:javalinfly-core:0.1.10b2' + annotationProcessor 'com.github.qlsolutions.JavalinFly:javalinfly-core:0.2.0' ``` -
Optionally also the kotlin module ```groovy - implementation 'com.github.qlsolutions.JavalinFly:javalinfly-kotlin:0.1.10b2' + implementation 'com.github.qlsolutions.JavalinFly:javalinfly-kotlin:0.2.0' ```
@@ -93,19 +93,19 @@ Make sure you include the repository as well. - Dependency ```groovy - implementation("com.github.qlsolutions.JavalinFly:javalinfly-core:0.1.10b2") + implementation("com.github.qlsolutions.JavalinFly:javalinfly-core:0.2.0") ``` - Annotation processor ```groovy - annotationProcessor("com.github.qlsolutions.JavalinFly:javalinfly-core:0.1.10b2") + annotationProcessor("com.github.qlsolutions.JavalinFly:javalinfly-core:0.2.0") ``` -
Optionally also the kotlin module ```groovy - implementation("com.github.qlsolutions.JavalinFly:javalinfly-kotlin:0.1.10b2") + implementation("com.github.qlsolutions.JavalinFly:javalinfly-kotlin:0.2.0") ```
diff --git a/javalinfly-core/pom.xml b/javalinfly-core/pom.xml index 75b3b50..34dd0f6 100644 --- a/javalinfly-core/pom.xml +++ b/javalinfly-core/pom.xml @@ -6,7 +6,7 @@ com.github.unldenis JavalinFly - 0.1.10b2 + 0.2.0 javalinfly-core diff --git a/javalinfly-core/src/main/java/com/quicklink/javalinfly/annotation/JavalinFlyInjector.java b/javalinfly-core/src/main/java/com/quicklink/javalinfly/annotation/JavalinFlyInjector.java index 52221fe..7c8f214 100644 --- a/javalinfly-core/src/main/java/com/quicklink/javalinfly/annotation/JavalinFlyInjector.java +++ b/javalinfly-core/src/main/java/com/quicklink/javalinfly/annotation/JavalinFlyInjector.java @@ -1,8 +1,5 @@ package com.quicklink.javalinfly.annotation; - - -import io.javalin.security.RouteRole; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -17,6 +14,7 @@ boolean generateDocumentation() default true; + boolean logs() default false; // Info info() default @Info(); diff --git a/javalinfly-core/src/main/java/com/quicklink/javalinfly/processor/round/JavalinFlyInjectorRound.java b/javalinfly-core/src/main/java/com/quicklink/javalinfly/processor/round/JavalinFlyInjectorRound.java index 4f6e460..9597814 100644 --- a/javalinfly-core/src/main/java/com/quicklink/javalinfly/processor/round/JavalinFlyInjectorRound.java +++ b/javalinfly-core/src/main/java/com/quicklink/javalinfly/processor/round/JavalinFlyInjectorRound.java @@ -83,6 +83,10 @@ protected void run() { javalinFlyInjectorAnn = annotatedElement.getAnnotation(JavalinFlyInjector.class); + if(javalinFlyInjectorAnn.logs()) { + Messager.enable(); + } + } } diff --git a/javalinfly-core/src/main/java/com/quicklink/javalinfly/processor/utils/Messager.java b/javalinfly-core/src/main/java/com/quicklink/javalinfly/processor/utils/Messager.java index 97ed845..a277d05 100644 --- a/javalinfly-core/src/main/java/com/quicklink/javalinfly/processor/utils/Messager.java +++ b/javalinfly-core/src/main/java/com/quicklink/javalinfly/processor/utils/Messager.java @@ -16,8 +16,10 @@ public class Messager { private static File file; - public static void set(javax.annotation.processing.Messager messager) { - Messager.messager = messager; + private static boolean logs = false; + + public static void enable() { + logs = true; file = new File("debug_compiler.txt"); try { @@ -29,6 +31,10 @@ public static void set(javax.annotation.processing.Messager messager) { } } + public static void set(javax.annotation.processing.Messager messager) { + Messager.messager = messager; + } + private static void writeString(@NotNull String prefix, @Nullable Element e, @NotNull String msg, @NotNull Object... args) { try { Files.writeString(file.toPath(), String.format("%s (at %s) - %s", prefix, e, String.format(msg, args)), StandardOpenOption.APPEND); @@ -38,6 +44,9 @@ private static void writeString(@NotNull String prefix, @Nullable Element e, @No } public static void error(@NotNull Element e, @NotNull String msg, @NotNull Object... args) { + if(!logs) { + return; + } writeString("ERROR", e, msg, args); messager.printMessage(Kind.ERROR, String.format(msg, args), e); @@ -46,21 +55,37 @@ public static void error(@NotNull Element e, @NotNull String msg, @NotNull Objec } public static void error(@NotNull String msg, @NotNull Object... args) { + if(!logs) { + return; + } + writeString("WARNING", null, msg, args); messager.printMessage(Kind.ERROR, String.format(msg, args)); } public static void print(@NotNull String msg, @NotNull Object... args) { + if(!logs) { + return; + } + messager.printMessage(Kind.NOTE, String.format(msg, args)); } public static void warning(@NotNull String msg, @NotNull Object... args) { + if(!logs) { + return; + } + writeString("WARNING", null, msg, args); messager.printMessage(Kind.WARNING, String.format(msg, args)); } public static void warning(@NotNull Element e, @NotNull String msg, @NotNull Object... args) { + if(!logs) { + return; + } + messager.printMessage(Kind.WARNING, String.format(msg, args), e); } } diff --git a/javalinfly-example-kotlin/pom.xml b/javalinfly-example-kotlin/pom.xml index da1bc99..9fdb5ea 100644 --- a/javalinfly-example-kotlin/pom.xml +++ b/javalinfly-example-kotlin/pom.xml @@ -6,7 +6,7 @@ com.github.unldenis JavalinFly - 0.1.10b2 + 0.2.0 javalinfly-example-kotlin diff --git a/javalinfly-example/pom.xml b/javalinfly-example/pom.xml index 1d49db8..9d403c2 100644 --- a/javalinfly-example/pom.xml +++ b/javalinfly-example/pom.xml @@ -6,7 +6,7 @@ com.github.unldenis JavalinFly - 0.1.10b2 + 0.2.0 javalinfly-example diff --git a/javalinfly-kotlin/pom.xml b/javalinfly-kotlin/pom.xml index c7754d2..a190a3a 100644 --- a/javalinfly-kotlin/pom.xml +++ b/javalinfly-kotlin/pom.xml @@ -6,7 +6,7 @@ com.github.unldenis JavalinFly - 0.1.10b2 + 0.2.0 javalinfly-kotlin diff --git a/pom.xml b/pom.xml index 4cf40f7..aa50b4c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.unldenis JavalinFly - 0.1.10b2 + 0.2.0 pom