Skip to content

Commit 17b1e5b

Browse files
committed
add buildrelease.ps1 and vswhere.exe
1 parent 57ffa26 commit 17b1e5b

3 files changed

Lines changed: 71 additions & 2 deletions

File tree

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@ Any content that is not the property of Oracle (SQLcl and its associated materia
1818
1. Run the **buildrelease.ps1** script. Powershell 7.2 (or newer) is required.
1919
1. The MSI will be in "publish\unsigned\\<culture>".
2020

21-
## Notes
22-

buildrelease.ps1

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#Requires -Version 7.2
2+
param (
3+
[string]$targetplatform = "x64",
4+
[string]$sign
5+
)
6+
if ($args.Count) { throw "Unexpected arguments passed: $args" }
7+
8+
$PSNativeCommandUseErrorActionPreference = $true
9+
$ErrorActionPreference = "Stop"
10+
11+
Set-StrictMode -version 2
12+
13+
$startworkinglocation = Get-Location
14+
15+
# If -sign commandline argument was passed, run the VS Dev Shell script so signtool.exe is in the PATH
16+
if ($sign -ne "" -and $sign -ne $null)
17+
{
18+
$initvsdevshell = & "$PSScriptRoot\tools\vswhere.exe" -latest -find **\Launch-VsDevShell.ps1 | select-object -first 1
19+
if ([string]::IsNullOrEmpty($initvsdevshell) -eq $false)
20+
{
21+
& $initvsdevshell
22+
}
23+
else
24+
{
25+
Write-Output 'Visual Studio was not found - VS developer shell launch script was not run.'
26+
}
27+
28+
$requiredexecutables = @("msbuild.exe", "signtool.exe")
29+
foreach ($required in $requiredexecutables)
30+
{
31+
Write-Host Searching for $required in PATH.
32+
if ($null -eq (Get-Command "$required" -ErrorAction SilentlyContinue))
33+
{
34+
Write-Host "$required not found in PATH. Exiting."
35+
exit 1
36+
}
37+
Write-Host $required found.
38+
}
39+
40+
$buildoutputpath = "$PSScriptRoot\publish\signed"
41+
}
42+
else {
43+
$buildoutputpath = "$PSScriptRoot\publish\unsigned"
44+
}
45+
46+
Set-Location -Path $PSScriptRoot
47+
48+
49+
# Remove old stuff
50+
Remove-Item -path $buildoutputpath -recurse -ErrorAction SilentlyContinue
51+
mkdir -p $buildoutputpath | Out-Null
52+
53+
54+
dotnet clean --configuration Release -p:Platform=$targetplatform
55+
dotnet build -p:Configuration=Release -p:Platform=$targetplatform -p:OutputPath="$buildoutputpath" sqlclinstaller.sln
56+
57+
# sign the installer if -sign was specified
58+
if ($sign -ne "" -and $sign -ne $null)
59+
{
60+
signtool.exe sign /sha1 $sign /t http://time.certum.pl /fd sha256 /v "$buildoutputpath\$((Get-Culture).Name)\*.msi"
61+
}
62+
63+
Set-Location -Path "$buildoutputpath\$((Get-Culture).Name)\"
64+
65+
# compute hashes of the output
66+
$outputfiles = Get-ChildItem "."
67+
foreach ($outfile in $outputfiles) {
68+
certutil -hashfile $outfile.Name sha512 | Out-File -Encoding utf8NoBOM -FilePath "$outfile.sha512"
69+
}
70+
71+
Set-Location -Path $startworkinglocation

tools/vswhere.exe

458 KB
Binary file not shown.

0 commit comments

Comments
 (0)