parameters:
  - name: buildConfigurations
    type: object
  - name: buildPlatforms
    type: object
  - name: artifactStem
    type: string
    default: ''

steps:
- ${{ each configuration in parameters.buildConfigurations }}:
  - ${{ each platform in parameters.buildPlatforms }}:
    - task: DownloadPipelineArtifact@2
      displayName: Download artifacts for ${{ platform }} ${{ configuration }}
      inputs:
        # Make sure to download the entire artifact, because it includes the SPDX SBOM
        artifactName: build-${{ platform }}-${{ configuration }}${{ parameters.artifactStem }}
        # Downloading to the source directory should ensure that the later SBOM generator can see the earlier SBOMs.
        ${{ if eq(platform, 'x86') }}:
          downloadPath: '$(Build.SourcesDirectory)/bin/Win32/${{ configuration }}'
        ${{ elseif eq(platform, 'Any CPU') }}:
          downloadPath: '$(Build.SourcesDirectory)/bin/AnyCPU/${{ configuration }}'
        ${{ else }}:
          downloadPath: '$(Build.SourcesDirectory)/bin/${{ platform }}/${{ configuration }}'
