Class Main

java.lang.Object
tools.DogLogASTParser.Main

public class Main extends Object

DogLogASTParser | A tool for replacing SmartDashboard calls with DogLog calls

The main entry point for DogLogASTParser. It uses an abstract syntax tree (AST) parser called JavaParser to read and modify the java files in the robot code.

SmartDashboard calls of putNumber, putBoolean, and putString are replaced with DogLog.log calls. SmartDashboard.putData remains unchanged for more complex data.

Works with a Github Action workflow (doglog-replacement.yml) to automate the replacement with every push onto the main branch.

To execute, manually run the workflow in Github or push to main. It's not recommended to run this tool locally as the purpose of this tool is to automate the replacement and push to the doglog branch for testing.

  • Constructor Details

    • Main

      public Main()
  • Method Details

    • main

      public static void main(String[] args)

      Entry Point

      Walks through the Java files in the robot code, filtering the tools directory, and invokes the processFile(Path) method for AST parsing.

    • processFile

      public static void processFile(Path filePath)

      Processes individual Java files.

      Walks through the java files in the robot code, excluding the tools directory, and invokes the processFile(Path) method for AST parsing.

      It makes a CompilationUnit for the file, then applies the DogLogRewriter to replace SmartDashboard calls with DogLog calls.

      When DogLogRewriter is done, the modified CompilationUnit is written back to the file path, replacing the original file.

      Parameters:
      filePath - the path of the Java file to be processed