MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.69k stars 1.34k forks source link

IntelliJ TerasologyPC run config requires prior build of game target #5132

Closed jschadewald closed 8 months ago

jschadewald commented 1 year ago

General Info

Not sure whether this is an actual issue or intended behavior. I was following the Contributor Quick Start wiki, and I lost a few hours to troubleshooting why the game would only launch from source inconsistently in IntelliJ. In my reading of the wiki, it appears as though the run configuration is intended to be equivalent to building the 'game' target. However, it also seems reasonable that building the game (i.e. running gradlew game) is a natural prerequisite to executing any run configuration. In addition, a person may want to run the game many separate times on the same build without making code changes.

If running gradlew.bat game is an intentional prerequisite for the IntelliJ run configurations to work, then the wiki could be improved to make required sequential order clearer (numbers or letters versus bullet points). Alternatively, if the Run configuration is intended to be able to execute the game from sources independent of running gradlew.bat game, then the configuration should be updated.

Asides: Relatedly, if the "game" target both builds and runs the game, then is there a target that builds the game without also running it? Where are all of these build targets documented?

What you were trying to do

After running groovyw module init iota and opening the Terasology folder in IntelliJ, I expected the run configuration to run the game from sources.

What actually happened

The build failed.

How to reproduce

  1. Start with no Terasology folder, and be sure to delete any "Recent Project" for the Terasology folder from IntelliJ's history. Also, have no JAVA_HOME environment variable at the system level, but do have it set in your console window.
  2. In a console window a. git clone https://github.com/MovingBlocks/Terasology b. cd into Terasology c. groovyw.bat module init iota
  3. Open IntelliJ, and then Open the Terasology folder in IntelliJ.
  4. Let IntelliJ complete its automated "extract requirements" task.
  5. Ignore the "Gradle build scripts found" prompt.
  6. Run the "TerasologyPC" run configuration.
  7. BUILD FAILS
    \Terasology\engine\src\main\java\org\terasology\engine\network\Server.java:9:31
    java: package org.terasology.protobuf does not exist
    \Terasology\engine\src\main\java\org\terasology\engine\network\Server.java:23:30
    java: package NetData does not exist

Log details

NA

Screenshots

Prompt from step 5: image

Run configuration from Step 6: image

Workaround

Repeat steps 1-4 from above, then: 4.5 Either: a. Run gradlew.bat game from the console; OR b. Click "Load Gradle Project" on the IntelliJ prompt, and run the "game" build target from IntelliJ's gradle tasks widget. 5. The game runs. Exit it. 6. You can now run the TerasologyPC run configuration.

Additional Infos / Context

Feel free to add any other context about the problem here.

Cervator commented 1 year ago

Thank you very much for the detailed report - it is much appreciated :-)

Historically it has been difficult to get at an ideal and lasting IDE setup. Odds are we need another round of activity to shine it up a bit. Anybody interested in Gradle and IDE integration should feel free to dive into this one!

soloturn commented 8 months ago

what is done in the github workflow file builds it without running:

gradle --console=plain clean extractConfig extractNatives distForLauncher testDist

now, after checking out, importing gradle lets it run. if not please reopen.