Files
ansible_role_package/tasks/helpers/cargo_build.yml
Matthew Stobbs d062a1f372 fix fd and yazi
2026-04-13 02:46:05 -06:00

50 lines
1.8 KiB
YAML

# vim: set filetype=yaml.ansible :
#
## Helper: cargo_buil.yml
## Description: download source, build and install using cargo
## Variables: top level 'dict'
## source_dir: git source directory
## repo: git repository url
## depth: _int_ optional, Default 1. Git depth to clone
## force_git: _bool_ optional, default true. Force clone, overwriting existing dir
## recursive: _bool_ optional, default true. Do a recursive clone
## version: _string_ optional, default 'latest'. Version to checkout and build
## locked: _bool_ optional, default 'false'
## build_flags: _list[str]_ optional. If set, will append these to the build command
---
- name: Cargo source install helper
block:
- name: Fetch git repo
vars:
path: "{{ pkg.source_dir }}"
repo: "{{ pkg.repo }}"
depth: "{{ pkg.depth | default(1) }}"
force: "{{ pkg.force_git | default(true) }}"
recursive: "{{ pkg.recursive | default(true) }}"
version: "{{ pkg.version | default(omit) }}"
ansible.builtin.include_tasks: helpers/git.yml
- name: Build cargo release
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
community.general.cargo:
directory: "{{ pkg.source_dir }}"
path: "{{ install_prefix }}"
name: "{{ pkg.name }}"
version: "{{ pkg.version }}"
locked: "{{ pkg.locked }}"
- name: Clean existing install
vars:
files: "{{ pkg.files }}"
ansible.builtin.include_tasks: helpers/clean_install.yml
- name: Install cargo release
block:
- name: Create missing directories
vars:
do_become: "{{ install_become }}"
do_become_user: "{{ install_become_user | default(omit) }}"
source_dir: "{{ pkg.source_dir }}"
ansible.builtin.include_tasks: helpers/install.yml