Class Main
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidAdds a DogLog configuration line to Robot.java's robotInit methodstatic voidEntry Pointstatic voidprocessFile(Path filePath) Processes individual Java files.
-
Constructor Details
-
Main
public Main()
-
-
Method Details
-
main
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
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
CompilationUnitfor the file, then applies theDogLogRewriterto replace SmartDashboard calls with DogLog calls.When
DogLogRewriteris done, the modifiedCompilationUnitis written back to the file path, replacing the original file.- Parameters:
filePath- the path of the Java file to be processed
-
configureDogLog
Adds a DogLog configuration line to Robot.java's robotInit method
-