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 function All-Command
{ {
Dependencies-Command if (CheckForDotnet -eq 1)
if (!(Test-Path "C:\Program Files\dotnet\dotnet.exe"))
{ {
DotnetNotFound
return return
} }
$proc = Start-Process "C:\Program Files\dotnet\dotnet.exe" "build /nr:false" -NoNewWindow -PassThru -Wait Dependencies-Command
if ($proc.ExitCode -ne 0)
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." 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 function Clean-Command
{ {
if (!(Test-Path "C:\Program Files\dotnet\dotnet.exe")) if (CheckForDotnet -eq 1)
{ {
DotnetNotFound
return return
} }
$proc = Start-Process "C:\Program Files\dotnet\dotnet.exe" "clean /nr:false" -NoNewWindow -PassThru -Wait
dotnet clean /nologo
rm *.dll rm *.dll
rm mods/*/*.dll rm mods/*/*.dll
rm *.config rm *.config
@@ -105,14 +104,13 @@ function Dependencies-Command
cd .. cd ..
echo "Dependencies copied." echo "Dependencies copied."
if (!(Test-Path "C:\Program Files\dotnet\dotnet.exe")) if (CheckForDotnet -eq 1)
{ {
DotnetNotFound
return return
} }
$proc = Start-Process "C:\Program Files\dotnet\dotnet.exe" "restore /nr:false" -NoNewWindow -PassThru -Wait dotnet restore /nologo
if ($proc.ExitCode -ne 0) if ($lastexitcode -ne 0)
{ {
echo "Project restoration failed." echo "Project restoration failed."
} }
@@ -120,8 +118,11 @@ function Dependencies-Command
function Test-Command function Test-Command
{ {
if (Test-Path OpenRA.Utility.exe) if (CheckForUtility -eq 1)
{ {
return
}
echo "Testing mods..." echo "Testing mods..."
echo "Testing Tiberian Sun mod MiniYAML..." echo "Testing Tiberian Sun mod MiniYAML..."
./OpenRA.Utility.exe ts --check-yaml ./OpenRA.Utility.exe ts --check-yaml
@@ -132,22 +133,14 @@ function Test-Command
echo "Testing Red Alert mod MiniYAML..." echo "Testing Red Alert mod MiniYAML..."
./OpenRA.Utility.exe ra --check-yaml ./OpenRA.Utility.exe ra --check-yaml
} }
else
{
UtilityNotFound
}
}
function Check-Command { function Check-Command
if (Test-Path OpenRA.Utility.exe) {
if (CheckForUtility -eq 0)
{ {
echo "Checking for explicit interface violations..." echo "Checking for explicit interface violations..."
./OpenRA.Utility.exe all --check-explicit-interfaces ./OpenRA.Utility.exe all --check-explicit-interfaces
} }
else
{
UtilityNotFound
}
if (Test-Path OpenRA.StyleCheck.exe) if (Test-Path OpenRA.StyleCheck.exe)
{ {
@@ -195,28 +188,38 @@ function Check-Scripts-Command
function Docs-Command function Docs-Command
{ {
if (Test-Path OpenRA.Utility.exe) if (CheckForUtility -eq 1)
{ {
return
}
./make.ps1 version ./make.ps1 version
./OpenRA.Utility.exe all --docs | Out-File -Encoding "UTF8" DOCUMENTATION.md ./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 --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 --lua-docs | Out-File -Encoding "UTF8" Lua-API.md
./OpenRA.Utility.exe all --settings-docs | Out-File -Encoding "UTF8" Settings.md ./OpenRA.Utility.exe all --settings-docs | Out-File -Encoding "UTF8" Settings.md
} }
else
function CheckForUtility
{ {
UtilityNotFound if (Test-Path OpenRA.Utility.exe)
} {
return 0
} }
function UtilityNotFound
{
echo "OpenRA.Utility.exe could not be found. Build the project first using the `"all`" command." echo "OpenRA.Utility.exe could not be found. Build the project first using the `"all`" command."
return 1
} }
function DotnetNotFound function CheckForDotnet
{
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." 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 function WaitForInput