-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildrelease.ps1
87 lines (72 loc) · 3.07 KB
/
buildrelease.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
#Requires -Version 7.2
param (
[string]$name = "sqldeveloper",
[string]$versionoverride = $null,
[switch]$sign = $false
)
if ($args.Count) { throw "Unexpected arguments passed: $args" }
Set-StrictMode -version 2
$startworkinglocation = Get-Location
# If -sign commandline argument was passed, run the VS 2022 Dev Shell script so signtool.exe is in the PATH
if ($sign)
{
$vspaths = @("$env:ProgramFiles\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1","$env:ProgramFiles\Microsoft Visual Studio\2022\Professional\Common7\Tools\Launch-VsDevShell.ps1","$env:ProgramFiles\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Launch-VsDevShell.ps1")
foreach ($testvspath in $vspaths)
{
if (Test-Path $testvspath)
{
$initvsdevshell = $testvspath
break;
}
}
if ([string]::IsNullOrEmpty($initvsdevshell) -eq $false)
{
& $initvsdevshell
}
else
{
Write-Output 'Visual Studio 2022 was not found - VS developer shell launch script was not run.'
}
$requiredexecutables = @("msbuild.exe", "signtool.exe")
foreach ($required in $requiredexecutables)
{
Write-Host Searching for $required in PATH.
if ((Get-Command "$required" -ErrorAction SilentlyContinue) -eq $null)
{
Write-Host "$required not found in PATH. Exiting."
exit 1
}
Write-Host $required found.
}
$buildoutputpath = "$PSScriptRoot\publish\signed"
}
else {
$buildoutputpath = "$PSScriptRoot\publish\unsigned"
}
Set-Location -Path $PSScriptRoot
# Remove old stuff
Remove-Item -path $buildoutputpath -recurse -ErrorAction SilentlyContinue
mkdir -p $buildoutputpath | Out-Null
# set the version string used in the MSI filename
$sqldevversion = (get-item .\sqldeveloper\sqldeveloper.exe).VersionInfo.FileVersion
Write-Host sqldeveloper.exe version is $sqldevversion
# use the -versionoverride parameter if set
if ([string]::IsNullOrEmpty($versionoverride) -eq $false)
{
$sqldevversion = $versionoverride
Write-Host "Version manually set to $versionoverride (will not change the product version, only the MSI filename)"
}
dotnet clean --configuration Release
dotnet build -p:Configuration=Release -p:InstallerName=$name -p:InstallerVersion=$sqldevversion -p:OutputPath="$buildoutputpath" SQLDeveloperInstaller.sln
# sign the installer if -sign was specified
if ($sign -eq $true)
{
signtool.exe sign /sha1 $env:CodeSignHash /t http://time.certum.pl /fd sha256 /v "$buildoutputpath\$((Get-Culture).Name)\*.msi"
}
Set-Location -Path "$buildoutputpath\$((Get-Culture).Name)\"
# compute hashes of the output
$outputfiles = Get-ChildItem "."
foreach ($outfile in $outputfiles) {
certutil -hashfile $outfile.Name sha512 | Out-File -Encoding utf8NoBOM -FilePath "$outfile.sha512"
}
Set-Location -Path $startworkinglocation