Skip to content

Commit 2c02471

Browse files
committed
utils: split Build-LLBuild into Build- and Test- function
Split up the test routines from the build routines. This is motivated by the desire to simplify (remove logic flow) and to help get more accurate timing data.
1 parent e7c8dc6 commit 2c02471

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

utils/build.ps1

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,46 +2579,53 @@ function Build-ToolsSupportCore($Arch) {
25792579
}
25802580
}
25812581

2582-
function Build-LLBuild($Arch, [switch]$Test = $false) {
2582+
function Build-LLBuild($Arch) {
2583+
Build-CMakeProject `
2584+
-Src $SourceCache\llbuild `
2585+
-Bin (Get-ProjectBinaryCache $Arch LLBuild) `
2586+
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
2587+
-Arch $Arch `
2588+
-Platform Windows `
2589+
-UseMSVCCompilers CXX `
2590+
-UseBuiltCompilers Swift `
2591+
-SwiftSDK (Get-SwiftSDK Windows) `
2592+
-Defines @{
2593+
BUILD_SHARED_LIBS = "YES";
2594+
LLBUILD_SUPPORT_BINDINGS = "Swift";
2595+
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.46.0\usr\include";
2596+
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.46.0\usr\lib\SQLite3.lib";
2597+
}
2598+
}
2599+
2600+
function Test-LLBuild {
2601+
# Build additional llvm executables needed by tests
25832602
Invoke-IsolatingEnvVars {
2584-
if ($Test) {
2585-
# Build additional llvm executables needed by tests
2586-
Invoke-IsolatingEnvVars {
2587-
Invoke-VsDevShell $BuildArch
2588-
Invoke-Program ninja.exe -C (Get-ProjectBinaryCache $BuildArch BuildTools) FileCheck not
2589-
}
2603+
Invoke-VsDevShell $BuildArch
2604+
Invoke-Program ninja.exe -C (Get-ProjectBinaryCache $BuildArch BuildTools) FileCheck not
2605+
}
25902606

2591-
$Targets = @("default", "test-llbuild")
2592-
$TestingDefines = @{
2593-
FILECHECK_EXECUTABLE = ([IO.Path]::Combine((Get-ProjectBinaryCache $BuildArch BuildTools), "bin", "FileCheck.exe"));
2594-
LIT_EXECUTABLE = "$SourceCache\llvm-project\llvm\utils\lit\lit.py";
2595-
}
2596-
$env:Path = "$env:Path;$UnixToolsBinDir"
2597-
$env:AR = ([IO.Path]::Combine((Get-ProjectBinaryCache $BuildArch Compilers), "bin", "llvm-ar.exe"))
2598-
$env:CLANG = ([IO.Path]::Combine((Get-ProjectBinaryCache $BuildArch Compilers), "bin", "clang.exe"))
2599-
$InstallPath = ""
2600-
} else {
2601-
$Targets = @()
2602-
$TestingDefines = @{}
2603-
$InstallPath = "$($Arch.ToolchainInstallRoot)\usr"
2604-
}
2607+
Invoke-IsolatingEnvVars {
2608+
$env:Path = "$env:Path;$UnixToolsBinDir"
2609+
$env:AR = ([IO.Path]::Combine((Get-ProjectBinaryCache $BuildArch Compilers), "bin", "llvm-ar.exe"))
2610+
$env:CLANG = ([IO.Path]::Combine((Get-ProjectBinaryCache $BuildArch Compilers), "bin", "clang.exe"))
26052611

26062612
Build-CMakeProject `
26072613
-Src $SourceCache\llbuild `
2608-
-Bin (Get-ProjectBinaryCache $Arch LLBuild) `
2609-
-InstallTo $InstallPath `
2610-
-Arch $Arch `
2614+
-Bin (Get-ProjectBinaryCache $BuildArch LLBuild) `
2615+
-Arch $BuildArch `
26112616
-Platform Windows `
26122617
-UseMSVCCompilers CXX `
26132618
-UseBuiltCompilers Swift `
26142619
-SwiftSDK (Get-SwiftSDK Windows) `
2615-
-BuildTargets $Targets `
2616-
-Defines ($TestingDefines + @{
2620+
-BuildTargets default,test-llbuild `
2621+
-Defines = @{
26172622
BUILD_SHARED_LIBS = "YES";
2623+
FILECHECK_EXECUTABLE = ([IO.Path]::Combine((Get-ProjectBinaryCache $BuildArch BuildTools), "bin", "FileCheck.exe"));
2624+
LIT_EXECUTABLE = "$SourceCache\llvm-project\llvm\utils\lit\lit.py";
26182625
LLBUILD_SUPPORT_BINDINGS = "Swift";
26192626
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.46.0\usr\include";
26202627
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.46.0\usr\lib\SQLite3.lib";
2621-
})
2628+
}
26222629
}
26232630
}
26242631

@@ -3292,7 +3299,7 @@ if (-not $IsCrossCompiling) {
32923299
if ($Test -contains "testing") {
32933300
Build-Testing Windows $HostArch -Test
32943301
}
3295-
if ($Test -contains "llbuild") { Build-LLBuild $HostArch -Test }
3302+
if ($Test -contains "llbuild") { Test-LLBuild }
32963303
if ($Test -contains "swiftpm") { Test-PackageManager }
32973304
if ($Test -contains "swift-format") { Test-Format }
32983305
if ($Test -contains "sourcekit-lsp") { Test-SourceKitLSP }

0 commit comments

Comments
 (0)