-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrelease.ps1
92 lines (74 loc) · 2.08 KB
/
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Menu is at the end of the file
function Clean-ProjectDirectory
{
Remove-Item -Path .\Build -Recurse
Remove-Item -Path .\x64 -Recurse
Remove-Item -Path .\x86 -Recurse
}
function Make-GeneralRelease
{
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem")
$compression = [System.IO.Compression.CompressionLevel]::Optimal
#
# DLLs
#
mkdir "Build"
copy "fallout4_test.ini" "Build\fallout4_test.ini"
cd "x64\Release"
copy "winhttp.dll" "..\..\Build\winhttp.dll"
copy "tbb.dll" "..\..\Build\tbb.dll"
copy "tbbmalloc.dll" "..\..\Build\tbbmalloc.dll"
cd ..
cd ..
[System.IO.Compression.ZipFile]::CreateFromDirectory("Build", "CK64Fixes Release X.zip", $compression, $false) # Don't include base dir
}
function Write-VersionFile
{
$versionFileInfo = @"
#pragma once
#define VER_CURRENT_COMMIT_ID "<COMMITID>"
#define VER_CURRENT_DATE "<DATE>"
"@
$commitId = (git rev-parse --short HEAD).ToUpper()
$currDate = (Get-Date)
$versionFileInfo = $versionFileInfo -Replace "<COMMITID>", $commitId
$versionFileInfo = $versionFileInfo -Replace "<DATE>", $currDate
$targetDir = "fallout4_test\src\"
if (!(Test-Path -Path $targetDir)) {
$targetDir = "src\"
}
$versionFileInfo | Out-File -FilePath ($targetDir + "version_info.h") -Encoding ASCII
}
function Build-Project
{
$buildCmd = "/c `"`"%VS2019INSTALLDIR%\Common7\Tools\VsDevCmd.bat`" & msbuild fallout4_test.sln -m -t:Build -p:Configuration=Release;Platform=x64`""
Start-Process "cmd.exe" $buildCmd
}
# Check for params passed on the command line
$input = $args[0]
if ([string]::IsNullOrWhiteSpace($input)) {
Write-Host "==================================="
Write-Host "1: Clean project directory"
Write-Host "2: Build project"
Write-Host "3: Create release build archives"
Write-Host "4: Write version file"
Write-Host "==================================="
$input = Read-Host "Selection"
}
switch ($input)
{
'1' {
cls
Clean-ProjectDirectory
} '2' {
cls
Build-Project
} '3' {
cls
Make-GeneralRelease
} '4' {
cls
Write-VersionFile
}
}
exit