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,34 +118,29 @@ function Dependencies-Command
function Test-Command function Test-Command
{ {
if (Test-Path OpenRA.Utility.exe) if (CheckForUtility -eq 1)
{ {
echo "Testing mods..." return
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
} }
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 { 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)
{ {
@@ -194,29 +187,39 @@ function Check-Scripts-Command
} }
function Docs-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) if (Test-Path OpenRA.Utility.exe)
{ {
./make.ps1 version return 0
./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
} }
else
{
UtilityNotFound
}
}
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
{ {
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 function WaitForInput