Add test scripts folder

This commit is contained in:
James Seibel
2024-09-10 06:52:21 -05:00
parent 97421feb33
commit a1ef3466ad
4 changed files with 109 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
# Usage: .\verifyall.ps1 [forge|fabric|whatever to put before ":classes"]
param (
[string]$prefix
)
# Clear the screen
Clear-Host
# Define an array to hold completed builds with color information
$completedBuilds = @()
# Get all version properties files
$versionFiles = Get-ChildItem -Path "./versionProperties/" -Filter "*.properties"
foreach ($versionFile in $versionFiles) {
$version = [System.IO.Path]::GetFileNameWithoutExtension($versionFile.Name)
# Run the gradle command
$gradleCommand = ".\gradlew $($prefix)classes -PmcVer=$version"
$process = Start-Process -FilePath "cmd.exe" -ArgumentList "/c $gradleCommand" -NoNewWindow -PassThru -Wait
# Determine the result color
if ($process.ExitCode -eq 0) {
$color = "Green"
} else {
$color = "Red"
}
# Print the result with formatting
$versionLength = $version.Length
$topChars = ("^" * $versionLength)
$bottomChars = ("=" * $versionLength)
Write-Host "# $topChars" -ForegroundColor $color
Write-Host "# $version" -ForegroundColor $color
Write-Host "# $bottomChars" -ForegroundColor $color
Write-Host
# Add result to completed builds with color
$completedBuilds += @{ Version = $version; Color = $color }
}
# Run clean and classes gradle tasks
Start-Process -FilePath "cmd.exe" -ArgumentList "/c .\gradlew clean" -NoNewWindow -Wait
Start-Process -FilePath "cmd.exe" -ArgumentList "/c .\gradlew classes" -NoNewWindow -Wait
# Print build results
Write-Host
Write-Host "Build results:"
foreach ($build in $completedBuilds) {
Write-Host $build.Version -ForegroundColor $build.Color -NoNewline
Write-Host " " -NoNewline # Add a space between versions
}
Write-Host # End the line after all versions are printed
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Usage: ./verifyall.sh [forge|fabric|whatever to put before ":classes"]
if [ -n "$1" ]; then
prefix="$1:"
fi
clear
trap "echo; exit" INT
declare -a completed_builds
for version in $(ls ./versionProperties/); do
version=${version%".properties"}
result=""
if ./gradlew "$prefix"classes -PmcVer=$version; then
result+="\e[1;32m"
echo -ne "\e[1;32m"
else
result+="\e[1;31m"
echo -ne "\e[1;31m"
fi
result+=$version
result+="\e[0m"
version_length=${#version}
top_chars=$(printf '^%.0s' $(seq 1 $version_length))
bottom_chars=$(printf '=%.0s' $(seq 1 $version_length))
echo "# $top_chars"
echo "# $version"
echo "# $bottom_chars"
echo -e "\e[0m"
completed_builds+=($result)
done
./gradlew clean
./gradlew classes
echo
echo -e "\e[1mBuild results:\e[0m"
echo -e "${completed_builds[*]}"
+4
View File
@@ -0,0 +1,4 @@
Remove-Item -Recurse -Force "run/client/Distant_Horizons_server_data"
Get-ChildItem -Path "run/server" -Recurse -Filter "Distant_Horizons" | ForEach-Object { Remove-Item -Recurse -Force $_.FullName }
Get-ChildItem -Path "run/server" -Recurse -Filter "DistantHorizons.sqlite" | ForEach-Object { Remove-Item -Force $_.FullName }
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
rm -rf run/client/Distant_Horizons_server_data
rm -rf $(find run/server -name "Distant_Horizons")
rm -rf $(find run/server -name "DistantHorizons.sqlite")