wpilibsuite / allwpilib

Official Repository of WPILibJ and WPILibC
https://wpilib.org/
Other
1.05k stars 612 forks source link

Romi (Java) example code doesn't build #4747

Closed mjhealy closed 1 year ago

mjhealy commented 1 year ago

Describe the bug After generating a new instance of the Romi (Java) example project, I attempted a build, which fails out of the box.

To Reproduce Steps to reproduce the behavior:

  1. Generate a new "RomiReference" example instance, targeting Java.
  2. Kick off a build.

Expected behavior Code should build without issues, since it is an unmodified example.

Actual behavior Errors reported:

Build file 'C:\Users\quasi\Desktop\quasics-frc-sw-2015-pre-light-fix.git\trunk\Experimental\2023\Romi-Beta\build.gradle' line: 38

* What went wrong:
Could not compile build file 'C:\Users\quasi\Desktop\quasics-frc-sw-2015-pre-light-fix.git\trunk\Experimental\2023\Romi-Beta\build.gradle'.
> startup failed:
  build file 'C:\Users\quasi\Desktop\quasics-frc-sw-2015-pre-light-fix.git\trunk\Experimental\2023\Romi-Beta\build.gradle': 38: Unexpected input: '{\r\n    useJUnitPlatform()\r\n    systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'\r\n}\r\n\r\n}' @ line 38, column 1.
     }
     ^

  1 error

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 828ms

 *  The terminal process "cmd.exe /d /c gradlew build   -Dorg.gradle.java.home="C:\Users\Public\wpilib\2023\jdk"" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

mjhealy commented 1 year ago

It looks like there's an extra "}" on line 38 of the generated build.gradle file. Removing that (or commenting it out) appears to resolve the issue.

However, I see a similar failure when trying to start the simulator in order to work with the Romi, so I'm guessing that there's another issue that needs to be fixed.

Error when trying to run the simulator:

[{
    "resource": "/C:/Users/quasi/Desktop/quasics-frc-sw-2015-pre-light-fix.git/trunk/Experimental/2023/RomiJava-Beta/",
    "owner": "_generated_diagnostic_collection_name_#1",
    "code": "0",
    "severity": 8,
    "message": "The supplied phased action failed with an exception.\r\nA problem occurred configuring root project 'RomiJava-Beta'.\r\nCould not open cp_proj generic class cache for build file 'C:\\Users\\quasi\\Desktop\\quasics-frc-sw-2015-pre-light-fix.git\\trunk\\Experimental\\2023\\RomiJava-Beta\\build.gradle' (C:\\Users\\quasi\\.gradle\\caches\\7.5.1\\scripts\\ci17525ng0knzypu1qmb41pno).\r\nCould not compile build file 'C:\\Users\\quasi\\Desktop\\quasics-frc-sw-2015-pre-light-fix.git\\trunk\\Experimental\\2023\\RomiJava-Beta\\build.gradle'.\r\nstartup failed:\r\nbuild file 'C:\\Users\\quasi\\Desktop\\quasics-frc-sw-2015-pre-light-fix.git\\trunk\\Experimental\\2023\\RomiJava-Beta\\build.gradle': 38: Unexpected input: '{\\r\\n    useJUnitPlatform()\\r\\n    systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'\\r\\n}\\r\\n\\r\\n}' @ line 38, column 1.\r\n   }\r\n   ^\r\n1 error",
    "source": "Java",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 1
}]
rzblue commented 1 year ago

Fixed in https://github.com/wpilibsuite/vscode-wpilib/pull/559

rzblue commented 1 year ago

What is the error that occurs when trying to start the simulator?

rzblue commented 1 year ago

Try running "Java: Clean Java Language Server Workspace" in the command palette, that should fix it.

mjhealy commented 1 year ago

That does seem to resolve the issue. (At the least, the simulator starts running; I don't currently have the Romi powered up/connected to verify full functionality.)