Skip to content

Commit 877c53a

Browse files
committed
utils: adjust the -Clean option to clean before execution
This hoists the cleaning to prior to building the toolchain. This is particularly important as changes in the module format may cause the compiler to crash. Due to the use of Swift in the Swift compiler, we load modules early and a previous run may have left over modules from the last run, which would result in the module attempting to be loaded. This cleans out the extra modules before the toolchain build avoiding that.
1 parent 998ad51 commit 877c53a

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

utils/build.ps1

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,6 +2790,19 @@ try {
27902790

27912791
Fetch-Dependencies
27922792

2793+
if ($Clean) {
2794+
10..[HostComponent].getEnumValues()[-1] | ForEach-Object { Remove-Item -Force -Recurse "$BinaryCache\$_" -ErrorAction Ignore }
2795+
# In case of a previous test run, clear out the swiftmodules as they are not a stable format.
2796+
Remove-Item -Force -Recurse -Path "$($HostARch.ToolchainInstallRoot)\usr\lib\swift\windows\*.swiftmodule" -ErrorAction Ignore
2797+
foreach ($Arch in $WindowsSDKArchs) {
2798+
0..[TargetComponent].getEnumValues()[-1] | ForEach-Object { Remove-Item -Force -Recurse "$BinaryCache\$($Arch.BuildID + $_)" -ErrorAction Ignore }
2799+
}
2800+
foreach ($Arch in $AndroidSDKArchs) {
2801+
0..[TargetComponent].getEnumValues()[-1] | ForEach-Object { Remove-Item -Force -Recurse "$BinaryCache\$($Arch.BuildID + $_)" -ErrorAction Ignore }
2802+
}
2803+
}
2804+
2805+
27932806
if (-not $SkipBuild) {
27942807
if ($EnableCaching -And (-Not (Test-SCCacheAtLeast -Major 0 -Minor 7 -Patch 4))) {
27952808
throw "Minimum required sccache version is 0.7.4"
@@ -2810,18 +2823,6 @@ if (-not $SkipBuild) {
28102823
Invoke-BuildStep Build-Compilers $HostArch
28112824
}
28122825

2813-
if ($Clean) {
2814-
10..[HostComponent].getEnumValues()[-1] | ForEach-Object { Remove-Item -Force -Recurse "$BinaryCache\$_" -ErrorAction Ignore }
2815-
# In case of a previous test run, clear out the swiftmodules as they are not a stable format.
2816-
Remove-Item -Force -Recurse "$($HostARch.ToolchainInstallRoot)\usr\lib\swift\windows" -ErrorAction Ignore
2817-
foreach ($Arch in $WindowsSDKArchs) {
2818-
0..[TargetComponent].getEnumValues()[-1] | ForEach-Object { Remove-Item -Force -Recurse "$BinaryCache\$($Arch.BuildID + $_)" -ErrorAction Ignore }
2819-
}
2820-
foreach ($Arch in $AndroidSDKArchs) {
2821-
0..[TargetComponent].getEnumValues()[-1] | ForEach-Object { Remove-Item -Force -Recurse "$BinaryCache\$($Arch.BuildID + $_)" -ErrorAction Ignore }
2822-
}
2823-
}
2824-
28252826
if (-not $SkipBuild) {
28262827
foreach ($Arch in $WindowsSDKArchs) {
28272828
Invoke-BuildStep Build-ZLib Windows $Arch

0 commit comments

Comments
 (0)