Skip to content

Commit 1a21d16

Browse files
Hoist CompilersBinaryCache variable to global scope
1 parent d922df0 commit 1a21d16

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

utils/build.ps1

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,13 @@ function Get-PinnedToolchainVersion() {
857857
throw "PinnedVersion must be set"
858858
}
859859

860+
$DriverBinaryCache = Get-HostProjectBinaryCache Driver
861+
$CompilersBinaryCache = if ($IsCrossCompiling) {
862+
Get-BuildProjectBinaryCache Compilers
863+
} else {
864+
Get-HostProjectBinaryCache Compilers
865+
}
866+
860867
function Get-ClangDriverName([Platform] $Platform, [string] $Lang) {
861868
switch ($Platform) {
862869
Windows {
@@ -941,13 +948,6 @@ function Build-CMakeProject {
941948
Invoke-VsDevShell $Arch
942949
}
943950

944-
$CompilersBinaryCache = if ($IsCrossCompiling) {
945-
Get-BuildProjectBinaryCache Compilers
946-
} else {
947-
Get-HostProjectBinaryCache Compilers
948-
}
949-
$DriverBinaryCache = Get-HostProjectBinaryCache Driver
950-
951951
if ($EnableCaching) {
952952
$env:SCCACHE_DIRECT = "true"
953953
if ($Cache -eq "") {
@@ -1469,11 +1469,6 @@ function Build-Compilers() {
14691469
)
14701470

14711471
Isolate-EnvVars {
1472-
$CompilersBinaryCache = if ($Build) {
1473-
Get-BuildProjectBinaryCache Compilers
1474-
} else {
1475-
Get-HostProjectBinaryCache Compilers
1476-
}
14771472
$BuildTools = Join-Path -Path (Get-BuildProjectBinaryCache BuildTools) -ChildPath bin
14781473

14791474
if ($TestClang -or $TestLLD -or $TestLLDB -or $TestLLVM -or $TestSwift) {
@@ -1830,12 +1825,6 @@ function Build-Runtime([Platform]$Platform, $Arch) {
18301825
Isolate-EnvVars {
18311826
$env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
18321827

1833-
$CompilersBinaryCache = if ($IsCrossCompiling) {
1834-
Get-BuildProjectBinaryCache Compilers
1835-
} else {
1836-
Get-HostProjectBinaryCache Compilers
1837-
}
1838-
18391828
Build-CMakeProject `
18401829
-Src $SourceCache\swift `
18411830
-Bin (Get-TargetProjectBinaryCache $Arch Runtime) `

0 commit comments

Comments
 (0)