---
- name: Set xla and other package versions
  ansible.builtin.set_fact:
    openxla_version: "{{ xla_ver.value.openxla_version }}"
    numpy_version: "{{ xla_ver.value.numpy_version }}"
    protobuf_version: "{{ xla_ver.value.protobuf_version }}"
    bazel_version: "{{ xla_ver.value.bazel_version }}"
    image_prefix: "{{ xla_ver.value.image_prefix }}"

- name: Set build dir for OpenXLA {{ openxla_version }}
  ansible.builtin.set_fact:
    xla_build_dir: "{{ build_dir }}/xla-{{ openxla_version }}"

- name: Remove OpenXLA {{ openxla_version }} sources from previous build
  ansible.builtin.file:
    path: "{{ xla_build_dir }}/"
    state: absent

- name: Fetch OpenXLA
  ansible.builtin.include_tasks:
    file: fetch.yml

- name: Build OpenXLA for each Python version
  ansible.builtin.include_tasks:
    file: test.yml
  loop: "{{ xla_ver.value.python_versions }}"
  loop_control:
    loop_var: py_ver
