@@ -42,14 +42,18 @@ param(
4242$ErrorActionPreference = ' Stop'
4343$ProgressPreference = ' SilentlyContinue'
4444
45+ # Detect OS and determine build script
46+ $isWindows = $IsWindows -or ($PSVersionTable.PSVersion.Major -lt 6 )
47+ $buildScript = if ($isWindows ) { ' build.ps1' } else { ' build.sh' }
48+
4549# Resolve paths relative to script location
4650$scriptDir = Split-Path - Parent $PSCommandPath
4751$tracerDir = Split-Path - Parent $scriptDir
4852Write-Verbose " Tracer directory: $tracerDir "
4953
5054# 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
55+ Write-Verbose " Cleaning up previous builds from: $tracerDir / bin/ artifacts/ nuget/ azure-functions/ "
56+ Remove-Item - Path " $tracerDir / bin/ artifacts/ nuget/ azure-functions/ *" - Force - ErrorAction SilentlyContinue
5357
5458# Remove package Datadog.AzureFunctions from NuGet cache
5559Write-Verbose " Removing $packageId from NuGet cache..."
8286if ($BuildId )
8387{
8488 Write-Verbose " Downloading Datadog.Trace.Bundle from build: $BuildId "
85- & " $tracerDir \build.ps1 " DownloadBundleNugetFromBuild -- build-id $BuildId
89+ & " $tracerDir / $buildScript " DownloadBundleNugetFromBuild -- build-id $BuildId
8690}
8791else
8892{
9195
9296# Build Datadog.Trace and publish to bundle folder, replacing the files from the NuGet package
9397Write-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'
98+ dotnet publish " $tracerDir / src/ Datadog.Trace" - c Release - o " $tracerDir / src/ Datadog.Trace.Bundle/ home/ net6.0" -f ' net6.0'
9599
96100Write-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'
101+ dotnet publish " $tracerDir / src/ Datadog.Trace" - c Release - o " $tracerDir / src/ Datadog.Trace.Bundle/ home/ net461" -f ' net461'
98102
99103# Build Azure Functions NuGet package
100104Write-Verbose " Building Datadog.AzureFunctions NuGet package..."
101- & " $tracerDir \build.ps1 " BuildAzureFunctionsNuget
105+ & " $tracerDir / $buildScript " BuildAzureFunctionsNuget
102106
103107# Copy package to destination if specified
104108if ($CopyTo )
105109{
106110 Write-Verbose " Copying package to: $CopyTo "
107- Copy-Item " $tracerDir \ bin\ artifacts\ nuget\ azure-functions\ Datadog.AzureFunctions.*.nupkg" $CopyTo - Force
111+ Copy-Item " $tracerDir / bin/ artifacts/ nuget/ azure-functions/ Datadog.AzureFunctions.*.nupkg" $CopyTo - Force
108112}
109113
110114Write-Verbose " Build complete!"
0 commit comments