@@ -42,14 +42,22 @@ param(
4242$ErrorActionPreference = ' Stop'
4343$ProgressPreference = ' SilentlyContinue'
4444
45+ # Detect OS and determine build script
46+ if ($PSVersionTable.PSVersion.Major -ge 6 ) {
47+ $buildScript = if ($IsWindows ) { ' build.ps1' } else { ' build.sh' }
48+ } else {
49+ # PowerShell 5.x is Windows-only
50+ $buildScript = ' build.ps1'
51+ }
52+
4553# Resolve paths relative to script location
4654$scriptDir = Split-Path - Parent $PSCommandPath
4755$tracerDir = Split-Path - Parent $scriptDir
4856Write-Verbose " Tracer directory: $tracerDir "
4957
5058# Clean up previous builds
51- Write-Verbose " Cleaning up previous builds from: $tracerDir \ bin\ artifacts\ nuget\ azure-functions\ "
52- Remove-Item - Path " $tracerDir \ bin\ artifacts\ nuget\ azure-functions\ *" - Force - ErrorAction SilentlyContinue
59+ Write-Verbose " Cleaning up previous builds from: $tracerDir / bin/ artifacts/ nuget/ azure-functions/ "
60+ Remove-Item - Path " $tracerDir / bin/ artifacts/ nuget/ azure-functions/ *" - Force - ErrorAction SilentlyContinue
5361
5462# Remove package Datadog.AzureFunctions from NuGet cache
5563Write-Verbose " Removing $packageId from NuGet cache..."
8290if ($BuildId )
8391{
8492 Write-Verbose " Downloading Datadog.Trace.Bundle from build: $BuildId "
85- & " $tracerDir \build.ps1 " DownloadBundleNugetFromBuild -- build-id $BuildId
93+ & " $tracerDir / $buildScript " DownloadBundleNugetFromBuild -- build-id $BuildId
8694}
8795else
8896{
9199
92100# Build Datadog.Trace and publish to bundle folder, replacing the files from the NuGet package
93101Write-Verbose " Publishing Datadog.Trace (net6.0) to bundle folder..."
94- dotnet publish " $tracerDir \ src\ Datadog.Trace" - c Release - o " $tracerDir \ src\ Datadog.Trace.Bundle\ home\ net6.0" -f ' net6.0'
102+ dotnet publish " $tracerDir / src/ Datadog.Trace" - c Release - o " $tracerDir / src/ Datadog.Trace.Bundle/ home/ net6.0" -f ' net6.0'
95103
96104Write-Verbose " Publishing Datadog.Trace (net461) to bundle folder..."
97- dotnet publish " $tracerDir \ src\ Datadog.Trace" - c Release - o " $tracerDir \ src\ Datadog.Trace.Bundle\ home\ net461" -f ' net461'
105+ dotnet publish " $tracerDir / src/ Datadog.Trace" - c Release - o " $tracerDir / src/ Datadog.Trace.Bundle/ home/ net461" -f ' net461'
98106
99107# Build Azure Functions NuGet package
100108Write-Verbose " Building Datadog.AzureFunctions NuGet package..."
101- & " $tracerDir \build.ps1 " BuildAzureFunctionsNuget
109+ & " $tracerDir / $buildScript " BuildAzureFunctionsNuget
102110
103111# Copy package to destination if specified
104112if ($CopyTo )
105113{
106114 Write-Verbose " Copying package to: $CopyTo "
107- Copy-Item " $tracerDir \ bin\ artifacts\ nuget\ azure-functions\ Datadog.AzureFunctions.*.nupkg" $CopyTo - Force
115+ Copy-Item " $tracerDir / bin/ artifacts/ nuget/ azure-functions/ Datadog.AzureFunctions.*.nupkg" $CopyTo - Force
108116}
109117
110118Write-Verbose " Build complete!"
0 commit comments