diff --git a/src/tools/bathelpers/README.md b/src/tools/bathelpers/README.md new file mode 100644 index 000000000..ff119cd11 --- /dev/null +++ b/src/tools/bathelpers/README.md @@ -0,0 +1,21 @@ +## Bat Helpers +Collection of .bat files to quickly perform some frequent development tasks. +They allow you to quickly build the project and to move the generated JAR to +the plugins folder of your test server. + +### Setup +1. Copy the files into a new, convenient directory +2. Open setvars.bat with a text editor and add the correct directories +3. Open `cmd` and navigate to your _bathelpers_ folder (`cd C:\path\the\folder`) +4. Type `list_files.bat` (Hint: Type `l` and hit Tab) to see the available tasks + +### Example use case +1. After writing changes, `build_project` to build project +2. `move_plugin` moves the JAR file to the plugin folder +3. `run_server` to start the server with the fresh JAR +4. Problem detected, stop the server +5. Make a small change, use `quick_build` and `move_plugin` to update +6. Verify the change again on the server: `run_server` + +All files start with a different letter, so you can conveniently type the +first letter and then complete with Tab. diff --git a/src/tools/bathelpers/analyze_project.bat b/src/tools/bathelpers/analyze_project.bat new file mode 100644 index 000000000..ec494c75c --- /dev/null +++ b/src/tools/bathelpers/analyze_project.bat @@ -0,0 +1,6 @@ +: Analyze the project with Sonar (requires you install SonarQube) +if "%jarfile%" == "" ( + call setvars.bat +) + +mvn clean verify sonar:sonar -f "%pomfile%" \ No newline at end of file diff --git a/src/tools/bathelpers/build_project.bat b/src/tools/bathelpers/build_project.bat new file mode 100644 index 000000000..01b515ba9 --- /dev/null +++ b/src/tools/bathelpers/build_project.bat @@ -0,0 +1,6 @@ +: Build the project normally +if "%jarfile%" == "" ( + call setvars.bat +) + +mvn clean install -f "%pomfile%" \ No newline at end of file diff --git a/src/tools/bathelpers/list_files.bat b/src/tools/bathelpers/list_files.bat new file mode 100644 index 000000000..f0100fa8c --- /dev/null +++ b/src/tools/bathelpers/list_files.bat @@ -0,0 +1,2 @@ +: List all bat files in the directory +dir /B *.bat \ No newline at end of file diff --git a/src/tools/bathelpers/move_plugin.bat b/src/tools/bathelpers/move_plugin.bat new file mode 100644 index 000000000..a8bec5013 --- /dev/null +++ b/src/tools/bathelpers/move_plugin.bat @@ -0,0 +1,11 @@ +: Moves the AuthMe JAR file to the plugins folder of the test server +: You will have to hit 'Y' to really replace it if it already exists +if "%jarfile%" == "" ( + call setvars.bat +) + +if exist %jarfile% ( + xcopy %jarfile% %plugins% +) else ( + echo Target file not found: '%jarfile%' +) diff --git a/src/tools/bathelpers/quick_build.bat b/src/tools/bathelpers/quick_build.bat new file mode 100644 index 000000000..2010e00af --- /dev/null +++ b/src/tools/bathelpers/quick_build.bat @@ -0,0 +1,6 @@ +: Build quickly without cleaning or testing +if "%jarfile%" == "" ( + call setvars.bat +) + +mvn install -f "%pomfile%" -Dmaven.test.skip \ No newline at end of file diff --git a/src/tools/bathelpers/run_server.bat b/src/tools/bathelpers/run_server.bat new file mode 100644 index 000000000..7ab956fc0 --- /dev/null +++ b/src/tools/bathelpers/run_server.bat @@ -0,0 +1,9 @@ +: Start the Minecraft server +if "%jarfile%" == "" ( + call setvars.bat +) + +cd "%server%" +call java -Xmx1024M -Xms1024M -jar spigot_server.jar +cd "%batdir%" +dir /B *.bat \ No newline at end of file diff --git a/src/tools/bathelpers/setvars.bat b/src/tools/bathelpers/setvars.bat new file mode 100644 index 000000000..463f6080e --- /dev/null +++ b/src/tools/bathelpers/setvars.bat @@ -0,0 +1,14 @@ +: The folder in which these .bat files are located +SET batdir=C:\your\path\AUTHME_DEV\bathelpers\ + +: The location of the generated JAR file +SET jarfile=C:\Users\yourname\IdeaProjects\AuthMeReloaded\target\AuthMe-5.1-SNAPSHOT.jar + +: The location of the pom.xml file of the project +SET pomfile=C:\Users\yourname\IdeaProjects\AuthMeReloaded\pom.xml + +: The folder in which the server is located +SET server=C:\your\path\AUTHME_DEV\spigot-server\ + +: The location of the plugins folder of the Minecraft server +SET plugins=%server%\plugins