diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt
index 552eaf22d9a..3a6a2a6b7c1 100644
--- a/.github/actions/spelling/expect/expect.txt
+++ b/.github/actions/spelling/expect/expect.txt
@@ -738,6 +738,7 @@ HABCDEF
Hackathon
HALTCOND
HANGEUL
+hardlinks
hashalg
HASSTRINGS
hbitmap
@@ -1080,6 +1081,7 @@ MOUSEFIRST
MOUSEHWHEEL
MOVESTART
msb
+msbuildcache
msctf
msctls
msdata
@@ -1489,6 +1491,7 @@ reparented
reparenting
replatformed
Replymessage
+reportfileaccesses
repositorypath
Requiresx
rerasterize
@@ -2005,6 +2008,7 @@ wincontypes
WINCORE
windbg
WINDEF
+windir
windll
WINDOWALPHA
windowdpiapi
diff --git a/.gitignore b/.gitignore
index 3db8546ef4e..9e8281ee5dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -283,3 +283,6 @@ MSG*.bin
profiles.json
*.metaproj
*.swp
+
+# MSBuildCache
+/MSBuildCacheLogs/
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 00000000000..312ae503ed4
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+ false
+
+
+ false
+
+
+ Microsoft.MSBuildCache.AzurePipelines
+ Microsoft.MSBuildCache.Local
+
+
+
+
+ 202310210737
+
+
+
+ $(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);
+ \**\ApplicationInsights.config;
+ $(LocalAppData)\Microsoft\VSApplicationInsights\**;
+ $(LocalAppData)\Microsoft\Windows\INetCache\**;
+ A:\;
+ E:\;
+ $(windir)\**;
+
+
+
+ $(MSBuildCacheIdenticalDuplicateOutputPatterns);bin\**
+
+
+ $(MSBuildThisFileDirectory)\dep\nuget\packages.config
+ $(MSBuildCacheIgnoredInputPatterns);$(PackagesConfigFile)
+
+
+
+ $([System.IO.File]::ReadAllText("$(PackagesConfigFile)"))
+ $([System.Text.RegularExpressions.Regex]::Match($(PackagesConfigContents), 'Microsoft.MSBuildCache.*?version="(.*?)"').Groups[1].Value)
+ $(MSBuildThisFileDirectory)packages\$(MSBuildCachePackageName).$(MSBuildCachePackageVersion)
+ $(MSBuildThisFileDirectory)packages\Microsoft.MSBuildCache.SharedCompilation.$(MSBuildCachePackageVersion)
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 00000000000..df6e6b7ebb1
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/pipelines/ci-caching.yml b/build/pipelines/ci-caching.yml
index 96b79c46999..e8379b556e9 100644
--- a/build/pipelines/ci-caching.yml
+++ b/build/pipelines/ci-caching.yml
@@ -1,30 +1,32 @@
trigger:
batch: true
-# branches:
-# include:
-# - main
-# - feature/*
-# - gh-readonly-queue/*
-# paths:
-# exclude:
-# - doc/*
-# - samples/*
-# - tools/*
+ branches:
+ include:
+ - main
+ - feature/*
+ - gh-readonly-queue/*
+ paths:
+ exclude:
+ - doc/*
+ - samples/*
+ - tools/*
-#pr:
-# branches:
-# include:
-# - main
-# - feature/*
-# paths:
-# exclude:
-# - doc/*
-# - samples/*
-# - tools/*
+pr:
+ branches:
+ include:
+ - main
+ - feature/*
+ paths:
+ exclude:
+ - doc/*
+ - samples/*
+ - tools/*
variables:
- name: runCodesignValidationInjectionBG
value: false
+ - name: EnablePipelineCache
+ value: true
# 0.0.yyMM.dd##
# 0.0.1904.0900
@@ -81,6 +83,8 @@ stages:
buildConfigurations: [Release]
buildEverything: true
keepAllExpensiveBuildOutputs: false
+ ${{ if eq(variables['System.PullRequest.IsFork'], 'False') }}:
+ enableCaching: true
- ${{ if eq(parameters.runTests, true) }}:
- stage: Test_${{ platform }}
diff --git a/build/pipelines/templates-v2/job-build-project.yml b/build/pipelines/templates-v2/job-build-project.yml
index ae5d3a16ac6..ac350da72fd 100644
--- a/build/pipelines/templates-v2/job-build-project.yml
+++ b/build/pipelines/templates-v2/job-build-project.yml
@@ -68,6 +68,9 @@ parameters:
- name: signingIdentity
type: object
default: {}
+ - name: enableCaching
+ type: boolean
+ default: false
jobs:
- job: ${{ parameters.jobName }}
@@ -95,6 +98,7 @@ jobs:
# Yup.
BuildTargetParameter: ' '
SelectedSigningFragments: ' '
+ MSBuildCacheParameters: ' '
# When building the unpackaged distribution, build it in portable mode if it's Canary-branded
${{ if eq(parameters.branding, 'Canary') }}:
UnpackagedBuildArguments: -PortableMode
@@ -111,6 +115,7 @@ jobs:
clean: true
submodules: true
persistCredentials: True
+
# This generates either nothing for BuildTargetParameter, or /t:X;Y;Z, to control targets later.
- pwsh: |-
If (-Not [bool]::Parse("${{ parameters.buildEverything }}")) {
@@ -139,6 +144,17 @@ jobs:
}
displayName: Prepare Build and Sign Targets
+ - ${{ if eq(parameters.enableCaching, true) }}:
+ - pwsh: |-
+ $MSBuildCacheParameters = ""
+ $MSBuildCacheParameters += " -graph"
+ $MSBuildCacheParameters += " -reportfileaccesses"
+ $MSBuildCacheParameters += " -p:MSBuildCacheEnabled=true"
+ $MSBuildCacheParameters += " -p:MSBuildCacheLogDirectory=$(Build.SourcesDirectory)\MSBuildCacheLogs"
+ Write-Host "MSBuildCacheParameters: $MSBuildCacheParameters"
+ Write-Host "##vso[task.setvariable variable=MSBuildCacheParameters]$MSBuildCacheParameters"
+ displayName: Prepare MSBuildCache variables
+
- pwsh: |-
.\build\scripts\Generate-ThirdPartyNotices.ps1 -MarkdownNoticePath .\NOTICE.md -OutputPath .\src\cascadia\CascadiaPackage\NOTICE.html
displayName: Generate NOTICE.html from NOTICE.md
@@ -160,21 +176,37 @@ jobs:
${{ parameters.additionalBuildOptions }}
/bl:$(Build.SourcesDirectory)\msbuild.binlog
$(BuildTargetParameter)
+ $(MSBuildCacheParameters)
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
+ msbuildArchitecture: x64
maximumCpuCount: true
+ ${{ if eq(parameters.enableCaching, true) }}:
+ env:
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken)
- ${{ if eq(parameters.publishArtifacts, true) }}:
- publish: $(Build.SourcesDirectory)/msbuild.binlog
artifact: logs-$(BuildPlatform)-$(BuildConfiguration)${{ parameters.artifactStem }}
condition: always()
displayName: Publish Build Log
+ - ${{ if eq(parameters.enableCaching, true) }}:
+ - publish: $(Build.SourcesDirectory)\MSBuildCacheLogs
+ artifact: logs-msbuildcache-$(BuildPlatform)-$(BuildConfiguration)${{ parameters.artifactStem }}
+ condition: always()
+ displayName: Publish MSBuildCache Logs
- ${{ else }}:
- task: CopyFiles@2
displayName: Copy Build Log
inputs:
contents: $(Build.SourcesDirectory)/msbuild.binlog
TargetFolder: $(Terminal.BinDir)
+ - ${{ if eq(parameters.enableCaching, true) }}:
+ - task: CopyFiles@2
+ displayName: Copy MSBuildCache Logs
+ inputs:
+ contents: $(Build.SourcesDirectory)/MSBuildCacheLogs/**
+ TargetFolder: $(Terminal.BinDir)/MSBuildCacheLogs
# This saves ~2GiB per architecture. We won't need these later.
# Removes:
diff --git a/dep/nuget/packages.config b/dep/nuget/packages.config
index e6fd7ec3a68..a69adb22942 100644
--- a/dep/nuget/packages.config
+++ b/dep/nuget/packages.config
@@ -17,4 +17,9 @@
+
+
+
+
+