This repository was archived by the owner on Jul 5, 2024. It is now read-only.
forked from Squirrel/Squirrel.Windows
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbuild.ps1
41 lines (34 loc) · 1.94 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
# search for msbuild, the loaction of vswhere is guarenteed to be consistent
$MSBuildPath = (&"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe) | Out-String
$MSBuildPath = $MSBuildPath.Trim();
# Stop the script if an error occurs
$ErrorActionPreference = "Stop"
$In = "$PSScriptRoot\build\Release\"
$Out = "$PSScriptRoot\build\publish\"
$Folders = @("$PSScriptRoot\build", "$PSScriptRoot\packages", "$PSScriptRoot\test\bin", "$PSScriptRoot\test\obj")
# Ensure a clean state by removing build/package folders
foreach ($Folder in $Folders) {
if (Test-Path $Folder) {
Remove-Item -path "$Folder" -Recurse -Force
}
}
# Build Squirrel C++ with msbuild as dotnet can't
&"$MSBuildPath" /verbosity:minimal /restore /p:Configuration=Release
# Build single-exe packaged projects
# New-Item -Path "$Out" -Name "win-x86" -ItemType "directory"
$BinOut = $Out
dotnet publish -v minimal -c Release -r win-x86 --self-contained=true "$PSScriptRoot\src\SquirrelCli\SquirrelCli.csproj" -o "$Out"
dotnet publish -v minimal -c Release -r win-x86 --self-contained=true "$PSScriptRoot\src\Update\Update.csproj" -o "$BinOut"
# Copy over all files we need
Copy-Item -Path "$PSScriptRoot\vendor\7zip\*" -Destination "$BinOut" -Recurse
Copy-Item -Path "$PSScriptRoot\vendor\wix\*" -Destination "$BinOut" -Recurse
Copy-Item "$In\Win32\Setup.exe" -Destination "$BinOut"
Copy-Item "$In\Win32\StubExecutable.exe" -Destination "$BinOut"
Copy-Item "$PSScriptRoot\vendor\nuget.exe" -Destination "$BinOut"
Copy-Item "$PSScriptRoot\vendor\rcedit.exe" -Destination "$BinOut"
Copy-Item "$PSScriptRoot\vendor\signtool.exe" -Destination "$BinOut"
Copy-Item "$PSScriptRoot\vendor\singlefilehost.exe" -Destination "$BinOut"
Remove-Item "$Out\*.pdb"
Remove-Item "$BinOut\*.pdb"
Remove-Item "$Out\SquirrelLib.xml"
Write-Output "Successfully copied files to './build/publish'"