Skip to content

Commit c0c9116

Browse files
committed
Remove cache configuration from EanbleCaching
EnableCaching should only configure cmake to allow for sccache usage, it should not configure sccache itself in any way. Those configuration options should be deferred into the environment variables that sccache will look for when it starts up.
1 parent 09664ee commit c0c9116

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

utils/build.ps1

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,8 @@ If set, skips building the msi's and installer
8080
If set, debug information will be generated for the builds.
8181
8282
.PARAMETER EnableCaching
83-
If true, use `sccache` to cache the build rules.
84-
85-
.PARAMETER Cache
86-
The path to a directory where the `sccache` stores the cache. By default, it will point to `$BinaryCache\sccache`.
87-
88-
.PARAMETER EnableRemoteCaching
89-
If true, use `sccache` to cache the build rules remotely. If set, ensure that you configure the appropriate
90-
remote caching backend location and credentials environment variables for sccache.
83+
If true, use `sccache` to cache the build rules. Configuration of sccache must be done through
84+
the environment variables defined by the sccache project.
9185
9286
.PARAMETER Clean
9387
If true, clean non-compiler builds while building.
@@ -171,14 +165,9 @@ param
171165
[string] $Variant = "Asserts",
172166
[switch] $Clean,
173167
[switch] $DebugInfo,
174-
[parameter(ParameterSetName = "LocalCaching")]
175168
[switch] $EnableCaching,
176-
[parameter(ParameterSetName = "RemoteCaching")]
177-
[switch] $EnableRemoteCaching,
178169
[ValidateSet("debug", "release")]
179170
[string] $FoundationTestConfiguration = "debug",
180-
[parameter(ParameterSetName = "LocalCaching")]
181-
[string] $Cache = "",
182171
[switch] $Summary,
183172
[switch] $ToBatch
184173
)
@@ -1211,11 +1200,6 @@ function Build-CMakeProject {
12111200
Invoke-VsDevShell $Platform
12121201
}
12131202

1214-
if ($EnableCaching) {
1215-
$env:SCCACHE_DIRECT = "true"
1216-
$env:SCCACHE_DIR = "$(if ($Cache) { $Cache } else { "$BinaryCache\sccache" })"
1217-
}
1218-
12191203
# Add additional defines (unless already present)
12201204
$Defines = $Defines.Clone()
12211205

@@ -1298,14 +1282,14 @@ function Build-CMakeProject {
12981282

12991283
if ($UseMSVCCompilers.Contains("C")) {
13001284
Add-KeyValueIfNew $Defines CMAKE_C_COMPILER cl
1301-
if ($EnableCaching -or $EnableRemoteCaching) {
1285+
if ($EnableCaching) {
13021286
Add-KeyValueIfNew $Defines CMAKE_C_COMPILER_LAUNCHER sccache
13031287
}
13041288
Add-FlagsDefine $Defines CMAKE_C_FLAGS $CFlags
13051289
}
13061290
if ($UseMSVCCompilers.Contains("CXX")) {
13071291
Add-KeyValueIfNew $Defines CMAKE_CXX_COMPILER cl
1308-
if ($EnableCaching -or $EnableRemoteCaching) {
1292+
if ($EnableCaching) {
13091293
Add-KeyValueIfNew $Defines CMAKE_CXX_COMPILER_LAUNCHER sccache
13101294
}
13111295
Add-FlagsDefine $Defines CMAKE_CXX_FLAGS $CXXFlags
@@ -3163,7 +3147,7 @@ if ($Clean) {
31633147
}
31643148

31653149
if (-not $SkipBuild) {
3166-
if ($EnableCaching -or $EnableRemoteCaching) -And (-Not (Test-SCCacheAtLeast -Major 0 -Minor 7 -Patch 4))) {
3150+
if ($EnableCaching -And (-Not (Test-SCCacheAtLeast -Major 0 -Minor 7 -Patch 4))) {
31673151
throw "Minimum required sccache version is 0.7.4"
31683152
}
31693153

0 commit comments

Comments
 (0)