type: Group
instructions:
    - type: EnvironmentVariable
      variableName: QTEST_ENVIRONMENT
      variableValue: "ci"
    - type: EnvironmentVariable
      variableName: PYSIDE_VIRTUALENV
      variableValue: "{{.AgentWorkingDir}}\\pyside\\tqtc-pyside-setup\\env"
      enable_if:
          condition: property
          property: host.os
          equals_value: Windows
    - type: EnvironmentVariable
      variableName: PYSIDE_VIRTUALENV
      variableValue: "{{.AgentWorkingDir}}/pyside/tqtc-pyside-setup/env"
      enable_if:
        condition: or
        conditions:
          - condition: property
            property: host.os
            equals_value: MacOS
          - condition: property
            property: host.os
            equals_value: Linux
    - type: EnvironmentVariable
      variableName: TARGET_ARCHITECTURE
      variableValue: amd64
      enable_if:
        condition: and
        conditions:
          - condition: property
            property: target.arch
            equals_value: X86_64
          - condition: property
            property: host.os
            equals_value: Windows
    - type: EnvironmentVariable
      variableName: TARGET_ARCHITECTURE
      variableValue: amd64_x86
      enable_if:
        condition: and
        conditions:
          - condition: property
            property: target.arch
            equals_value: X86
          - condition: property
            property: host.os
            equals_value: Windows
    - type: EnvironmentVariable
      variableName: CI_TARGET_ARCHITECTURE
      variableValue: X86_64
      enable_if:
          condition: property
          property: target.arch
          equals_value: X86_64
    - type: EnvironmentVariable
      variableName: CI_TARGET_ARCHITECTURE
      variableValue: X86
      enable_if:
          condition: property
          property: target.arch
          equals_value: X86
    - type: EnvironmentVariable
      variableName: CI_PACKAGING_FEATURE
      variableValue: "--packaging"
      enable_if:
          condition: property
          property: features
          contains_value: Packaging
    - type: EnvironmentVariable
      variableName: CI_USE_SCCACHE
      variableValue: "--compiler-launcher=sccache"
      enable_if:
          condition: property
          property: features
          contains_value: Sccache
    - type: EnvironmentVariable
      variableName: CI_OS
      variableValue: "MacOS"
      enable_if:
          condition: property
          property: host.os
          equals_value: MacOS
    - type: EnvironmentVariable
      variableName: CI_OS
      variableValue: "Linux"
      enable_if:
          condition: property
          property: host.os
          equals_value: Linux
    - type: EnvironmentVariable
      variableName: CI_OS
      variableValue: "Windows"
      enable_if:
          condition: property
          property: host.os
          equals_value: Windows
    - type: EnvironmentVariable
      variableName: MAKEFLAGS
      variableValue: ""
      enable_if:
         condition: property
         property: host.os
         equals_value: Windows
    - type: AppendToEnvironmentVariable
      variableName: PATH
      variableValue: ;%CI_JOM_PATH%
      enable_if:
         condition: property
         property: host.os
         equals_value: Windows
    - type: PrependToEnvironmentVariable
      variableName: PATH
      variableValue: "{{.Env.PYTHON3_PATH}}/bin:"
      enable_if:
         condition: property
         property: host.os
         equals_value: MacOS
    - type: PrependToEnvironmentVariable
      variableName: PATH
      variableValue: "{{.Env.PYTHON3_PATH}};"
      enable_if:
         condition: property
         property: host.os
         equals_value: Windows
    - type: PrependToEnvironmentVariable
      variableName: PATH
      variableValue: "/Users/qt/.local/bin/:"
      enable_if:
         condition: property
         property: host.osVersion
         equals_value: MacOS_11_00
    - type: PrependToEnvironmentVariable
      variableName: PATH
      variableValue: "/Users/qt/work/install/bin:"
      enable_if:
         condition: property
         property: host.os
         equals_value: MacOS
    - type: PrependToEnvironmentVariable
      variableName: PATH
      variableValue: "/home/qt/work/install/bin:"
      enable_if:
         condition: property
         property: host.os
         equals_value: Linux
    - type: PrependToEnvironmentVariable
      variableName: PATH
      variableValue: "\\Users\\qt\\work\\install\\bin;"
      enable_if:
         condition: property
         property: host.os
         equals_value: Windows
    - type: EnvironmentVariable
      variableName: ICC64_18_LDLP
      variableValue: /opt/intel/lib/intel64
      enable_if:
         condition: property
         property: target.compiler
         equals_value: ICC_18
    - type: EnvironmentVariable
      variableName: ICC64_18_PATH # Seems a bit hard to maintain
      variableValue: /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64:/opt/intel/bin
      enable_if:
         condition: property
         property: target.compiler
         equals_value: ICC_18
    - type: AppendToEnvironmentVariable
      variableName: LD_LIBRARY_PATH
      variableValue: :/opt/intel/lib/intel64
      enable_if:
         condition: property
         property: target.compiler
         equals_value: ICC_18
    - type: AppendToEnvironmentVariable
      variableName: PATH
      variableValue: ":{{.Env.ICC64_18_PATH}}"
      enable_if:
         condition: property
         property: target.compiler
         equals_value: ICC_18
    - type: EnvironmentVariable
      variableName: LLVM_INSTALL_DIR
      variableValue: "{{.Env.LLVM_DYNAMIC_LIBS_100}}"
      disable_if:
        condition: and
        conditions:
          - condition: property
            property: target.arch
            equals_value: X86_64-ARM64 # When target arch is universal binary, we can use the default libclang
          - condition: property
            property: host.os
            equals_value: MacOS
    - type: ExecuteCommand
      command: "sudo apt-get install python3-pip libclang-11-dev clang -y"
      maxTimeInSeconds: 14400
      maxTimeBetweenOutput: 1200
      enable_if:
          condition: and
          conditions:
            - condition: property
              property: host.os
              equals_value: Linux
            - condition: property
              property: host.arch
              equals_value: AARCH64
      userMessageOnFailure: >
          Failed to install dependencies
    - type: ExecuteCommand
      command: "python3 -m pip install -U setuptools==67.7.2"
      maxTimeInSeconds: 14400
      maxTimeBetweenOutput: 1200
      enable_if:
          condition: and
          conditions:
            - condition: property
              property: host.os
              equals_value: Linux
            - condition: property
              property: host.arch
              equals_value: AARCH64
      userMessageOnFailure: >
          Failed to install setuptools
    - type: EnvironmentVariable
      variableName: LLVM_INSTALL_DIR
      variableValue: "/usr/lib/llvm-11/lib"
      enable_if:
        condition: and
        conditions:
          - condition: property
            property: target.arch
            equals_value: AARCH64
          - condition: property
            property: host.os
            equals_value: Linux
    - type: EnvironmentVariable
      variableName: interpreter
      variableValue: "python3.11"
      enable_if:
         condition: property
         property: host.osVersion
         in_values: [ RHEL_8_4, RHEL_8_8]
    - type: EnvironmentVariable
      variableName: interpreter
      variableValue: "python3"
      enable_if: # Enable for others than rhl 8.*
        condition: property
        property: target.osVersion
        not_in_values: [ RHEL_8_4, RHEL_8_6, RHEL_8_8]
