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
18 changes: 18 additions & 0 deletions eng/pipelines/coreclr/templates/sccache-stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
parameters:
archType: 'x64'
osGroup: 'linux'
buildConfig: ''
runtimeFlavor: ''
runtimeVariant: ''
helixQueues: ''
targetRid: ''
nameSuffix: ''
platform: ''
shouldContinueOnError: false
osSubgroup: ''

steps:
- ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, ''), eq(parameters.archType, 'x64')) }}:
- script: sccache --show-stats || true
displayName: Sccache stats
condition: always()
40 changes: 40 additions & 0 deletions eng/pipelines/coreclr/templates/setup-sccache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
parameters:
archType: 'x64'
osGroup: 'linux'
buildConfig: ''
runtimeFlavor: ''
runtimeVariant: ''
helixQueues: ''
targetRid: ''
nameSuffix: ''
platform: ''
shouldContinueOnError: false
osSubgroup: ''

# sccache NuGet package version — keep in sync with runtime-prereqs.proj
sccacheVersion: '0.15.0'

steps:
- ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, ''), eq(parameters.archType, 'x64')) }}:
# 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.
- task: Cache@2
displayName: Sccache cache
inputs:
key: sccache | ${{ parameters.osGroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | ${{ parameters.buildConfig }} | "$(Build.BuildId)"
path: $(Pipeline.Workspace)/.sccache
restoreKeys: |
sccache | ${{ parameters.osGroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | ${{ parameters.buildConfig }}
Comment thread
agocke marked this conversation as resolved.

# Configure sccache environment and add binary to PATH.
# The sccache package is restored by runtime-prereqs.proj during the build.
- script: |
sccacheVersion="${{ parameters.sccacheVersion }}"
sccacheDir="$(Build.SourcesDirectory)/.packages/sccache/${sccacheVersion}/tools"
mkdir -p "$sccacheDir"
echo "##vso[task.prependpath]$sccacheDir"
Comment thread
agocke marked this conversation as resolved.
echo "##vso[task.setvariable variable=SCCACHE_DIR]$(Pipeline.Workspace)/.sccache"
echo "##vso[task.setvariable variable=SCCACHE_IDLE_TIMEOUT]0"
echo "##vso[task.setvariable variable=USE_SCCACHE]true"
displayName: Configure sccache
6 changes: 6 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ extends:
nameSuffix: CoreCLR_Libraries
buildArgs: -s clr+libs+libs.tests -rc Release -c $(_BuildConfig) /p:ArchiveTests=true
timeoutInMinutes: 120
preBuildSteps:
- template: /eng/pipelines/coreclr/templates/setup-sccache.yml
postBuildSteps:
- template: /eng/pipelines/coreclr/templates/sccache-stats.yml
Comment thread
agocke marked this conversation as resolved.
- template: /eng/pipelines/common/upload-artifact-step.yml
Comment thread
agocke marked this conversation as resolved.
parameters:
rootFolder: $(Build.SourcesDirectory)/artifacts/bin
Expand Down Expand Up @@ -399,7 +402,10 @@ extends:
nameSuffix: Libraries_CheckedCoreCLR
buildArgs: -s clr+clr.wasmjit+libs -c $(_BuildConfig) -rc Checked
timeoutInMinutes: 120
preBuildSteps:
- template: /eng/pipelines/coreclr/templates/setup-sccache.yml
postBuildSteps:
- template: /eng/pipelines/coreclr/templates/sccache-stats.yml
- template: /eng/pipelines/coreclr/templates/build-native-test-assets-step.yml
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/build-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ if [[ "$__TargetArch" != "$__HostArch" ]]; then
fi

if [[ "$USE_SCCACHE" == "true" ]]; then
# NuGet strips execute permissions; restore them using the known package path.
# Try the CI-local packages dir first, then fall back to the global NuGet cache.
for sccacheBin in "$__RepoRootDir/.packages/sccache"/*/tools/sccache "$HOME/.nuget/packages/sccache"/*/tools/sccache; do
if [[ -f "$sccacheBin" ]]; then
chmod +x "$sccacheBin"
fi
done
__CMakeArgs="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache $__CMakeArgs"
fi

Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/runtime-prereqs.proj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<AssemblyName>.NET Runtime</AssemblyName>
</PropertyGroup>

<ItemGroup Condition="$([MSBuild]::IsOsPlatform(Linux)) and '$(ContinuousIntegrationBuild)' == 'true'">
Comment thread
agocke marked this conversation as resolved.
Comment thread
agocke marked this conversation as resolved.
Comment thread
agocke marked this conversation as resolved.
<PackageDownload Include="sccache" Version="[0.15.0]" />
</ItemGroup>

<Import Project="$(RepositoryEngineeringDir)versioning.targets" />
<Import Project="$(RepositoryEngineeringDir)nativepgo.targets" />

Expand Down
Loading