From de5babfa946a265a4c6b1fb2da495222d7280488 Mon Sep 17 00:00:00 2001 From: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:32:02 -0700 Subject: [PATCH] AP Eclipse compatability Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> --- .gitignore | 4 ++++ gradle.properties | 2 +- src/main/java/io/wispforest/owo/config/ConfigAP.java | 12 +++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e6ffd630..e7f21e75 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,7 @@ run/ # generated sources /src/*/generated/ +bin/ + +# Eclipse +.settings/ \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 04fe17a9..dc9da9a7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ minecraft_version=1.20.2 yarn_mappings=1.20.2+build.1 loader_version=0.14.22 # Mod Properties -mod_version=0.11.3 +mod_version=0.11.4 maven_group=io.wispforest archives_base_name=owo-lib # Dependencies diff --git a/src/main/java/io/wispforest/owo/config/ConfigAP.java b/src/main/java/io/wispforest/owo/config/ConfigAP.java index 9bd6f991..f89fae29 100644 --- a/src/main/java/io/wispforest/owo/config/ConfigAP.java +++ b/src/main/java/io/wispforest/owo/config/ConfigAP.java @@ -123,7 +123,9 @@ public boolean process(Set annotations, RoundEnvironment var wrapperName = annotated.getAnnotation(Config.class).wrapperName(); try { - var file = this.processingEnv.getFiler().createSourceFile(wrapperName); + String packageName = getPackageName(className); + String fqWrapperName = packageName + "." + wrapperName; + var file = this.processingEnv.getFiler().createSourceFile(fqWrapperName); try (var writer = new PrintWriter(file.openWriter())) { writer.println(makeWrapper(wrapperName, className, this.collectFields(Option.Key.ROOT, clazz, clazz.getAnnotation(Config.class).defaultHook()))); } @@ -356,4 +358,12 @@ public char charAt(int index) { return this.builder.toString(); } } + + private String getPackageName(String fqn) { + int lastDotIndex = fqn.lastIndexOf('.'); + if (lastDotIndex == -1) { + return ""; + } + return fqn.substring(0, lastDotIndex); + } }