forked from SteamWar/SteamWar
Add BauSystem module
Fix ci java version Fix LinkageProcessor
This commit is contained in:
@@ -36,8 +36,11 @@ import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.type.DeclaredType;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.FileObject;
|
||||
import javax.tools.StandardLocation;
|
||||
import java.io.*;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
@@ -70,20 +73,14 @@ public class LinkageProcessor extends AbstractProcessor {
|
||||
@Override
|
||||
public synchronized void init(ProcessingEnvironment processingEnv) {
|
||||
super.init(processingEnv);
|
||||
|
||||
name = new File(System.getProperty("user.dir")).getName().replaceAll("[^a-zA-Z]", "").toLowerCase();
|
||||
|
||||
messager = processingEnv.getMessager();
|
||||
|
||||
className = "LinkageUtils";
|
||||
mainClass();
|
||||
disabledFeatures();
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void mainClass() {
|
||||
File file = new File(System.getProperty("user.dir"));
|
||||
Optional<File> pluginYMLFile = Files.walk(file.toPath())
|
||||
private void mainClass(File projectDir) {
|
||||
Optional<File> pluginYMLFile = Files.walk(projectDir.toPath())
|
||||
.map(Path::toFile)
|
||||
.filter(File::isFile)
|
||||
.filter(f -> f.getName().equals("plugin.yml") || f.getName().equals("bungee.yml"))
|
||||
@@ -123,7 +120,22 @@ public class LinkageProcessor extends AbstractProcessor {
|
||||
if (processed) return false;
|
||||
processed = true;
|
||||
|
||||
Writer writer = processingEnv.getFiler().createSourceFile("de.steamwar." + name + ".linkage.LinkageUtils").openWriter();
|
||||
URI uri = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", ".ignore").toUri();
|
||||
File file = new File(uri.toString().substring(7)).getParentFile();
|
||||
do {
|
||||
if (!file.getName().contains("_") && new File(file, "build.gradle.kts").exists()) {
|
||||
break;
|
||||
}
|
||||
file = file.getParentFile();
|
||||
if (file == null) return false;
|
||||
} while (true);
|
||||
|
||||
name = file.getName().replaceAll("[^a-zA-Z]", "").toLowerCase();
|
||||
mainClass(file);
|
||||
|
||||
FileObject fileObject = processingEnv.getFiler().createSourceFile("de.steamwar." + name + ".linkage.LinkageUtils");
|
||||
|
||||
Writer writer = fileObject.openWriter();
|
||||
BuildPlan buildPlan = new BuildPlan("de.steamwar." + name + ".linkage", className);
|
||||
|
||||
Set<TypeElement> disabledElements = new HashSet<>();
|
||||
@@ -149,6 +161,7 @@ public class LinkageProcessor extends AbstractProcessor {
|
||||
})
|
||||
.peek(typeElement -> System.out.println("Found element: " + typeElement.getQualifiedName().toString()))
|
||||
.collect(Collectors.toSet());
|
||||
System.out.println(elements);
|
||||
|
||||
Map<Set<String>, List<TypeElement>> groupedByChecks = elements.stream()
|
||||
.collect(Collectors.groupingBy(element -> checks(element, buildPlan)));
|
||||
|
||||
Reference in New Issue
Block a user