From 95d1f714912d510e757323703692f69b07830489 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Mon, 20 Jan 2025 17:17:32 -0700 Subject: [PATCH] Add flutter and dependencies. --- local.yml | 4 +- tasks/workstation/linux/software/flutter.yml | 150 +++++++++++++++++++ 2 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 tasks/workstation/linux/software/flutter.yml diff --git a/local.yml b/local.yml index c582912..96db67f 100644 --- a/local.yml +++ b/local.yml @@ -75,7 +75,6 @@ - include_tasks: tasks/general/software/sendmail.yml when: ansible_system == "FreeBSD" - # Gather again in case missing programs have now been installed. - include_tasks: facts/general/gather.yml @@ -154,6 +153,9 @@ - include_tasks: tasks/workstation/shared/settings/services.yml # Final Tasks (SLOW) # + - include_tasks: tasks/workstation/linux/software/flutter.yml + when: ansible_system == "Linux" + - include_tasks: tasks/workstation/linux/software/flatpaks.yml when: ansible_system == "Linux" and flatpak_distro diff --git a/tasks/workstation/linux/software/flutter.yml b/tasks/workstation/linux/software/flutter.yml new file mode 100644 index 0000000..bb99d70 --- /dev/null +++ b/tasks/workstation/linux/software/flutter.yml @@ -0,0 +1,150 @@ +--- +# Packages specific to workstations developing Flutter apps. + +## Facts ## + +- name: Workstation | Linux | Software | Flutter | Facts [1/2] + set_fact: + flutter_url: "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.27.2-stable.tar.xz" + flutter_download_file: "{{ user_user.home }}/Downloads/flutter.tar.xz" + flutter_sdk_location: "{{ user_user.home }}/SDKs/Flutter" + flutter_report: "{{ user_user.home }}/Reports/flutter.txt" + +- name: Workstation | Linux | Software | Flutter | Facts [2/2] + set_fact: + flutter_bin_location: "{{ flutter_sdk_location }}/flutter/bin" + +## Checks ## + +- name: Workstation | Linux | Software | Flutter | Check SDK Exists + stat: + path: "{{ flutter_sdk_location }}" + register: flutter_sdk_stat + +- name: Workstation | Linux | Software | Flutter | Check Download Exists + stat: + path: "{{ flutter_download_file }}" + register: flutter_download_stat + +## Packages ## + +- name: Workstation | Linux | Software | Flutter | Necessities + package: + name: + - curl + - git + - unzip + - xz-utils + - zip + - libglu1-mesa + state: present + when: coding == true + +# https://docs.flutter.dev/get-started/install/linux/desktop +- name: Workstation | Linux | Software | Flutter | Linux App Dependencies + package: + name: + - clang + - cmake + - git + - ninja-build + - pkg-config + - libgtk-3-dev + - liblzma-dev + - libstdc++-12-dev + state: present + when: coding == true + +# https://docs.flutter.dev/get-started/install/linux/android +- name: Workstation | Linux | Software | Flutter | Android App Dependencies + package: + name: + - libc6:amd64 + - libstdc++6:amd64 + - lib32z1 + - libbz2-1.0:amd64 + state: present + when: coding == true + +## Install SDK ## + +- name: Workstation | Linux | Software | Flutter | SDK + block: + + - name: Workstation | Linux | Software | Flutter | Download SDK + get_url: + url: "{{ flutter_url }}" + dest: "{{ flutter_download_file }}" + owner: "{{ user }}" + mode: '0664' + when: not flutter_download_stat.stat.exists + + - name: Workstation | Linux | Software | Flutter | Create Folder + file: + path: "{{ flutter_sdk_location }}" + state: directory + owner: "{{ user }}" + mode: '0755' + + - name: Workstation | Linux | Software | Flutter | Extract SDK + unarchive: + src: "{{ flutter_download_file }}" + dest: "{{ flutter_sdk_location }}" + owner: "{{ user }}" + + when: coding == true and not flutter_sdk_stat.stat.exists + +- name: Workstation | Linux | Software | Flutter | Delete Archive + file: + path: "{{ flutter_download_file }}" + state: absent + +## Configure Environment ## + +- name: Workstation | Linux | Software | Flutter | Modify PATH (.bashrc) + blockinfile: + path: "{{ item }}/.bashrc" + block: | + export PATH="$PATH:{{ flutter_bin_location }}" + marker: '# {mark} MANAGED BY ANSIBLE | Flutter' + state: present + create: yes + backup: yes + loop: + - "{{ user_root.home }}" + - "{{ user_user.home }}" + ignore_errors: yes + when: coding == true and user_root.home != "" and user_user.home != "" + +- name: Workstation | Linux | Software | Flutter | Modify PATH (.zshrc) + blockinfile: + path: "{{ item }}/.zshrc" + block: | + export PATH="$PATH:{{ flutter_bin_location }}" + marker: '# {mark} MANAGED BY ANSIBLE | Flutter' + state: present + create: yes + backup: yes + loop: + - "{{ user_root.home }}" + - "{{ user_user.home }}" + ignore_errors: yes + when: coding == true and user_root.home != "" and user_user.home != "" + +## Test SDK ## + +- name: Workstation | Linux | Software | Flutter | Doctor Report + shell: "{{ item }}" + loop: + - "date > {{ flutter_report }}" + - "{{ flutter_bin_location }}/flutter doctor -v >> {{ flutter_report }}" + - "date >> {{ flutter_report }}" + when: coding == true + +## Uninstall SDK ## + +- name: Workstation | Linux | Software | Flutter | Remove SDK + file: + path: "{{ flutter_sdk_location }}" + state: absent + when: not coding == true