Skip to content

build: add a -Clean option to build.ps1 #70962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ If set, debug information will be generated for the builds.
.PARAMETER EnableCaching
If true, use `sccache` to cache the build rules.

.PARAMETER Clean
If true, clean non-compiler builds while building.

.PARAMETER Test
An array of names of projects to run tests for.
'*' runs all tests
Expand Down Expand Up @@ -101,6 +104,7 @@ param(
[string[]] $Test = @(),
[string] $Stage = "",
[string] $BuildTo = "",
[switch] $Clean,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to describe this param with .PARAMETER above?

[switch] $DebugInfo,
[switch] $EnableCaching,
[switch] $ToBatch
Expand Down Expand Up @@ -1161,7 +1165,6 @@ function Build-Runtime($Arch) {
SWIFT_NATIVE_SWIFT_TOOLS_PATH = "$BinaryCache\1\bin";
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch";
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = "$SourceCache\swift-experimental-string-processing";
SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE = "$SourceCache\swift-syntax";
CMAKE_SHARED_LINKER_FLAGS = @("/INCREMENTAL:NO", "/OPT:REF", "/OPT:ICF");
}
}
Expand Down Expand Up @@ -1743,6 +1746,13 @@ if (-not $SkipBuild) {
Invoke-BuildStep Build-Compilers $HostArch
}

if ($Clean) {
2..16 | % { Remove-Item -Force -Recurse "$BinaryCache\$_" -ErrorAction Ignore }
foreach ($Arch in $SDKArchs) {
0..3 | % { Remove-Item -Force -Recurse "$BinaryCache\$($Arch.BuildiD + $_)" -ErrorAction Ignore }
}
}

foreach ($Arch in $SDKArchs) {
if (-not $SkipBuild) {
Invoke-BuildStep Build-ZLib $Arch
Expand Down