# download and install non-rocm dependencies through apt and pip
parameters:
- name: aptPackages
  type: object
  default: []
- name: pipModules
  type: object
  default: []
- name: registerROCmPackages
  type: boolean
  default: false
- name: packageManager
  type: string
  default: apt

steps:
- ${{ if eq(parameters.packageManager, 'apt') }}:
  - template: dependencies-apt.yml
    parameters:
      aptPackages: ${{ parameters.aptPackages }}
      registerROCmPackages: ${{ parameters.registerROCmPackages }}
- ${{ if eq(parameters.packageManager, 'dnf') }}:
  - template: dependencies-dnf.yml
    parameters:
      aptPackages: ${{ parameters.aptPackages }}
      registerROCmPackages: ${{ parameters.registerROCmPackages }}
- ${{ if gt(length(parameters.pipModules), 0) }}:
  - task: Bash@3
    displayName: 'pip install  ...'
    retryCountOnTaskFailure: 3
    inputs:
      targetType: inline
      script: python3 -m pip install -v --force-reinstall ${{ join(' ', parameters.pipModules) }}
