3
3
param (
4
4
[ValidateSet (' Debug' , ' Release' )]
5
5
[string ]
6
- $Configuration = ' Debug'
6
+ $Configuration = ' Debug' ,
7
+ [switch ]
8
+ $AddSBOM
7
9
)
8
10
11
+ Import-Module " $PSScriptRoot \pipelineUtilities.psm1" - Force
12
+
9
13
$packageName = " AzureFunctions.PowerShell.Durable.SDK"
10
14
$shimPath = " $PSScriptRoot /src/DurableSDK"
11
15
$durableEnginePath = " $PSScriptRoot /src/DurableEngine"
12
16
$durableAppPath = " $PSScriptRoot /test/E2E/durableApp/Modules/$packageName "
13
17
$powerShellModulePath = " $PSScriptRoot /src/$packageName .psm1"
14
18
$manifestPath = " $PSScriptRoot /src/$packageName .psd1"
15
19
16
- $outputPath = " $PSScriptRoot /src/out/"
17
- if ($Configuration -eq " Debug" )
18
- {
19
- # Publish directly to the test durable app for testing
20
- $outputPath = $durableAppPath
21
- }
20
+ # Publish directly to the test durable app for testing
21
+ $outputPath = $durableAppPath
22
+
22
23
$sharedDependenciesPath = " $outputPath /Dependencies/"
23
24
24
25
$netCoreTFM = ' net6.0'
25
26
$publishPathSuffix = " bin/$Configuration /$netCoreTFM /publish"
26
27
27
- function Write-Log
28
- {
29
- param (
30
- [Parameter (Mandatory = $true )]
31
- [ValidateNotNullOrEmpty ()]
32
- [System.String ]
33
- $Message ,
34
-
35
- [Switch ]
36
- $Warning ,
37
-
38
- [Switch ]
39
- $Throw ,
40
-
41
- [System.String ]
42
- $Color
43
- )
44
-
45
- $Message = (Get-Date - Format G) + " -- $Message "
46
-
47
- if ($Throw )
48
- {
49
- throw $Message
50
- }
51
-
52
- $foregroundColor = if ($Warning.IsPresent ) { ' Yellow' } elseif ($Color ) { $Color } else { ' Green' }
53
- Write-Host - ForegroundColor $foregroundColor $Message
54
- }
55
-
28
+ # region BUILD ARTIFACTS ===========================================================================
56
29
Write-Log " Build started..."
57
30
Write-Log " Configuration: '$Configuration '`n Output folder '$outputPath '`n Shared dependencies folder: '$sharedDependenciesPath '" " Gray"
58
31
@@ -89,18 +62,37 @@ foreach ($project in $projects.GetEnumerator()) {
89
62
$commonFiles = [System.Collections.Generic.HashSet [string ]]::new()
90
63
91
64
Write-Log " Copying assemblies from the Durable Engine project into $sharedDependenciesPath " " Gray"
92
- Get-ChildItem - Path " $durableEnginePath / $publishPathSuffix " |
65
+ Get-ChildItem - Path ( Join-Path " $durableEnginePath " " $publishPathSuffix " ) |
93
66
Where-Object { $_.Extension -in ' .dll' , ' .pdb' } |
94
67
ForEach-Object { [void ]$commonFiles.Add ($_.Name ); Copy-Item - LiteralPath $_.FullName - Destination $sharedDependenciesPath }
95
68
96
69
# Copy all *unique* assemblies from Durable SDK into output directory
97
70
Write-Log " Copying unique assemblies from the Durable SDK project into $outputPath " " Gray"
98
- Get-ChildItem - Path " $shimPath / $publishPathSuffix " |
71
+ Get-ChildItem - Path ( Join-Path " $shimPath " " $publishPathSuffix " ) |
99
72
Where-Object { $_.Extension -in ' .dll' , ' .pdb' -and -not $commonFiles.Contains ($_.Name ) } |
100
73
ForEach-Object { Copy-Item - LiteralPath $_.FullName - Destination $outputPath }
101
74
102
75
# Move Durable SDK manifest into the output directory
103
76
Write-Log " Copying PowerShell module and manifest from the Durable SDK source code into $outputPath " " Gray"
104
77
Copy-Item - Path $powerShellModulePath - Destination $outputPath
105
78
Copy-Item - Path $manifestPath - Destination $outputPath
106
- Write-Log " Build succeeded!"
79
+ Write-Log " Build succeeded!"
80
+ # endregion
81
+
82
+ # region ADD SBOM ==================================================================================
83
+ if ($AddSBOM ) {
84
+ # Install manifest tool
85
+ $manifestToolPath = Install-SBOMUtil
86
+ Write-Log " Manifest tool path: $manifestToolPath "
87
+
88
+ # Generate manifest
89
+ $telemetryFilePath = Join-Path $PSScriptRoot ((New-Guid ).Guid + " .json" )
90
+ $packageName = " AzureFunctions.PowerShell.Durable.SDK"
91
+
92
+ Write-Log " Running: dotnet $manifestToolPath generate -BuildDropPath $outputPath -BuildComponentPath $outputPath -Verbosity Information -t $telemetryFilePath -PackageName $packageName "
93
+ dotnet $manifestToolPath generate - BuildDropPath $outputPath - BuildComponentPath $outputPath - Verbosity Information - t $telemetryFilePath - PackageName $packageName
94
+
95
+ # Discard telemetry generated
96
+ Remove-Item - Path $telemetryFilePath - ErrorAction Ignore
97
+ }
98
+ # endregion
0 commit comments