# Learn more: https://aka.ms/yaml

variables:
  DMD_BRANCH: $[ coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranchName'], 'master') ]

jobs:
  - job: Windows
    timeoutInMinutes: 120
    pool:
      vmImage: 'vs2017-win2016'
    variables:
      VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
      HOST_DMD_VERSION: 2.084.1
    strategy:
      matrix:
        x64:
          OS: Win_64
          MODEL: 64
          ARCH: x64
          D_COMPILER: dmd
    steps:
      - script: set
        displayName: environment
      - script: systeminfo
        displayName: systeminfo
      - task: CopyFiles@2
        inputs:
          sourceFolder: '$(Build.SourcesDirectory)'
          contents: '**/*'
          TargetFolder: '$(Build.SourcesDirectory)/../phobos'
      - script: git clone --branch $(DMD_BRANCH) https://github.com/dlang/dmd.git ../dmd
      - script: |
          call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
          cd ../dmd && sh --login .azure-pipelines/windows.sh
        displayName: Build DMD

  - job: Windows_OMF
    timeoutInMinutes: 120
    pool:
      vmImage: 'vs2017-win2016'
    variables:
      VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
      HOST_DMD_VERSION: LATEST
    strategy:
      matrix:
        x86:
          OS: Win_32
          MODEL: 32
          ARCH: x86
          D_COMPILER: dmd
    steps:
      - script: set
        displayName: environment
      - script: systeminfo
        displayName: systeminfo
      - task: CopyFiles@2
        inputs:
          sourceFolder: '$(Build.SourcesDirectory)'
          contents: '**/*'
          TargetFolder: '$(Build.SourcesDirectory)/../phobos'
      - script: git clone --branch $(DMD_BRANCH) https://github.com/dlang/dmd.git ../dmd
      - script: cd ../dmd && sh --login .azure-pipelines/windows.sh

  - job: Windows_VisualD
    timeoutInMinutes: 120
    pool:
      vmImage: 'vs2017-win2016'
    variables:
      VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
    strategy:
      matrix:
        win32-ldc:
          OS: Win_32
          MODEL: 32
          ARCH: x86
          D_COMPILER: ldc
          VISUALD_VER: v0.49.0
          LDC_VERSION: 1.14.0
    steps:
      - script: set
        displayName: environment
      - script: systeminfo
        displayName: systeminfo
      - task: CopyFiles@2
        inputs:
          sourceFolder: '$(Build.SourcesDirectory)'
          contents: '**/*'
          TargetFolder: '$(Build.SourcesDirectory)/../phobos'
      - script: git clone --branch $(DMD_BRANCH) https://github.com/dlang/dmd.git ../dmd
      - script: cd ../dmd && sh --login .azure-pipelines/windows-visual-studio.sh
      - script: cd ../dmd && call .azure-pipelines\windows-msbuild.bat
