version: 2
accept_configuration:
  condition: or
  conditions:
    - condition: property
      property: features
      contains_value: LicenseCheck
    - condition: and
      conditions:
        - condition: property  # No cross compilation
          property: host.os
          equals_property: target.os
        - condition: property
          property: features
          contains_value: Packaging
        - condition: property
          property: features
          not_contains_value: UseLegacyInstructions
        - condition: property  # MinGW and msvc2015 are not supported
          property: target.compiler
          not_in_values: [Mingw, MSVC2015,Clang]
        - condition: property  # Webassembly
          property: target.osVersion
          not_in_values: [WebAssembly, RHEL_8_10]
        - condition: property  # Windows on Arm
          property: target.arch
          not_equals_value: ARM64
        - condition: property
          property: features
          not_contains_value: DebianPackaging
        - condition: property
          property: target.osVersion
          not_equals_value: VxWorks
        - condition: property
          property: host.osVersion
          not_equals_value: Windows_11_22H2
    - condition: and
      conditions:
        - condition: property
          property: host.os
          equals_value: MacOS
        - condition: property
          property: features
          contains_value: TestOnly
        - condition: property
          property: features
          contains_value: Packaging
        - condition: property
          property: target.os
          not_contains_value: Android
        - condition: property
          property: target.os
          not_contains_value: IOS
        - condition: property
          property: host.osVersion
          not_equals_value: MacOS_12
    - condition: and # Restore LoA config
      conditions:
        - condition: property
          property: host.os
          equals_value: Linux
        - condition: property
          property: host.arch
          equals_value: AARCH64
        - condition: property
          property: target.arch
          equals_value: AARCH64
        - condition: property
          property: features
          contains_value: Packaging
    - condition: and
      conditions:
        - condition: property
          property: target.os
          equals_value: Android
        - condition: property
          property: features
          contains_value: Packaging
    - condition: and
      conditions:
        - condition: property
          property: target.os
          equals_value: MacOS
        - condition: property
          property: features
          contains_value: Packaging
        - condition: property
          property: target.arch
          equals_value: X86_64-ARM64
    - condition: and
      conditions:
        - condition: property
          property: target.os
          equals_value: Windows
        - condition: property
          property: features
          contains_value: Packaging
        - condition: property
          property: target.arch
          equals_value: X86_64
        - condition: property
          property: target.compiler
          equals_value: Mingw
machine_type:
  Build:
    cores: 8

upload_pyside: &upload_pyside
     type: Group
     instructions:
       - type: UploadArtifact
         archiveDirectory: "{{.AgentWorkingDir}}\\pyside"
         transferType: UploadModuleBuildArtifact
         maxTimeInSeconds: 1200
         maxTimeBetweenOutput: 1200
         enable_if:
           condition: property
           property: host.os
           equals_value: Windows
       - type: UploadArtifact
         archiveDirectory: "{{.AgentWorkingDir}}/pyside"
         transferType: UploadModuleBuildArtifact
         maxTimeInSeconds: 1200
         maxTimeBetweenOutput: 1200
         enable_if:
           condition: property
           property: host.os
           not_equals_value: Windows

instructions:
     LicenseCheck:
      - !include "{{qt/qtbase}}/run_license_check.yaml"
     Build:
      - !include "{{pyside/pyside-setup}}/common_environment.yaml"
      - !include "{{pyside/pyside-setup}}/find_path_to_msvc_compiler.yaml"
      - !include "{{pyside/pyside-setup}}/execute_build_instructions.yaml"
      - *upload_pyside
     Test:
      - !include "{{pyside/pyside-setup}}/common_environment.yaml"
      - !include "{{pyside/pyside-setup}}/find_path_to_msvc_compiler.yaml"
      - !include "{{pyside/pyside-setup}}/relocate_pyside.yaml"
      - !include "{{pyside/pyside-setup}}/execute_test_instructions.yaml"
