-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathrelease.ps1
125 lines (103 loc) · 2.98 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
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
# 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
Remove-Item -Path .\shader_analyzer\obj -Recurse
}
function Make-GeneralRelease
{
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem")
$compression = [System.IO.Compression.CompressionLevel]::Optimal
#
# DLLs
#
mkdir "Build"
copy "skyrim64_test.ini" "Build\skyrim64_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
#
# FaceFXWrapper
#
mkdir "Tools"
mkdir "Tools\Audio"
$readMeInfo = @"
#
# NOTICE
#
# While FaceFXWrapper does produce LIP files for the 64-bit CreationKit, it
# has not been validated for correctness. Use at your own risk.
#
# 'FaceFXWrapper.exe' must be in the directory '<SKYRIM_DIR>\Tools\Audio'.
#
# REQUIREMENTS
#
# FonixData.cdf is a proprietary file required for FaceFX. You can obtain FonixData
# from the Fallout 3, Fallout 4, or Skyrim LE CreationKit files. It must be placed
# in '<SKYRIM_DIR>\Data\Sound\Voice\Processing'.
#
"@
$readMeInfo | Out-File -FilePath "Tools\Audio\README.txt" -Encoding ASCII
cd "x86\Release"
copy "FaceFXWrapper.exe" "..\..\Tools\Audio\FaceFXWrapper.exe"
cd ..
cd ..
[System.IO.Compression.ZipFile]::CreateFromDirectory("Tools", "FaceFXWrapper X.zip", $compression, $true) # Include base dir
Remove-Item -Path "Tools" -Recurse
}
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 = "skyrim64_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 skyrim64_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