---
- name: Set version variables
  ansible.builtin.set_fact:
    tensorflow_io_version: "{{ tfio_ver.value.tensorflow_io_version }}"
    tensorflow_version: "{{ tfio_ver.value.tensorflow_version }}"
    image_prefix: "{{ tfio_ver.value.image_prefix }}"

- name: Set git version variables
  ansible.builtin.set_fact:
    tensorflow_io_git_version: "{{ tfio_ver.value.tensorflow_io_git_version }}"
  when: tensorflow_io_version == 'git'

- name: Remove TensorFlow IO {{ tensorflow_io_version }} sources from previous build
  ansible.builtin.file:
    path: "{{ build_dir }}/io-{{ tensorflow_io_version }}/"
    state: absent

- name: Fetch and unpack TensorFlow IO source archive
  ansible.builtin.include_tasks:
    file: fetch.yml

- name: Copy upper constraints
  ansible.builtin.template:
    src: "files/upper-constraints.txt"
    dest: "{{ wheels_dir }}/upper-constraints.txt"
    mode: 0644
    force: true

- name: Set py_ver to version needed for binary build - {{ tfio_ver.value.build_py_ver }}
  ansible.builtin.set_fact:
    py_ver: "{{ tfio_ver.value.build_py_ver }}"

- name: Run TensorFlow IO build in manylinux2014 container
  ansible.builtin.include_tasks:
    file: gcc4-abi-build.yml
  when: not dual_abi

- name: Build TensorFlow IO in Dual ABI enabled container
  ansible.builtin.include_role:
    name: tensorflow_io_in_container
    tasks_from: dual-abi-build.yml
  when: dual_abi
