Remove Start-Process from make.ps1.

This also removes the hardcoded path
requirement for dotnet.exe, and simplifies
the utility and dotnet detection.

The nr flag is no longer needed for dotnet,
and nologo is added to reduce unnecessary output.

The Release configuration is set for consistency
with the real Makefile.
This commit is contained in:
Paul Chote
2019-05-03 23:19:29 +00:00
committed by reaperrr
parent ac8252531b
commit f0d59391b5

View File

@@ -5,16 +5,15 @@
###############################################################
function All-Command
{
Dependencies-Command
if (!(Test-Path "C:\Program Files\dotnet\dotnet.exe"))
if (CheckForDotnet -eq 1)
{
DotnetNotFound
return
}
$proc = Start-Process "C:\Program Files\dotnet\dotnet.exe" "build /nr:false" -NoNewWindow -PassThru -Wait
if ($proc.ExitCode -ne 0)
Dependencies-Command
dotnet build /p:Configuration=Release /nologo
if ($lastexitcode -ne 0)
{
echo "Build failed. If just the development tools failed to build, try installing Visual Studio. You may also still be able to run the game."
}
@@ -26,12 +25,12 @@ function All-Command
function Clean-Command
{
if (!(Test-Path "C:\Program Files\dotnet\dotnet.exe"))
if (CheckForDotnet -eq 1)
{
DotnetNotFound
return
}
$proc = Start-Process "C:\Program Files\dotnet\dotnet.exe" "clean /nr:false" -NoNewWindow -PassThru -Wait
dotnet clean /nologo
rm *.dll
rm mods/*/*.dll
rm *.config
@@ -105,14 +104,13 @@ function Dependencies-Command
cd ..
echo "Dependencies copied."
if (!(Test-Path "C:\Program Files\dotnet\dotnet.exe"))
if (CheckForDotnet -eq 1)
{
DotnetNotFound
return
}
$proc = Start-Process "C:\Program Files\dotnet\dotnet.exe" "restore /nr:false" -NoNewWindow -PassThru -Wait
if ($proc.ExitCode -ne 0)
dotnet restore /nologo
if ($lastexitcode -ne 0)
{
echo "Project restoration failed."
}
@@ -120,34 +118,29 @@ function Dependencies-Command
function Test-Command
{
if (Test-Path OpenRA.Utility.exe)
if (CheckForUtility -eq 1)
{
echo "Testing mods..."
echo "Testing Tiberian Sun mod MiniYAML..."
./OpenRA.Utility.exe ts --check-yaml
echo "Testing Dune 2000 mod MiniYAML..."
./OpenRA.Utility.exe d2k --check-yaml
echo "Testing Tiberian Dawn mod MiniYAML..."
./OpenRA.Utility.exe cnc --check-yaml
echo "Testing Red Alert mod MiniYAML..."
./OpenRA.Utility.exe ra --check-yaml
}
else
{
UtilityNotFound
return
}
echo "Testing mods..."
echo "Testing Tiberian Sun mod MiniYAML..."
./OpenRA.Utility.exe ts --check-yaml
echo "Testing Dune 2000 mod MiniYAML..."
./OpenRA.Utility.exe d2k --check-yaml
echo "Testing Tiberian Dawn mod MiniYAML..."
./OpenRA.Utility.exe cnc --check-yaml
echo "Testing Red Alert mod MiniYAML..."
./OpenRA.Utility.exe ra --check-yaml
}
function Check-Command {
if (Test-Path OpenRA.Utility.exe)
function Check-Command
{
if (CheckForUtility -eq 0)
{
echo "Checking for explicit interface violations..."
./OpenRA.Utility.exe all --check-explicit-interfaces
}
else
{
UtilityNotFound
}
if (Test-Path OpenRA.StyleCheck.exe)
{
@@ -194,29 +187,39 @@ function Check-Scripts-Command
}
function Docs-Command
{
if (CheckForUtility -eq 1)
{
return
}
./make.ps1 version
./OpenRA.Utility.exe all --docs | Out-File -Encoding "UTF8" DOCUMENTATION.md
./OpenRA.Utility.exe all --weapon-docs | Out-File -Encoding "UTF8" WEAPONS.md
./OpenRA.Utility.exe all --lua-docs | Out-File -Encoding "UTF8" Lua-API.md
./OpenRA.Utility.exe all --settings-docs | Out-File -Encoding "UTF8" Settings.md
}
function CheckForUtility
{
if (Test-Path OpenRA.Utility.exe)
{
./make.ps1 version
./OpenRA.Utility.exe all --docs | Out-File -Encoding "UTF8" DOCUMENTATION.md
./OpenRA.Utility.exe all --weapon-docs | Out-File -Encoding "UTF8" WEAPONS.md
./OpenRA.Utility.exe all --lua-docs | Out-File -Encoding "UTF8" Lua-API.md
./OpenRA.Utility.exe all --settings-docs | Out-File -Encoding "UTF8" Settings.md
return 0
}
else
{
UtilityNotFound
}
}
function UtilityNotFound
{
echo "OpenRA.Utility.exe could not be found. Build the project first using the `"all`" command."
return 1
}
function DotnetNotFound
function CheckForDotnet
{
echo "The 'dotnet' tool is required to compile OpenRA. Please install the .NET Core SDK or Visual studio and try again."
if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -eq $null)
{
echo "The 'dotnet' tool is required to compile OpenRA. Please install the .NET Core SDK or Visual studio and try again."
return 1
}
return 0
}
function WaitForInput