parameters:
- name: checkoutRepo
  type: string
  default: 'self'
- name: checkoutRef
  type: string
  default: ''
# set to true if doing full build of ROCm stack
# and dependencies are pulled from same pipeline
- name: aggregatePipeline
  type: boolean
  default: false
- name: aptPackages
  type: object
  default:
    - cmake
    - python3-pip
    - ninja-build
    - pkg-config
    - git
- name: rocmDependencies
  type: object
  default:
    - llvm-project

jobs:
- job: aomp_extras
  variables:
  - group: common
  - template: /.azuredevops/variables-global.yml
  pool:
    vmImage: ${{ variables.BASE_BUILD_POOL }}
  workspace:
    clean: all
  steps:
  - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/dependencies-other.yml
    parameters:
      aptPackages: ${{ parameters.aptPackages }}
  - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/preamble.yml
  - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/checkout.yml
    parameters:
      checkoutRepo: ${{ parameters.checkoutRepo }}
  - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/dependencies-rocm.yml
    parameters:
      checkoutRef: ${{ parameters.checkoutRef }}
      dependencyList: ${{ parameters.rocmDependencies }}
      aggregatePipeline: ${{ parameters.aggregatePipeline }}
  - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/build-cmake.yml
    parameters:
      componentName: aomp-extras
      extraBuildFlags: >-
        -DLLVM_DIR=$(Agent.BuildDirectory)/rocm/llvm
        -DCMAKE_BUILD_TYPE=Release
        -DAOMP_STANDALONE_BUILD=0
        -DAOMP_VERSION_STRING=$(LATEST_RELEASE_TAG)
        -GNinja
      installDir: $(Build.BinariesDirectory)/llvm
  - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/manifest.yml
  - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/artifact-upload.yml
  - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/artifact-links.yml
  # - template: ${{ variables.CI_TEMPLATE_PATH }}/steps/docker-container.yml
  #   parameters:
  #     aptPackages: ${{ parameters.aptPackages }}
