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

- name: Set git version variables
  ansible.builtin.set_fact:
    tensorflow_text_git_version: "{{ tf_text_ver.value.tensorflow_text_git_version }}"
  when: tensorflow_text_version == 'git'

- name: Remove TensorFlow Text {{ tensorflow_text_version }} sources from previous build
  ansible.builtin.file:
    path: "{{ build_dir }}/text-{{ tensorflow_text_version }}/"
    state: absent

- name: Fetch and unpack TensorFlow Text 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: Build TensorFlow Text in Dual ABI enabled container
  ansible.builtin.include_tasks:
    file: dual-abi-build.yml
