onnxruntime/tools/ci_build/github/azure-pipelines/templates/mac-build-step-with-cache.yml
Edward Chen 6d46007028
Add explicit 'set +x' before printing a vso[] command to avoid output getting parsed again with a trailing quote. (#15986)
Here's the motivating issue:
https://github.com/microsoft/azure-pipelines-tasks/issues/10331

Noticed some problems in other repos so also updating usages in ORT.

We may be fine now without it, but this change adds some safeguard against future additions of 'set -x' for debugging.
2023-05-17 19:30:28 -07:00

62 lines
1.8 KiB
YAML

# It's used for compilation with cache in Mac Host.
parameters:
- name: WithCache
displayName: Build with Cache
type: boolean
default: false
- name: BuildStep
type: stepList
# if WithCahe is false, the following parameters are not used.
- name: Today
type: string
default: ""
- name: AdditionalKey
type: string
default: ""
- name: CacheDir
type: string
default: ""
- name: ChangeEveryCommit
type: boolean
default: true
steps:
- script: |
which ccache || brew install ccache
# Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote.
set +x
echo "##vso[task.prependpath]/usr/local/opt/ccache/libexec"
mkdir -p "${{ parameters.CacheDir }}"
displayName: Install ccache and update PATH to use linked versions of gcc, cc, etc
condition: eq(${{ parameters.WithCache }}, true)
- task: Cache@2
inputs:
${{ if eq(parameters.ChangeEveryCommit, true) }}:
# If it's a merge build, the run will read the cache generated by main build.
${{if eq(variables['Build.SourceBranchName'], 'merge')}}:
key: ' "$(TODAY)" | ccache | merge '
${{else}}:
key: ' "${{parameters.Today}}" | ${{parameters.AdditionalKey}} | "$(Build.SourceVersion)" '
restoreKeys: |
"${{parameters.Today}}" | ${{parameters.AdditionalKey}}
${{ else }}:
key: ' ${{parameters.AdditionalKey}} '
restoreKeys: |
${{parameters.AdditionalKey}}
path: ${{ parameters.CacheDir }}
displayName: ccache task
condition: eq(${{ parameters.WithCache }}, true)
- ${{ parameters.BuildStep }}
- ${{ if eq(parameters.WithCache, true) }}:
- template: check-cache-stats.yml
parameters:
CacheDir: ${{ parameters.CacheDir }}