mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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:
committed by
Peter Johnson
parent
76b26c2df5
commit
80134164a4
22
myRobot/src/main/java/Main.java
Normal file
22
myRobot/src/main/java/Main.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user