@@ -16,6 +16,7 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
1616
1717function 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
0 commit comments