parameters:
- name: TimeoutInMinutes
  type: number
  default: '360'
- name: LanguageVersion
  type: string
  default: '17'
- name: ServiceDirectory
  type: string
  default: ''
- name: PackageVersions
  type: string
  default: '.*'
- name: Tests
  type: string
  default: '.*'
- name: Arguments
  type: string
  default: '.*'
- name: Iterations
  type: number
  default: '5'
- name: AdditionalArguments
  type: string
  default: ''
- name: EnvVars
  type: object
  default: {}
- name: Profile
  type: boolean
  default: false

extends:
  template: /eng/common/pipelines/templates/jobs/perf.yml
  parameters:
    TimeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
    Language: Java
    LanguageVersion: ${{ parameters.LanguageVersion }}
    Variables:
    - template: /eng/pipelines/templates/variables/globals.yml
    InstallLanguageSteps:
    - task: JavaToolInstaller@0
      inputs:
        versionSpec: ${{ parameters.LanguageVersion }}
        jdkArchitectureOption: 'x64'
        jdkSourceOption: 'PreInstalled'
      displayName: Install Java ${{ parameters.LanguageVersion }}
    - script: |
        java -version
        mvn --version
      displayName: Print Java Versions
    ServiceDirectory: ${{ parameters.ServiceDirectory }}
    PackageVersions: ${{ parameters.PackageVersions }}
    Tests: ${{ parameters.Tests }}
    Arguments: ${{ parameters.Arguments }}
    Iterations: ${{ parameters.Iterations }}
    AdditionalArguments: ${{ parameters.AdditionalArguments }}
    EnvVars: ${{ parameters.EnvVars }}
    Profile: ${{ parameters.Profile }}
