android, more thorough switch to android sdk from sdkmanager.

This commit is contained in:
me
2026-09-29 11:51:19 -07:00
parent 2d6bba789c
commit 3d61a7619c
+26 -15
View File
@@ -12,23 +12,34 @@
# Command-line tools is all Flutter actually needs: # Command-line tools is all Flutter actually needs:
# https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip # https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
- name: Workstation | Linux | Software | Android | Facts [1/3] - name: Workstation | Linux | Software | Android | Facts [01]
set_fact: set_fact:
android_url: "https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip" android_url: "https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip"
android_download_file: "{{ user_user.home }}/Downloads/android-cmdline-tools.tar.xz" android_download_file: "{{ user_user.home }}/Downloads/android-cmdline-tools.tar.xz"
android_sdk_location: "{{ user_user.home }}/SDKs/Android/Sdk" android_sdk_location: "{{ user_user.home }}/SDKs/Android/Sdk"
android_report_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.sdk.android.txt" android_report_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.sdk.android.txt"
- name: Workstation | Linux | Software | Android | Facts [2/3] - name: Workstation | Linux | Software | Android | Facts [02]
set_fact: set_fact:
android_bin_location: "{{ android_sdk_location }}/platform-tools" android_bin_location: "{{ android_sdk_location }}/platform-tools"
android_sdk_cmdline_temp: "{{ android_sdk_location }}/ansible" android_sdk_cmdline_temp: "{{ android_sdk_location }}/ansible"
android_sdk_cmdline_final: "{{ android_sdk_location }}/cmdline-tools/latest/bin" android_sdk_cmdline_final: "{{ android_sdk_location }}/cmdline-tools/latest/bin"
- name: Workstation | Linux | Software | Android | Facts [3/3] - name: Workstation | Linux | Software | Android | Facts [03]
set_fact: set_fact:
android_sdkmanager_temp: "{{ android_sdk_cmdline_temp }}/cmdline-tools/bin/android sdk" android_sdkmanager_temp: "{{ android_sdk_cmdline_temp }}/cmdline-tools/bin/sdkmanager"
android_sdkmanager_final: "{{ android_sdk_cmdline_final }}/android sdk" android_sdkmanager_final: "{{ android_sdk_cmdline_final }}/sdkmanager"
android_sdkmanager_final2: "{{ android_sdk_cmdline_final }}/android"
- name: Workstation | Linux | Software | Android | Facts [04]
set_fact:
android_sdkmanager2: "{{ android_sdkmanager_final2 }} sdk --sdk={{ android_sdk_location }}"
- name: Workstation | Linux | Software | Android | Facts [05]
set_fact:
android_sdkmanager2_list: "{{ android_sdkmanager }} list"
android_sdkmanager2_install: "{{ android_sdkmanager }} install"
android_sdkmanager2_remove: "{{ android_sdkmanager }} remove"
# Regarding images to download; the `default` is the smallest, then `playstore`. # Regarding images to download; the `default` is the smallest, then `playstore`.
# The `google_apis` images are significantly larger than the `playstore` option. # The `google_apis` images are significantly larger than the `playstore` option.
@@ -151,7 +162,7 @@
get_attributes: false get_attributes: false
get_checksum: false get_checksum: false
get_mime: false get_mime: false
register: android_sdkmanager_final_stat register: android_sdkmanager_check
when: coding == true when: coding == true
- name: Workstation | Linux | Software | Android | Check Download Exists - name: Workstation | Linux | Software | Android | Check Download Exists
@@ -229,7 +240,7 @@
# This can only be run once, otherwise cmdline-tools creates latest-* folders. # This can only be run once, otherwise cmdline-tools creates latest-* folders.
- name: Workstation | Linux | Software | Android | Install | Consistent Modules - name: Workstation | Linux | Software | Android | Install | Consistent Modules
shell: "yes | {{ android_sdkmanager_temp }} install '{{ item }}' --sdk={{ android_sdk_location }}" shell: "yes | {{ android_sdkmanager_temp }} --install '{{ item }}' --sdk_root={{ android_sdk_location }}"
loop: loop:
# Current # Current
- cmdline-tools/latest - cmdline-tools/latest
@@ -237,13 +248,13 @@
- emulator - emulator
become_user: "{{ user }}" become_user: "{{ user }}"
when: coding == true when: coding == true
and not android_sdkmanager_final_stat.stat.exists and not android_sdkmanager_check.stat.exists
# These are safe to run multiple times, and uses the new `latest` version. # These are safe to run multiple times, and uses the new `latest` version.
- name: Workstation | Linux | Software | Android | Install | Required Modules - name: Workstation | Linux | Software | Android | Install | Required Modules
shell: | shell: |
if ! {{ android_sdkmanager_final }} --list_installed | grep -q '{{ item }}'; then if ! {{ android_sdkmanager2_list }} | grep -q '{{ item }}'; then
yes | {{ android_sdkmanager_final }} install '{{ item }}' --sdk={{ android_sdk_location }} yes | {{ android_sdkmanager2_install }} '{{ item }}'
fi fi
loop: "{{ android_downloads_required }}" loop: "{{ android_downloads_required }}"
become_user: "{{ user }}" become_user: "{{ user }}"
@@ -252,8 +263,8 @@
# Add more versions for testing across all the important platforms. # Add more versions for testing across all the important platforms.
- name: Workstation | Linux | Software | Android | Install | Additional Modules - name: Workstation | Linux | Software | Android | Install | Additional Modules
shell: | shell: |
if ! {{ android_sdkmanager_final }} --list_installed | grep -q '{{ item }}'; then if ! {{ android_sdkmanager2_list }} | grep -q '{{ item }}'; then
yes | {{ android_sdkmanager_final }} install '{{ item }}' --sdk={{ android_sdk_location }} yes | {{ android_sdkmanager2_install }} '{{ item }}'
fi fi
loop: "{{ android_downloads_additional }}" loop: "{{ android_downloads_additional }}"
become_user: "{{ user }}" become_user: "{{ user }}"
@@ -262,7 +273,7 @@
# Remove extra downloads if system is not meant for full amount of testing. # Remove extra downloads if system is not meant for full amount of testing.
- name: Workstation | Linux | Software | Android | Uninstall | Additional Modules - name: Workstation | Linux | Software | Android | Uninstall | Additional Modules
shell: "yes | {{ android_sdkmanager_final }} remove '{{ item }}' --sdk={{ android_sdk_location }}" shell: "yes | {{ android_sdkmanager2_remove }} '{{ item }}'"
loop: "{{ android_downloads_additional }}" loop: "{{ android_downloads_additional }}"
become_user: "{{ user }}" become_user: "{{ user }}"
when: coding != true when: coding != true
@@ -271,14 +282,14 @@
# Remove any versions which used to be part of this script and no longer used. # Remove any versions which used to be part of this script and no longer used.
- name: Workstation | Linux | Software | Android | Uninstall | Unused Modules - name: Workstation | Linux | Software | Android | Uninstall | Unused Modules
shell: "yes | {{ android_sdkmanager_final }} remove '{{ item }}' --sdk={{ android_sdk_location }}" shell: "yes | {{ android_sdkmanager2_remove }} '{{ item }}'"
loop: "{{ android_downloads_unused }}" loop: "{{ android_downloads_unused }}"
become_user: "{{ user }}" become_user: "{{ user }}"
when: coding == true when: coding == true
# Report the currently installed packges. # Report the currently installed packges.
- name: Workstation | Linux | Software | Android | Report Modules - name: Workstation | Linux | Software | Android | Report Modules
shell: "{{ android_sdkmanager_final }} list --sdk={{ android_sdk_location }} > {{ android_report_file }}" shell: "{{ android_sdkmanager2_list }} > {{ android_report_file }}"
become_user: "{{ user }}" become_user: "{{ user }}"
when: coding == true when: coding == true