-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
buildEOPDev_release.ps1
77 lines (56 loc) · 3.93 KB
/
buildEOPDev_release.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
# .\buildEOPDev_release.ps1 -modFolder "E:\Steam\steamapps\common\Medieval II Total War\mods\Tsardoms-2.2"
param(
$modFolder
)
# BUILD EOP Script
$currentLoc=(get-location).path
function CopyFilesToFolder ($fromFolder, $toFolder) {
Write-Host "`n`nCopying all files from '$fromFolder' to '$toFolder' ... `n" -ForegroundColor Yellow
$childItems = Get-ChildItem $fromFolder
$childItems | ForEach-Object {
Copy-Item -Path $_.FullName -Destination $toFolder -Recurse -Force
}
}
Write-Host "`n`n======== 0) Pre Cleanup ========`n" -ForegroundColor Magenta
Set-Location -Path $currentLoc
Remove-item ./logs -recurse -erroraction 'silentlycontinue'
new-item ./logs -itemtype directory -erroraction 'silentlycontinue'
# 1) Build M2TWEOP-library
Write-Host "`n`n======== 1) Build M2TWEOP-library ========`n" -ForegroundColor Magenta
msbuild "M2TWEOP Code\M2TWEOP library.sln"/p:Configuration=Release /p:Platform=x86 /t:"M2TWEOP library" /fileLogger /fileLoggerParameters:LogFile=logs\library.log /NoWarn:ALL -m
if ($LASTEXITCODE -ne 0) { Write-Host "`n`n!!! Failure detected. Stopping the build process. !!!" -ForegroundColor DarkRed ; exit $LASTEXITCODE }
msbuild "M2TWEOP Code\M2TWEOP library.sln"/p:Configuration=Release /p:Platform=x86 /t:"M2TWEOP GUI" /fileLogger /fileLoggerParameters:LogFile=logs\gui.log /NoWarn:ALL -m
if ($LASTEXITCODE -ne 0) { Write-Host "`n`n!!! Failure detected. Stopping the build process. !!!" -ForegroundColor DarkRed ; exit $LASTEXITCODE }
msbuild "M2TWEOP Code\M2TWEOP library.sln"/p:Configuration=Release /p:Platform=x86 /t:"d3d9" /fileLogger /fileLoggerParameters:LogFile=logs\d3d9.log /NoWarn:ALL -m
if ($LASTEXITCODE -ne 0) { Write-Host "`n`n!!! Failure detected. Stopping the build process. !!!" -ForegroundColor DarkRed ; exit $LASTEXITCODE }
Write-Host "`n`n======== Success! ========`n" -ForegroundColor Green
# 3) Build Documentation
Write-Host "`n`n======== 3) Build M2TWEOP-Documentation ========`n" -ForegroundColor Magenta
cd "documentationGenerator"
&".\generateDocs.ps1" -Wait -NoNewWindow | Write-Verbose
# 4) Copy built files
Write-Host "`n`n======== 4) Copy all created files ========`n" -ForegroundColor Magenta
Set-Location -Path $currentLoc
Remove-item ./M2TWEOPGenerated -recurse -erroraction 'silentlycontinue'
new-item ./M2TWEOPGenerated -itemtype directory -erroraction 'silentlycontinue'
Copy-Item -Path "M2TWEOP DataFiles\*" -Destination "./M2TWEOPGenerated" -recurse
# Remove scripts and config we don't need
Remove-Item -Path "./M2TWEOPGenerated/eopData/eopScripts/luaPluginScript.lua" -Force
Remove-Item -Path "./M2TWEOPGenerated/eopData/eopScripts/redist" -Force -Recurse -erroraction 'silentlycontinue'
Remove-Item -Path "./M2TWEOPGenerated/eopData/eopScripts/helpers" -Force -Recurse -erroraction 'silentlycontinue'
Remove-Item -Path "./M2TWEOPGenerated/eopData/config" -recurse -erroraction 'silentlycontinue' -Force
Remove-Item -Path "documentationGenerator\EOPDocs\build\html\.buildinfo" -recurse -erroraction 'silentlycontinue' -Force
Remove-Item -Path "./.vs" -recurse -erroraction 'silentlycontinue' -Force
Get-ChildItem -Path "documentationGenerator\EOPDocs\build\html\*" -erroraction 'continue'
CopyFilesToFolder "documentationGenerator\EOPDocs\build\html" "./M2TWEOPGenerated/eopData/documentation"
Copy-Item -Path "M2TWEOP Code\Release\d3d9.dll" -Destination "./M2TWEOPGenerated"
Copy-Item -Path "M2TWEOP Code\Release\M2TWEOP GUI.exe" -Destination "./M2TWEOPGenerated"
Rename-Item -Path "./M2TWEOPGenerated/M2TWEOP GUI.exe" -NewName "M2TWEOP_GUI.exe"
Copy-Item -Path "M2TWEOP Code\Release\M2TWEOPLibrary.dll" -Destination "./M2TWEOPGenerated"
Copy-Item -Path "M2TWEOP Code\Release\M2TWEOPLibrary.pdb" -Destination "./M2TWEOPGenerated"
if ($modFolder) {
Write-Host "`n`n======== 6) Copy to mod folder ========`n" -ForegroundColor Magenta
CopyFilesToFolder "./M2TWEOPGenerated" $modFolder
}
# 7) Done
Write-Host "`n`n======== Success! EOP Built Successfully! ========`n" -ForegroundColor Green