Skip to content

Commit be054cc

Browse files
author
Steve Salas
committed
Build script sets Code Pulse version
1 parent 83a011f commit be054cc

File tree

8 files changed

+69
-27
lines changed

8 files changed

+69
-27
lines changed

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
val baseSettings = Seq(
22
organization := "com.codedx",
3-
version := "2.0.0-SNAPSHOT",
4-
BuildKeys.releaseDate := "SNAPSHOT"
3+
version := "UNVERSIONED",
4+
BuildKeys.releaseDate := "N/A"
55
)
66

77
val scalaSettings = Seq(

codepulse/src/main/resources/toserve/common/UpdateController.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@
8686
/** checks `release`, firing off the appropriate events as necessary */
8787
function checkRelease(release) {
8888
getVersion(function (ourVersion) {
89+
if (ourVersion == "UNVERSIONED") {
90+
return;
91+
}
8992
var releaseVersion = release.tag_name.replace(/^v/, '')
9093
self.releaseVersion = releaseVersion
9194

installers/Linux/build.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# This script creates the Linux Code Pulse package
33
#
44
param (
5-
[switch] $forceTracerRebuild
5+
[switch] $forceTracerRebuild,
6+
$version='1.0.0.0',
7+
$releaseDate=([DateTime]::Now.ToShortDateString())
68
)
79

810
Set-PSDebug -Strict
@@ -23,13 +25,14 @@ if ($forceTracerRebuild -or (-not (Test-DotNetTracer $codePulsePath $buildConfig
2325
}
2426

2527
Invoke-CodePulsePackaging `
26-
$codePulseVersion `
28+
$version `
29+
$releaseDate `
2730
$PSScriptRoot `
2831
$codePulsePath `
2932
'Linux' `
3033
'linux-x64' `
3134
'packageEmbeddedLinuxX64' `
32-
"CodePulse-$($codePulseVersion)-SNAPSHOT-linux-x64.zip" `
35+
"CodePulse-$($version)-linux-x64.zip" `
3336
'dotnet-symbol-service' `
3437
'SymbolService' `
3538
'agent.jar'
@@ -38,7 +41,7 @@ Invoke-CodePulseZip `
3841
$PSScriptRoot `
3942
'Linux' `
4043
'Linux-x64' `
41-
$codePulseVersion `
44+
$version `
4245
$zipFilePath `
4346
'Files\Linux'
4447

installers/Scripts/common.ps1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
1616

1717
function Invoke-CodePulsePackaging(
1818
[string] $codePulseVersion,
19+
[datetime] $codePulseReleaseDate,
1920
[string] $scriptRoot,
2021
[string] $codePulsePath,
2122
[string] $osName,
@@ -51,6 +52,13 @@ function Invoke-CodePulsePackaging(
5152

5253
Push-Location $codePulsePath
5354

55+
write-verbose "Editing build.sbt for version $codePulseVersion and release date $codePulseReleaseDate..."
56+
$buildSbtPath = join-path (get-location) 'build.sbt'
57+
$buildSbt = gc $buildSbtPath
58+
$buildSbtNew = $buildSbt | % { $_ -replace 'version\ :=\ "UNVERSIONED"',"version := `"$codePulseVersion`"" }
59+
$buildSbtNew = $buildSbtNew | % { $_ -replace 'BuildKeys\.releaseDate\ :=\ "N/A"',"BuildKeys.releaseDate := `"$codePulseReleaseDate`"" }
60+
Set-TextContent $buildSbtPath $buildSbtNew
61+
5462
write-verbose "Editing application.conf for $osName packaging..."
5563
$applicationConfPath = join-path (get-location) 'codepulse\src\main\resources\application.conf'
5664
$applicationConf = gc $applicationConfPath
@@ -66,14 +74,20 @@ function Invoke-CodePulsePackaging(
6674
}
6775

6876
write-verbose "Packaging Code Pulse ($osRID)..."
69-
Invoke-Sbt $packageCommand
77+
if (-not (Invoke-Sbt $packageCommand 3 ([timespan]::FromMinutes(1)))) {
78+
write-verbose 'Packaging failed'
79+
exit 1
80+
}
7081

7182
write-verbose "Unzipping Code Pulse package ($osName)..."
7283
[io.compression.zipfile]::ExtractToDirectory($codePulsePackagePath, $filesFolderPath)
7384

7485
write-verbose "Restoring original '$applicationConfPath' contents..."
7586
Set-TextContent $applicationConfPath $applicationConf
7687

88+
write-verbose 'Restoring original build.sbt contents...'
89+
Set-TextContent $buildSbtPath $buildSbt
90+
7791
write-verbose 'Moving Java agent (Linux)...'
7892
move-item (join-path $filesFolderCodePulsePath $agentJarRelativePath) $filesFolderJavaTracerPath
7993

@@ -174,6 +188,5 @@ $dotNetSymbolServicePath = join-path $codePulsePath 'dotnet-symbol-service'
174188
$dotNetTracerPath = join-path $codePulsePath 'dotnet-tracer'
175189
$dotNetTracerMainPath = join-path $dotNetTracerPath 'main'
176190

177-
$codePulseVersion = '2.0.0'
178191
$buildConfiguration = 'Release'
179192

installers/Scripts/sbt.ps1

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,30 @@ function Get-SbtPath() {
1515
}
1616
}
1717

18-
function Invoke-Sbt([string] $packageName) {
19-
try {
20-
c:\windows\system32\cmd.exe /c "`"$(Get-SbtPath)`" $packageName"
21-
}
22-
catch {
23-
if ($_.Exception.Message -ne 'Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0') {
24-
exit $lastexitcode
18+
function Invoke-Sbt([string] $packageName, [byte] $retryCount=0, [timespan] $retryWait=([timespan]::FromMilliSeconds(0))) {
19+
20+
$try = 0
21+
do
22+
{
23+
if ($try -ne 0) {
24+
Write-Verbose "Retrying (retry number $try) after waiting for $($retryWait.TotalMilliseconds) milliseconds..."
25+
sleep -Milliseconds $retryWait.TotalMilliseconds
26+
}
27+
$try++
28+
29+
try {
30+
c:\windows\system32\cmd.exe /c `"$(Get-SbtPath)`" $packageName
31+
if ($lastexitcode -eq 0) {
32+
return $true
33+
}
34+
}
35+
catch {
36+
if ($_.Exception.Message -eq 'Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0') {
37+
return $true
38+
}
2539
}
2640
}
41+
while ($try -le $retryCount)
42+
43+
$false
2744
}

installers/Windows/build.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
param (
55
[switch] $forceTracerRebuild,
66
[switch] $signOutput,
7-
$version='1.0.0.0'
7+
$version='1.0.0.0',
8+
$releaseDate=([DateTime]::Now.ToShortDateString())
89
)
910

1011
Set-PSDebug -Strict
@@ -31,13 +32,14 @@ $productNew = $product | % { $_ -replace ([System.Text.RegularExpressions.Regex]
3132
Set-TextContent $productPath $productNew
3233

3334
Invoke-CodePulsePackaging `
34-
$codePulseVersion `
35+
$version `
36+
$releaseDate `
3537
$PSScriptRoot `
3638
$codePulsePath `
3739
'Win64' `
3840
'win-x64' `
3941
'packageEmbeddedWin64' `
40-
"CodePulse-$($codePulseVersion)-SNAPSHOT-win64.zip" `
42+
"CodePulse-$($version)-win64.zip" `
4143
'..\dotnet-symbol-service' `
4244
'SymbolService.exe' `
4345
'agent.jar'
@@ -86,7 +88,7 @@ Invoke-CodePulseZip `
8688
$PSScriptRoot `
8789
'Windows' `
8890
'Windows-x64' `
89-
$codePulseVersion `
91+
$version `
9092
$zipFilePath `
9193
"CodePulse.Installer.Win64\bin\$buildConfiguration"
9294

installers/build.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ param (
1313
[switch] $skipMac,
1414
[switch] $skipLinux,
1515
[switch] $signOutput,
16-
$version='1.0.0.0'
16+
$version='1.0.0.0',
17+
$releaseDate=([DateTime]::Now.ToShortDateString())
1718
)
1819

1920
Set-PSDebug -Strict
@@ -88,7 +89,7 @@ Press Enter *after* you have signed the bundle...
8889

8990
if (-not $skipWindows) {
9091
Write-Verbose 'Starting Windows build...'
91-
.\Windows\build.ps1 -version $version -signOutput:$signOutput
92+
.\Windows\build.ps1 -version $version -releaseDate $releaseDate -signOutput:$signOutput
9293
if ($lastexitcode -ne 0) {
9394
Write-Verbose 'Aborting Windows build...'
9495
exit $lastexitcode
@@ -97,7 +98,7 @@ if (-not $skipWindows) {
9798

9899
if (-not $skipMac) {
99100
Write-Verbose 'Starting macOS build...'
100-
.\macOS\build.ps1 -signOutput:$signOutput
101+
.\macOS\build.ps1 -version $version -releaseDate $releaseDate -signOutput:$signOutput
101102
if ($lastexitcode -ne 0) {
102103
Write-Verbose 'Aborting macOS build...'
103104
exit $lastexitcode
@@ -106,7 +107,7 @@ if (-not $skipMac) {
106107

107108
if (-not $skipLinux) {
108109
Write-Verbose 'Starting Linux build...'
109-
.\Linux\build.ps1
110+
.\Linux\build.ps1 -version $version -releaseDate $releaseDate
110111
if ($lastexitcode -ne 0) {
111112
Write-Verbose 'Aborting Linux build...'
112113
exit $lastexitcode

installers/macOS/build.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#
44
param (
55
[switch] $forceTracerRebuild,
6-
[switch] $signOutput
6+
[switch] $signOutput,
7+
$version='1.0.0.0',
8+
$releaseDate=([DateTime]::Now.ToShortDateString())
79
)
810

911
Set-PSDebug -Strict
@@ -24,13 +26,14 @@ if ($forceTracerRebuild -or (-not (Test-DotNetTracer $codePulsePath $buildConfig
2426
}
2527

2628
Invoke-CodePulsePackaging `
27-
$codePulseVersion `
29+
$version `
30+
$releaseDate `
2831
$PSScriptRoot `
2932
$codePulsePath `
3033
'macOS' `
3134
'osx-x64' `
3235
'packageEmbeddedOsx' `
33-
"CodePulse-$($codePulseVersion)-SNAPSHOT-osx.zip" `
36+
"CodePulse-$($version)-osx.zip" `
3437
'Code Pulse.app\Contents\Resources\app.nw\dotnet-symbol-service' `
3538
'SymbolService' `
3639
'Code Pulse.app\Contents\Resources\app.nw\agent.jar'
@@ -70,7 +73,7 @@ Invoke-CodePulseZip `
7073
$PSScriptRoot `
7174
'macOS' `
7275
'macOS-x64' `
73-
$codePulseVersion `
76+
$version `
7477
$zipFilePath `
7578
'Files\macOS'
7679

0 commit comments

Comments
 (0)