forked from OpenRA/ra2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.ps1
139 lines (130 loc) · 2.63 KB
/
make.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
function FindMSBuild
{
$msBuildVersions = @("4.0")
foreach ($msBuildVersion in $msBuildVersions)
{
$key = "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\{0}" -f $msBuildVersion
$property = Get-ItemProperty $key -ErrorAction SilentlyContinue
if ($property -eq $null -or $property.MSBuildToolsPath -eq $null)
{
continue
}
$path = Join-Path $property.MSBuildToolsPath -ChildPath "MSBuild.exe"
if (Test-Path $path)
{
return $path
}
}
return $null
}
if ($args.Length -eq 0)
{
echo "Command list:"
echo ""
echo " all Builds the mod dll."
echo " dependencies Copies the mod's dependencies into the"
echo " 'OpenRA.Mods.RA2/dependencies' folder."
echo ""
$command = (Read-Host "Enter command").Split(' ', 2)
}
else
{
$command = $args
}
if ($command -eq "all")
{
$msBuild = FindMSBuild
$msBuildArguments = "/t:Rebuild /nr:false"
if ($msBuild -eq $null)
{
echo "Unable to locate an appropriate version of MSBuild."
}
else
{
cd OpenRA.Mods.RA2
$proc = Start-Process $msBuild $msBuildArguments -NoNewWindow -PassThru -Wait
if ($proc.ExitCode -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."
}
else
{
echo "Build succeeded."
}
cd ..
}
}
elseif ($command -eq "dependencies")
{
cd OpenRA.Mods.RA2\dependencies
$targetDir = $PWD
$OpenRADir = Read-Host "Enter the path to your OpenRA install"
if (!(Test-Path $OpenRADir))
{
echo "Given directory does not exist!"
}
else
{
cd $OpenRADir
if (!(Test-Path OpenRA.Game.exe))
{
echo "Unable to find 'OpenRA.Game.exe'!"
echo "You need to build OpenRA first."
}
else
{
cp OpenRA.Game.exe $targetDir
}
if (!(Test-Path mods/common/OpenRA.Mods.Common.dll))
{
echo "Unable to find the 'common' mod (dll)!"
}
else
{
cp mods/common/OpenRA.Mods.Common.dll $targetDir
}
if (!(Test-Path mods/ra/OpenRA.Mods.RA.dll))
{
echo "Unable to find the Red Alert mod (dll)!"
}
else
{
cp mods/ra/OpenRA.Mods.RA.dll $targetDir
}
if (!(Test-Path mods/ts/OpenRA.Mods.TS.dll))
{
echo "Unable to find the Tiberian Sun mod (dll)!"
}
else
{
cp mods/ts/OpenRA.Mods.TS.dll $targetDir
}
if (!(Test-Path Eluant.dll))
{
echo "Unable to find the Eluant dll!"
}
else
{
cp Eluant.dll $targetDir
}
cd $targetDir
cd ../..
echo "Dependencies copied."
}
}
else
{
echo ("Invalid command '{0}'" -f $command)
}
if ($args.Length -eq 0)
{
echo "Press enter to continue."
while ($true)
{
if ([System.Console]::KeyAvailable)
{
break
}
Start-Sleep -Milliseconds 50
}
}