Move Java main function from library to user code (#1148)

It is much more reliable than the old approach, as it no longer depends on a magic string
in a manifest file, and if the user changes their main class, or makes it not import from
something RobotBase, it will fail to compile instead of failing at runtime.

With requiring an importer, we should be able to automate this in the importer.
This commit is contained in:
Thad House
2018-07-18 22:01:19 -07:00
committed by Peter Johnson
parent 76b26c2df5
commit 80134164a4
25 changed files with 621 additions and 49 deletions

View File

@@ -0,0 +1,22 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
import edu.wpi.first.wpilibj.RobotBase;
public final class Main {
private Main() {
}
/**
* Main initialization function. Do not perform any initialization here.
*
* <p>If you change your main robot class, change the parameter type.
*/
public static void main(String... args) {
RobotBase.startRobot(MyRobot::new);
}
}