script: added and updated scripts for more fanciness

This commit is contained in:
Yannik Bretschneider 2021-07-20 23:48:50 +02:00
parent 48a378e75c
commit c1e7a8614a
3 changed files with 73 additions and 18 deletions

View File

@ -1,23 +1,54 @@
Write-Host "Trying to start server locally"
if ($Args[0] -eq "-r") { #if ($Args[0] -eq "-r") {
Write-Host "Rebuilding application" # Write-Host "Rebuilding application"
$build = $true # $build = $true
} else { #} else {
Write-Host "No rebuild flag (-r) given. Starting directly..." # Write-Host "No rebuild flag (-r) given. Starting directly..."
$build = $false # $build = $false
#}
param (
[string]$port = 1218,
[string]$path = "Server/build/libs/Server.jar",
[switch]$r = $false,
[switch]$h = $false
)
if ($h) {
Write-Host "Script to start the server on the local machine.";
Write-Host " Flags: -h (help), -r (rebuild from source using Gradle),";
Write-Host " -path [somePath] (start jarfile at non-standard location)";
Write-Host " -port [somePortNumber] (start server at the given port)";
exit;
} }
if ($build) { Write-Host "Starting server locally"
if ($r) {
Write-Host "Rebuild flag (-r) given. Rebuilding from source...";
try { try {
.\gradlew Server:jar .\gradlew Server:jar;
} catch { } catch {
Write-Host "Gradle doesn't seem to be installed." Write-Host "There was a problem with the gradle build. Trying to start server anyways...";
} }
} }
# Check for the server directory
if (-not(Test-Path $path)) {
Write-Host "The jarfile that was requested doesn't seem to exist. Terminating...";
exit;
}
try { try {
java -jar Server/build/libs/Server.jar -c .\configs\marvelheros.character.json -m.\configs\matchconfig_1.game.json -s .\configs\asgard.scenario.json -v Write-Host "Starting server at location $($path) on port $($port)"
java -jar Server/build/libs/Server.jar `
-c .\configs\marvelheros.character.json `
-m.\configs\matchconfig_1.game.json `
-s .\configs\asgard.scenario.json `
-v `
-p $port
} catch { } catch {
Write-Host "Couldn't execute. Is Java installed?" Write-Host "Couldn't execute. Is Java installed?"
} }

View File

@ -1,4 +1,5 @@
@echo off @echo off
echo WARN: This file is DEPRECATED. Please use the powershell script (updateSubmodule.ps1) instead!
git submodule update --init git submodule update --init
cd .\Gamelib cd .\Gamelib
git fetch git fetch

View File

@ -1,6 +1,29 @@
git submodule update --init param (
cd .\Gamelib [switch]$md = $false
git fetch )
git checkout gamelib
git pull Write-Host "Checking for submodule path..."
cd .. if (-not(Test-Path Gamelib)) {
Write-Host "Path Gamelib doesn't exist.";
if (-not($md)) {
Write-Host "Exiting.";
Write-Host "If you want to automatically create the subdirectory,";
Write-Host "please pass the flag -md";
exit;
}
New-Item -Path Gamelib -Type Directory;
}
Write-Host "Updating submodule..."
try {
git submodule update --init;
Set-Location Gamelib;
git fetch;
git status;
git checkout gamelib;
git pull;
Set-Location ..;
Write-Host "Update done.";
} catch {
Write-Host "There's been an error. Is Git installed?";
}