@@ -12,47 +12,50 @@ Param(
12
12
function Build-Projects {
13
13
$ErrorActionPreference = ' Stop'
14
14
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot ' ..' )
15
-
16
- # Define constants for common path segments
17
- $TemplateFeedPath = " template_feed\Microsoft.DotNet.Common.ProjectTemplates.10.0\content"
18
- $MSTestPath = " $TemplateFeedPath \MSTest"
19
- $NUnitPath = " $TemplateFeedPath \NUnit"
20
- $XUnitPath = " $TemplateFeedPath \XUnit"
21
- $PlaywrightMSTestPath = " $TemplateFeedPath \Playwright-MSTest"
22
- $PlaywrightNUnitPath = " $TemplateFeedPath \Playwright-NUnit"
23
15
24
- # Define the project files using the constants
25
- $ProjectFiles = @ (
26
- # MSTest Projects
27
- " $MSTestPath -CSharp\Company.TestProject1.csproj" ,
28
- " $MSTestPath -FSharp\Company.TestProject1.fsproj" ,
29
- " $MSTestPath -VisualBasic\Company.TestProject1.vbproj" ,
30
- " $PlaywrightMSTestPath -CSharp\Company.TestProject1.csproj" ,
31
-
32
- # NUnit Projects
33
- " $NUnitPath -CSharp\Company.TestProject1.csproj" ,
34
- " $NUnitPath -FSharp\Company.TestProject1.fsproj" ,
35
- " $NUnitPath -VisualBasic\Company.TestProject1.vbproj" ,
36
- " $PlaywrightNUnitPath -CSharp\Company.TestProject1.csproj" ,
37
-
38
- # XUnit Projects
39
- " $XUnitPath -CSharp\Company.TestProject1.csproj" ,
40
- " $XUnitPath -FSharp\Company.TestProject1.fsproj" ,
41
- " $XUnitPath -VisualBasic\Company.TestProject1.vbproj"
42
- )
16
+ # Define constants for common path segments
17
+ $TemplateFeedPath = " template_feed\Microsoft.DotNet.Common.ProjectTemplates.10.0\content"
18
+ $MSTestPath = " $TemplateFeedPath \MSTest"
19
+ $NUnitPath = " $TemplateFeedPath \NUnit"
20
+ $XUnitPath = " $TemplateFeedPath \XUnit"
21
+ $PlaywrightMSTestPath = " $TemplateFeedPath \Playwright-MSTest"
22
+ $PlaywrightNUnitPath = " $TemplateFeedPath \Playwright-NUnit"
23
+
24
+ # Define the project files using the constants
25
+ $ProjectFiles = @ (
26
+ # MSTest Projects
27
+ " $MSTestPath -CSharp\Company.TestProject1.csproj" ,
28
+ " $MSTestPath -FSharp\Company.TestProject1.fsproj" ,
29
+ " $MSTestPath -VisualBasic\Company.TestProject1.vbproj" ,
30
+ " $PlaywrightMSTestPath -CSharp\Company.TestProject1.csproj" ,
31
+
32
+ # NUnit Projects
33
+ " $NUnitPath -CSharp\Company.TestProject1.csproj" ,
34
+ " $NUnitPath -FSharp\Company.TestProject1.fsproj" ,
35
+ " $NUnitPath -VisualBasic\Company.TestProject1.vbproj" ,
36
+ " $PlaywrightNUnitPath -CSharp\Company.TestProject1.csproj" ,
37
+
38
+ # XUnit Projects
39
+ " $XUnitPath -CSharp\Company.TestProject1.csproj" ,
40
+ " $XUnitPath -FSharp\Company.TestProject1.fsproj" ,
41
+ " $XUnitPath -VisualBasic\Company.TestProject1.vbproj"
42
+ )
43
43
44
44
Write-Host " Building projects in the dogfood environment..." - ForegroundColor Cyan
45
45
46
46
# Call dogfood.ps1 directly instead of through dogfood.cmd to avoid the -NoExit parameter
47
47
$dogfoodPs1 = Join-Path $RepoRoot " eng\dogfood.ps1"
48
48
49
+ $failedProjects = @ ()
50
+
49
51
foreach ($projectFile in $ProjectFiles ) {
50
52
$fullProjectPath = Join-Path $RepoRoot $projectFile
51
53
52
54
# Check if the project file exists
53
55
if (-not (Test-Path $fullProjectPath )) {
54
56
Write-Error " Project file not found at: $fullProjectPath "
55
- return 1
57
+ $failedProjects += $fullProjectPath
58
+ continue
56
59
}
57
60
58
61
Write-Host " Executing: dotnet build $fullProjectPath via dogfood environment" - ForegroundColor Gray
@@ -61,13 +64,20 @@ function Build-Projects {
61
64
$exitCode = $LASTEXITCODE
62
65
if ($exitCode -ne 0 ) {
63
66
Write-Error " Build failed for project: $fullProjectPath with exit code: $exitCode "
64
- return $exitCode
67
+ $failedProjects += $fullProjectPath
65
68
} else {
66
69
Write-Host " Build completed successfully for project: $fullProjectPath " - ForegroundColor Green
67
70
}
68
71
}
69
72
70
- return 0
73
+ if ($failedProjects.Count -gt 0 ) {
74
+ Write-Error " The following projects failed to build:"
75
+ $failedProjects | ForEach-Object { Write-Error $_ }
76
+ return 1
77
+ } else {
78
+ Write-Host " All projects built successfully!" - ForegroundColor Green
79
+ return 0
80
+ }
71
81
}
72
82
73
83
# Execute the function using Invoke-Command
0 commit comments