forked from thewakingsands/OverlayPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
76 lines (55 loc) · 2.32 KB
/
build.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
param (
[switch]$ci = $false
)
try {
# This assumes Visual Studio 2022 is installed in C:. You might have to change this depending on your system.
# $DEFAULT_VS_PATH = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
# $VS_PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
$VS_PATH = .\vswhere.exe -prerelease -latest -property installationPath
if ( -not (Test-Path "$VS_PATH")) {
echo "Error: VS_PATH isn't set correctly! Update the variable in build.ps1 for your system."
echo "... or implement it properly with vswhere and submit a PR. (Please)"
exit 1
}
$ENV:PATH = "$VS_PATH\MSBuild\Current\Bin;${ENV:PATH}";
if (Test-Path "C:\Program Files\7-Zip\7z.exe") {
$ENV:PATH = "C:\Program Files\7-Zip;${ENV:PATH}";
}
if ($ENV:CI -eq "true" -and $ENV:GITHUB_RUN_ID -ne $null) {
echo "==> Running as a GitHub Action, pre-running clientstructs scripts"
.\tools\strip-clientstructs.ps1
}
if ($ci) {
echo "==> Continuous integration flag set. Building Debug..."
dotnet publish -c debug
if (-not $?) { exit 1 }
}
echo "==> Building..."
dotnet publish -c release
if (-not $?) { exit 1 }
echo "==> Building archive..."
cd out\Release
if (Test-Path OverlayPlugin) { rm -Recurse OverlayPlugin }
mkdir OverlayPlugin\libs
cp @("OverlayPlugin.dll", "OverlayPlugin.dll.config", "README.md", "LICENSE.txt") OverlayPlugin
cp -Recurse libs\resources OverlayPlugin
cp -Recurse libs\*.dll OverlayPlugin\libs
del OverlayPlugin\libs\CefSharp.*
# Translations
cp -Recurse @("de-DE", "fr-FR", "ja-JP", "ko-KR", "zh-CN") OverlayPlugin
cp -Recurse @("libs\de-DE", "libs\fr-FR", "libs\ja-JP", "libs\ko-KR", "libs\zh-CN") OverlayPlugin\libs
[xml]$csprojcontents = Get-Content -Path "$PWD\..\..\Directory.Build.props";
$version = $csprojcontents.Project.PropertyGroup.AssemblyVersion;
$version = ($version | Out-String).Trim()
$archive = "..\OverlayPlugin-$version.7z"
if (Test-Path $archive) { rm $archive }
cd OverlayPlugin
& 7z a ..\$archive .
cd ..
$archive = "..\OverlayPlugin-$version.zip"
if (Test-Path $archive) { rm $archive }
7z a $archive OverlayPlugin
cd ..\..
} catch {
Write-Error $Error[0]
}