low priority queue, enums as low prio
All checks were successful
studiorailgun/highlevel-netcode-gen/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-10 19:58:10 -04:00
parent 1bb9cb1b35
commit 852251ce01
9 changed files with 21 additions and 15 deletions

View File

@ -29,7 +29,7 @@ public class Main {
public static boolean LOG = true; public static boolean LOG = true;
//controls whether files are actually written to disk or not //controls whether files are actually written to disk or not
public static boolean WRITE_TO_DISK = true; public static boolean WRITE_TO_DISK = false;
//hard-coded white list files to always parse //hard-coded white list files to always parse
static final String[] ALWAYS_PARSED_CLASSES = new String[]{ static final String[] ALWAYS_PARSED_CLASSES = new String[]{
@ -82,6 +82,7 @@ public class Main {
*/ */
static List<TargetFile> getFilesToModify(String topLevelFolderPath){ static List<TargetFile> getFilesToModify(String topLevelFolderPath){
List<TargetFile> rVal = new LinkedList<TargetFile>(); List<TargetFile> rVal = new LinkedList<TargetFile>();
List<TargetFile> lowPriority = new LinkedList<TargetFile>();
File topLevelFolder = new File(topLevelFolderPath); File topLevelFolder = new File(topLevelFolderPath);
List<File> fileQueue = new LinkedList<File>(); List<File> fileQueue = new LinkedList<File>();
List<File> fileQueueOpenSet = new LinkedList<File>(); List<File> fileQueueOpenSet = new LinkedList<File>();
@ -98,10 +99,14 @@ public class Main {
String content = ""; String content = "";
try { try {
content = Files.readString(currentFile.toPath()); content = Files.readString(currentFile.toPath());
if( if(content.contains("@SynchronizedBehaviorTree")){
content.contains("@SynchronizedBehaviorTree") || //get relative path
isHardCodedAlwaysParse(currentFile.getName()) Path relativePath = topLevelFolder.toPath().relativize(currentFile.toPath());
){ String relativePathString = "src/main/java/electrosphere/" + relativePath.toString();
//parse
JavaClassSource source = parseJavaFile(content);
lowPriority.add(new TargetFile(currentFile.getAbsolutePath(), relativePathString, content, currentFile.getName(), source));
} else if(isHardCodedAlwaysParse(currentFile.getName())){
//get relative path //get relative path
Path relativePath = topLevelFolder.toPath().relativize(currentFile.toPath()); Path relativePath = topLevelFolder.toPath().relativize(currentFile.toPath());
String relativePathString = "src/main/java/electrosphere/" + relativePath.toString(); String relativePathString = "src/main/java/electrosphere/" + relativePath.toString();
@ -126,6 +131,7 @@ public class Main {
fileQueue.remove(currentClosedFile); fileQueue.remove(currentClosedFile);
} }
} }
rVal.addAll(lowPriority);
return rVal; return rVal;
} }

View File

@ -44,7 +44,7 @@ public class ClientAttach implements VirtualMethod {
@Override @Override
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
List<String> rVal = Arrays.asList(new String[]{ List<String> rVal = Arrays.asList(new String[]{
"electrosphere.net.synchronization.BehaviorTreeIdEnums", "electrosphere.net.synchronization.enums.BehaviorTreeIdEnums",
}); });
return rVal; return rVal;
} }

View File

@ -44,8 +44,8 @@ public class ClientInterrupt implements VirtualMethod {
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
List<String> rVal = Arrays.asList(new String[]{ List<String> rVal = Arrays.asList(new String[]{
"electrosphere.net.parser.net.message.SynchronizationMessage", "electrosphere.net.parser.net.message.SynchronizationMessage",
"electrosphere.net.synchronization.BehaviorTreeIdEnums", "electrosphere.net.synchronization.enums.BehaviorTreeIdEnums",
"electrosphere.net.synchronization.ServerSynchronizationManager", "electrosphere.net.synchronization.server.ServerSynchronizationManager",
}); });
return rVal; return rVal;
} }

View File

@ -44,8 +44,8 @@ public class ClientStart implements VirtualMethod {
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
List<String> rVal = Arrays.asList(new String[]{ List<String> rVal = Arrays.asList(new String[]{
"electrosphere.net.parser.net.message.SynchronizationMessage", "electrosphere.net.parser.net.message.SynchronizationMessage",
"electrosphere.net.synchronization.BehaviorTreeIdEnums", "electrosphere.net.synchronization.enums.BehaviorTreeIdEnums",
"electrosphere.net.synchronization.ServerSynchronizationManager", "electrosphere.net.synchronization.server.ServerSynchronizationManager",
}); });
return rVal; return rVal;
} }

View File

@ -45,7 +45,7 @@ public class ServerAttach implements VirtualMethod {
public List<String> getImports(ProjectStructure projectStructure) { public List<String> getImports(ProjectStructure projectStructure) {
List<String> rVal = Arrays.asList(new String[]{ List<String> rVal = Arrays.asList(new String[]{
"electrosphere.server.datacell.utils.ServerBehaviorTreeUtils", "electrosphere.server.datacell.utils.ServerBehaviorTreeUtils",
"electrosphere.net.synchronization.BehaviorTreeIdEnums", "electrosphere.net.synchronization.enums.BehaviorTreeIdEnums",
}); });
return rVal; return rVal;
} }

View File

@ -58,7 +58,7 @@ public class ServerFieldSetter implements VirtualMethod {
List<String> rVal = Arrays.asList(new String[]{ List<String> rVal = Arrays.asList(new String[]{
"electrosphere.net.parser.net.message.SynchronizationMessage", "electrosphere.net.parser.net.message.SynchronizationMessage",
"electrosphere.server.datacell.utils.DataCellSearchUtils", "electrosphere.server.datacell.utils.DataCellSearchUtils",
"electrosphere.net.synchronization.FieldIdEnums", "electrosphere.net.synchronization.enums.FieldIdEnums",
}); });
return rVal; return rVal;
} }

View File

@ -23,7 +23,7 @@ public class BTreeIdEnum extends VirtualClass {
super( super(
new TargetFile( new TargetFile(
null, null,
"src/main/java/electrosphere/net/synchronization/BehaviorTreeIdEnums.java", "src/main/java/electrosphere/net/synchronization/enums/BehaviorTreeIdEnums.java",
"", "",
"BehaviorTreeIdEnums", "BehaviorTreeIdEnums",
null null

View File

@ -23,7 +23,7 @@ public class FieldIdEnum extends VirtualClass {
super( super(
new TargetFile( new TargetFile(
null, null,
"src/main/java/electrosphere/net/synchronization/FieldIdEnums.java", "src/main/java/electrosphere/net/synchronization/enums/FieldIdEnums.java",
"", "",
"FieldIdEnums", "FieldIdEnums",
null null

View File

@ -95,7 +95,7 @@ public class BTreeParser {
// ADD IMPORTS HERE // ADD IMPORTS HERE
// //
// //
rVal.addImport("electrosphere.net.synchronization.BehaviorTreeIdEnums"); rVal.addImport("electrosphere.net.synchronization.enums.BehaviorTreeIdEnums");
} }
// //