-
Couldn't load subscription status.
- Fork 10.6k
Add CAS support #84970
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
base: main
Are you sure you want to change the base?
Add CAS support #84970
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,10 @@ param | |
| [ValidatePattern('^\d+(\.\d+)*$')] | ||
| [string] $SCCacheVersion = "0.10.0", | ||
|
|
||
| # Build with CAS | ||
| [switch] $EnableCAS = $false, | ||
| [string] $CASPath = "S:\cas", | ||
|
|
||
| # SBoM Support | ||
| [switch] $IncludeSBoM = $false, | ||
| [string] $SyftVersion = "1.29.1", | ||
|
|
@@ -560,6 +564,10 @@ if (-not $PinnedBuild) { | |
|
|
||
| $PinnedToolchain = [IO.Path]::GetFileNameWithoutExtension($PinnedBuild) | ||
|
|
||
| if ($EnableCAS -and ($UseHostToolchain -or ($PinnedVersion -ne "0.0.0"))) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit. would not it be better to check llvm version instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This intends to check for a swift main-branch build which is currently the only swift build/repo where it currently works and so it's more about the swift version than the LLVM version |
||
| throw "CAS currently requires using a main-branch pinned toolchain." | ||
| } | ||
|
|
||
| $HostPlatform = switch ($HostArchName) { | ||
| "AMD64" { $KnownPlatforms[$HostOS.ToString() + "X64"] } | ||
| "ARM64" { $KnownPlatforms[$HostOS.ToString() + "ARM64"] } | ||
|
|
@@ -1569,6 +1577,14 @@ function Build-CMakeProject { | |
| @("/GS-", "/Gw", "/Gy", "/Oy", "/Oi", "/Zc:inline") | ||
| } | ||
|
|
||
| if ($EnableCAS -and $UsePinnedCompilers.Contains("C")) { | ||
| $CFLAGS += if ($UseGNUDriver) { | ||
| @("-fdepscan=inline", "-fdepscan-include-tree", "-Xclang", "-fcas-path", "-Xclang", $CASPath) | ||
| } else { | ||
| @("/clang:-fdepscan=inline", "/clang:-fdepscan-include-tree", "-Xclang", "-fcas-path", "-Xclang", $CASPath) | ||
| } | ||
| } | ||
|
|
||
| if ($DebugInfo) { | ||
| if ($UsePinnedCompilers.Contains("C") -or $UseBuiltCompilers.Contains("C")) { | ||
| if ($CDebugFormat -eq "dwarf") { | ||
|
|
@@ -1609,6 +1625,14 @@ function Build-CMakeProject { | |
| @("/GS-", "/Gw", "/Gy", "/Oy", "/Oi", "/Zc:inline", "/Zc:__cplusplus") | ||
| } | ||
|
|
||
| if ($EnableCAS -and $UsePinnedCompilers.Contains("CXX")) { | ||
| $CXXFLAGS += if ($UseGNUDriver) { | ||
| @("-fdepscan=inline", "-fdepscan-include-tree", "-Xclang", "-fcas-path", "-Xclang", $CASPath) | ||
| } else { | ||
| @("/clang:-fdepscan=inline", "/clang:-fdepscan-include-tree", "-Xclang", "-fcas-path", "-Xclang", $CASPath) | ||
| } | ||
| } | ||
|
|
||
| if ($DebugInfo) { | ||
| if ($UsePinnedCompilers.Contains("CXX") -or $UseBuiltCompilers.Contains("CXX")) { | ||
| if ($CDebugFormat -eq "dwarf") { | ||
|
|
@@ -2156,6 +2180,12 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch] | |
| $SwiftFlags += @("-use-ld=lld"); | ||
| } | ||
|
|
||
| $CMakeStaticLibPrefixSwiftDefine = if ((Get-PinnedToolchainVersion) -eq "0.0.0") { | ||
| @{ CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; } | ||
| } else { | ||
| @{} | ||
| } | ||
|
|
||
| return $TestDefines + $DebugDefines + @{ | ||
| CLANG_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "clang-tblgen.exe"); | ||
| CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path -Path $BuildTools -ChildPath "clang-tidy-confusable-chars-gen.exe"); | ||
|
|
@@ -2207,7 +2237,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch] | |
| SWIFT_STDLIB_ASSERTIONS = "NO"; | ||
| SWIFTSYNTAX_ENABLE_ASSERTIONS = "NO"; | ||
| "cmark-gfm_DIR" = "$($Platform.ToolchainInstallRoot)\usr\lib\cmake"; | ||
| } | ||
| } + $CMakeStaticLibPrefixSwiftDefine | ||
| } | ||
|
|
||
| function Build-Compilers([Hashtable] $Platform, [string] $Variant) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
ImageRootrather thanS:. The swift.org CI uses a different root (T:).I wonder if we should just make this a required parameter from the user.