@@ -10,95 +10,87 @@ param(
10
10
[string ]
11
11
$Configuration = ' Debug' ,
12
12
[switch ]
13
- $AddSBOM
13
+ $NoBuild ,
14
+ [switch ]
15
+ $Test
14
16
)
15
17
16
18
Import-Module " $PSScriptRoot \pipelineUtilities.psm1" - Force
17
19
18
- $packageName = " AzureFunctions.PowerShell.OpenTelemetry.SDK"
19
- $shimPath = " $PSScriptRoot /src/AzureFunctions.PowerShell.OpenTelemetry.SDK"
20
- $otelEnginePath = " $PSScriptRoot /src/OpenTelemetryEngine"
21
- $otelAppPath = " $PSScriptRoot /test/E2E/app/Modules/$packageName "
22
- $powerShellModulePath = " $PSScriptRoot /src/$packageName .psm1"
23
- $manifestPath = " $PSScriptRoot /src/$packageName .psd1"
20
+ if (! $NoBuild.IsPresent ) {
24
21
25
- # Publish to /out/ folder
26
- # When test app added, publish there instead
27
- $outputPath = $otelAppPath
22
+ $packageName = " AzureFunctions.PowerShell.OpenTelemetry.SDK"
23
+ $shimPath = " $PSScriptRoot /src/AzureFunctions.PowerShell.OpenTelemetry.SDK"
24
+ $otelEnginePath = " $PSScriptRoot /src/OpenTelemetryEngine"
25
+ $otelAppPath = " $PSScriptRoot /test/E2E/app/Modules/$packageName "
26
+ $powerShellModulePath = " $PSScriptRoot /src/$packageName .psm1"
27
+ $manifestPath = " $PSScriptRoot /src/$packageName .psd1"
28
28
29
- $sharedDependenciesPath = " $outputPath /Dependencies/"
29
+ # Publish to /out/ folder
30
+ # When test app added, publish there instead
31
+ $outputPath = $otelAppPath
30
32
31
- $netCoreTFM = ' net6.0'
32
- $publishPathSuffix = " bin/$Configuration /$netCoreTFM /publish"
33
+ $sharedDependenciesPath = " $outputPath /Dependencies/"
33
34
34
- # region BUILD ARTIFACTS ===========================================================================
35
- Write-Log " Build started..."
36
- Write-Log " Configuration: '$Configuration '`n Output folder '$outputPath '`n Shared dependencies folder: '$sharedDependenciesPath '" " Gray"
35
+ $netCoreTFM = ' net6.0'
36
+ $publishPathSuffix = " bin/$Configuration /$netCoreTFM /publish"
37
37
38
- # Map from project names to the folder containing the corresponding .csproj
39
- $projects = @ {
40
- ' OpenTelemetry SDK' = $shimPath
41
- ' OpenTelemetry Engine' = $otelEnginePath
42
- }
38
+ # region BUILD ARTIFACTS ===========================================================================
39
+ Write-Log " Build started..."
40
+ Write-Log " Configuration: '$Configuration '`n Output folder '$outputPath '`n Shared dependencies folder: '$sharedDependenciesPath '" " Gray"
43
41
44
- # Remove previous build if it exists
45
- Write-Log " Removing previous build from $outputPath if it exists..." " Cyan"
46
- if (Test-Path $outputPath )
47
- {
48
- Remove-Item - Path $outputPath - Recurse - Force - ErrorAction Ignore
49
- }
50
- # Create output folder and its inner dependencies directory
51
- Write-Log " Creating a new output and shared dependencies folder at $outputPath and $sharedDependenciesPath ..." " Cyan"
52
- [void ](New-Item - Path $sharedDependenciesPath - ItemType Directory)
42
+ # Map from project names to the folder containing the corresponding .csproj
43
+ $projects = @ {
44
+ ' OpenTelemetry SDK' = $shimPath
45
+ ' OpenTelemetry Engine' = $otelEnginePath
46
+ }
53
47
54
- # Build the OTel SDK project
55
- foreach ($project in $projects.GetEnumerator ()) {
56
- Write-Log " Building $ ( $project.Name ) project with target framework $netCoreTFM ...."
57
- Push-Location $project.Value
58
- try
48
+ # Remove previous build if it exists
49
+ Write-Log " Removing previous build from $outputPath if it exists..." " Cyan"
50
+ if (Test-Path $outputPath )
59
51
{
60
- dotnet publish -f $netCoreTFM - c $Configuration
52
+ Remove-Item - Path $outputPath - Recurse - Force - ErrorAction Ignore
61
53
}
62
- finally
63
- {
64
- Pop-Location
54
+ # Create output folder and its inner dependencies directory
55
+ Write-Log " Creating a new output and shared dependencies folder at $outputPath and $sharedDependenciesPath ..." " Cyan"
56
+ [void ](New-Item - Path $sharedDependenciesPath - ItemType Directory)
57
+
58
+ # Build the OTel SDK project
59
+ foreach ($project in $projects.GetEnumerator ()) {
60
+ Write-Log " Building $ ( $project.Name ) project with target framework $netCoreTFM ...."
61
+ Push-Location $project.Value
62
+ try
63
+ {
64
+ dotnet publish -f $netCoreTFM - c $Configuration
65
+ }
66
+ finally
67
+ {
68
+ Pop-Location
69
+ }
65
70
}
66
- }
67
-
68
- $commonFiles = [System.Collections.Generic.HashSet [string ]]::new()
69
71
70
- Write-Log " Copying assemblies from the OpenTelemetry Engine project into $sharedDependenciesPath " " Gray"
71
- Get-ChildItem - Path (Join-Path " $otelEnginePath " " $publishPathSuffix " ) |
72
- Where-Object { $_.Extension -in ' .dll' , ' .pdb' } |
73
- ForEach-Object { [void ]$commonFiles.Add ($_.Name ); Copy-Item - LiteralPath $_.FullName - Destination $sharedDependenciesPath }
74
-
75
- # Copy all *unique* assemblies from OTel SDK into output directory
76
- Write-Log " Copying unique assemblies from the OTel SDK project into $outputPath " " Gray"
77
- Get-ChildItem - Path (Join-Path " $shimPath " " $publishPathSuffix " ) |
78
- Where-Object { $_.Extension -in ' .dll' , ' .pdb' -and -not $commonFiles.Contains ($_.Name ) } |
79
- ForEach-Object { Copy-Item - LiteralPath $_.FullName - Destination $outputPath }
80
-
81
- # Move OTel SDK manifest into the output directory
82
- Write-Log " Copying PowerShell module and manifest from the OTel SDK source code into $outputPath " " Gray"
83
- Copy-Item - Path $powerShellModulePath - Destination $outputPath
84
- Copy-Item - Path $manifestPath - Destination $outputPath
85
- Write-Log " Build succeeded!"
86
- # endregion
87
-
88
- # region ADD SBOM ==================================================================================
89
- if ($AddSBOM ) {
90
- # Install manifest tool
91
- $manifestToolPath = Install-SBOMUtil
92
- Write-Log " Manifest tool path: $manifestToolPath "
93
-
94
- # Generate manifest
95
- $telemetryFilePath = Join-Path $PSScriptRoot ((New-Guid ).Guid + " .json" )
96
- $packageName = " AzureFunctions.PowerShell.OpenTelemetry.SDK"
97
-
98
- Write-Log " Running: dotnet $manifestToolPath generate -BuildDropPath $outputPath -BuildComponentPath $outputPath -Verbosity Information -t $telemetryFilePath -PackageName $packageName "
99
- dotnet $manifestToolPath generate - BuildDropPath $outputPath - BuildComponentPath $outputPath - Verbosity Information - t $telemetryFilePath - PackageName $packageName
100
-
101
- # Discard telemetry generated
102
- Remove-Item - Path $telemetryFilePath - ErrorAction Ignore
72
+ $commonFiles = [System.Collections.Generic.HashSet [string ]]::new()
73
+
74
+ Write-Log " Copying assemblies from the OpenTelemetry Engine project into $sharedDependenciesPath " " Gray"
75
+ Get-ChildItem - Path (Join-Path " $otelEnginePath " " $publishPathSuffix " ) |
76
+ Where-Object { $_.Extension -in ' .dll' , ' .pdb' } |
77
+ ForEach-Object { [void ]$commonFiles.Add ($_.Name ); Copy-Item - LiteralPath $_.FullName - Destination $sharedDependenciesPath }
78
+
79
+ # Copy all *unique* assemblies from OTel SDK into output directory
80
+ Write-Log " Copying unique assemblies from the OTel SDK project into $outputPath " " Gray"
81
+ Get-ChildItem - Path (Join-Path " $shimPath " " $publishPathSuffix " ) |
82
+ Where-Object { $_.Extension -in ' .dll' , ' .pdb' -and -not $commonFiles.Contains ($_.Name ) } |
83
+ ForEach-Object { Copy-Item - LiteralPath $_.FullName - Destination $outputPath }
84
+
85
+ # Move OTel SDK manifest into the output directory
86
+ Write-Log " Copying PowerShell module and manifest from the OTel SDK source code into $outputPath " " Gray"
87
+ Copy-Item - Path $powerShellModulePath - Destination $outputPath
88
+ Copy-Item - Path $manifestPath - Destination $outputPath
89
+ Write-Log " Build succeeded!"
90
+ # endregion
91
+ }
92
+ # region Test ==================================================================================
93
+ if ($Test.IsPresent ) {
94
+ Write-Log " There are no tests! Panic!"
103
95
}
104
96
# endregion
0 commit comments