Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<!-- Propagate the configuration and platform to project references. When building in VS, this defaults to true.
Explicitly setting it to false ensures projects are built in the corresponding configuration both in VS and on the command line. -->
<ShouldUnsetParentConfigurationAndPlatform>false</ShouldUnsetParentConfigurationAndPlatform>
<EnableSourceLink Condition="'$(ROSLYN_CACHE_PATH)' != ''">false</EnableSourceLink>
</PropertyGroup>

<!-- We don't have RepoRoot or RepositoryEngineeringDir available at this point -->
Expand Down
24 changes: 24 additions & 0 deletions eng/pipelines/coreclr/templates/roslyn-cache-stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
steps:
- script: |
set -euo pipefail

dotnet="$(Build.SourcesDirectory)/.dotnet/dotnet"
if [[ -z "${ROSLYN_CACHE_PATH:-}" ||
-z "${ROSLYN_CACHE_BUILD_START:-}" ||
! -x "$dotnet" ]]; then
echo "Roslyn compiler cache statistics are unavailable."
exit 0
fi

sdkVersion="$("$dotnet" --version)"
compilerServer="$(Build.SourcesDirectory)/.dotnet/sdk/$sdkVersion/Roslyn/bincore/VBCSCompiler.dll"
if [[ ! -f "$compilerServer" ]]; then
echo "Roslyn compiler server not found at $compilerServer."
exit 0
fi

"$dotnet" "$compilerServer" \
"-cachestats:${ROSLYN_CACHE_BUILD_START}" \
"-cachepath:${ROSLYN_CACHE_PATH}" || true
Comment thread
agocke marked this conversation as resolved.
displayName: Roslyn compiler cache stats
condition: always()
2 changes: 2 additions & 0 deletions eng/pipelines/coreclr/templates/sccache-stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ parameters:

steps:
- ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}:
- template: /eng/pipelines/coreclr/templates/roslyn-cache-stats.yml

- script: sccache --show-stats || true
displayName: Sccache stats
condition: always()
28 changes: 28 additions & 0 deletions eng/pipelines/coreclr/templates/setup-roslyn-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
parameters:
archType: 'x64'
osGroup: 'linux'
nameSuffix: ''
osSubgroup: ''

steps:
# Cache entries restored by pull request builds come only from the pull
# request itself or its target branch. This lets rolling builds seed the
# cache without allowing pull requests to modify caches used by main.
#
# The managed configuration is intentionally excluded. Roslyn's
# deterministic key includes the compilation options, and some pipeline
# legs override the matrix configuration in their build arguments.
- task: Cache@2
displayName: Roslyn compiler cache
continueOnError: true
inputs:
key: roslyn | v1 | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | "$(Build.BuildId)"
path: $(Pipeline.Workspace)/.roslyn-cache
restoreKeys: |
roslyn | v1 | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }}
Comment thread
agocke marked this conversation as resolved.

- script: |
set -euo pipefail
echo "##vso[task.setvariable variable=ROSLYN_CACHE_PATH]$(Pipeline.Workspace)/.roslyn-cache"
echo "##vso[task.setvariable variable=ROSLYN_CACHE_BUILD_START]$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
displayName: Configure Roslyn compiler cache
7 changes: 7 additions & 0 deletions eng/pipelines/coreclr/templates/setup-sccache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ parameters:

steps:
- ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}:
- template: /eng/pipelines/coreclr/templates/setup-roslyn-cache.yml
Comment thread
agocke marked this conversation as resolved.
parameters:
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
archType: ${{ parameters.archType }}
nameSuffix: ${{ parameters.nameSuffix }}

# Set up the Azure Pipeline Cache for sccache's local cache directory.
# Use a rolling key so each build can update the cache; restoreKeys
# falls back to the most recent saved entry.
Expand Down
Loading