Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle maps into build artifacts #104

Merged
merged 3 commits into from
Nov 4, 2023
Merged

Conversation

StenAL
Copy link

@StenAL StenAL commented Sep 30, 2023

Description

With this change, the server no longer needs to be deployed alongside a
tracks directory and the symlink to the tracks directory can also be
removed, making the server work without any changes on Windows.

Tracks are now bundled into the jar file generated by mvn package,
however the location where tracks are searched for can still be
overridden with a CLI flag.

This required changing the way FileSystemStatsManager and
FileSystemTrackManager load tracks by making it possible to configure
which kind of file system they should use as jar resources can only be
read as files when using a bespoke FileSystem.

Also a bunch of duplicate unused assets have been removed. See individual commits for more details.

Testing

  • ran Maven's exec:java task from IntelliJ, which successfully loaded maps from the resources path
  • ran jar using CLI (java -jar server/target/server-2.1.2.0-BETA.jar), which successfully loaded bundled maps
  • ran jar using CLI with --tracks-dir argument (java -jar server/target/server-2.1.2.0-BETA.jar --tracks-dir server/src/main/resources/tracks), which successfully loaded maps from my filesystem

@PhilippvK
Copy link
Owner

@pehala FIY

@StenAL
Copy link
Author

StenAL commented Oct 14, 2023

Changes since last review:

  • clarified how to use custom tracks in README
  • fixed CI
    • removed the assembly-tracks build step in the shared project which created a zip file of all tracks. This is not needed anymore because tracks are now bundled into the jar file.
    • removed the Upload Tracks step from CI

Verified these are the same by running
```sh
diff -r assets/res/Shared/picture/ client/src/main/resources/picture/shared/ || echo "Differences found!"
diff -r assets/res/Shared/sound client/src/main/resources/sound/shared/ || echo "Differences found!"
diff -r assets/res/AGolf/picture/ client/src/main/resources/picture/agolf/ || echo "Differences found!"
diff -r assets/res/AGolf/picture/ client/src/main/resources/picture/agolf/ || echo "Differences found!"
diff -r assets/res/l10n/ client/src/main/resources/l10n/  || echo "Differences found!"
diff assets/res/appletloader_playforia.gif client/src/main/resources/appletloader_playforia.gif || echo "Differences found!"
diff -r assets/res/Editor/ editor/src/main/resources/ || echo "Differences found"
```

There was an actual difference in Agolf/picture/special.gif, where the
assets directory contains some debug drawings on the picture but this is
unused and can be removed.

AGolf2.xml was also missing from the client resources so I've added it
there. I'm not sure if it's actually used for anything at the momement
but better safe than sorry.
This way, the jar and configuration can be stored in separate
file hierarchies. This is useful when you have multiple track
directories, e.g. a small one with a selection of tracks and a larger
one.

It's also useful for starting a server with ssh without
having to pollute your server's home directory (`ssh user@host java
-jar server.jar --tracks-dir=/my/path/tracks`)
With this change, the server no longer needs to be deployed alongside a
tracks directory and the symlink to the tracks directory can also be
removed, making the server work by default on Windows on IDEs.

Tracks are now bundled into the jar file generated by `mvn package`,
however the location where tracks are searched for can still be
overridden with a CLI flag.

This required changing the way FileSystemStatsManager and
FileSystemTrackManager load tracks by making it possible to configure
which kind of file system they should use as jar resources can only be
read as files when using a custom FileSystem.
@PhilippvK
Copy link
Owner

Look fine for me. If I receive no complaints until Monday this gets merged!

@PhilippvK PhilippvK merged commit 448a991 into PhilippvK:master Nov 4, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants