Commit 8ee714f0 by stu

add libraries/packages for emulation and more tests

parent eb38e30a
...@@ -11,9 +11,17 @@ android_home: "/opt/android-sdk-linux" ...@@ -11,9 +11,17 @@ android_home: "/opt/android-sdk-linux"
# individual android build targets to be downloaded via the android sdk manager # individual android build targets to be downloaded via the android sdk manager
android_build_targets: android_build_targets:
- android-23 - android-23
# other android dependencies that cannot be tested via the android sdk manager - android-21
# other android dependencies that cannot be tested via the android sdk manager. instead, stat the android_test_path
# to test for presence of the package
android_tools: android_tools:
- platform-tools - { package: 'platform-tools', android_test_path: 'platform-tools' }
- build-tools-23.0.3 - { package: 'build-tools-23.0.3', android_test_path: 'build-tools/23.0.3' }
- extra-google-m2repository - { package: 'extra-google-m2repository', android_test_path: 'extras/google/m2repository' }
- extra-android-m2repository - { package: 'extra-android-m2repository', android_test_path: 'extras/android/m2repository' }
- { package: 'sys-img-armeabi-v7a-android-21', android_test_path: 'system-images/android-21/default/armeabi-v7a/' }
- { package: 'sys-img-armeabi-v7a-android-23', android_test_path: 'system-images/android-23/default/armeabi-v7a/' }
# libraries needed for avd(android virtual device) emulation
android_apt_libraries:
- libstdc++6:i386
- lib32z1
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
- name: Add the user to the group and configure shell - name: Add the user to the group and configure shell
user: name={{ android_user }} append=yes group={{ android_group }} shell=/bin/bash user: name={{ android_user }} append=yes group={{ android_group }} shell=/bin/bash
# Download the Android SDK/tools tarball from Google's download site. # Download the Android SDK/tools tarball from Google's download site.
# NOTE: while it is the general policy to use repositories/ppas as much as possible # NOTE: while it is the general policy to use repositories/ppas as much as possible
# it did not seem reliable for this work. Other avenues were explored: # it did not seem reliable for this work. Other avenues were explored:
# - pre-Ubuntu 16 releases do not contain the android sdk in their apt repos # - pre-Ubuntu 16 releases do not contain the android sdk in their apt repos
...@@ -23,22 +23,37 @@ ...@@ -23,22 +23,37 @@
- assert: - assert:
that: that:
"'{{ android_checksum }}' in sdk_checksum.stdout" "'{{ android_checksum }}' in sdk_checksum.stdout"
- name: Unarchive tarball to /opt/android-sdk - name: Unarchive tarball to /opt/android-sdk-linux
unarchive: unarchive:
copy: no copy: no
src: /tmp/android-sdk.tgz src: /tmp/android-sdk.tgz
dest: /opt dest: /opt
creates: "{{ android_home }}" creates: "{{ android_home }}"
owner: "{{ android_user }}" owner: "{{ android_user }}"
group: "{{ android_group }}" group: "{{ android_group }}"
become: yes become: yes
# Use the android sdk manager to install the build targets necessary for the edx mobile app # Use the android sdk manager to install the build targets necessary for the edx mobile app
- name: Install Android API levels - name: Install Android API levels
shell: "echo 'y' | {{ android_home }}/tools/android update sdk --no-ui --filter {{ ','.join(android_build_targets) }}" shell: "echo 'y' | {{ android_home }}/tools/android update sdk -a --no-ui --filter {{ android_build_targets | join(',') }}"
become: yes become: yes
become_user: "{{ android_user }}" become_user: "{{ android_user }}"
# Put Android package names into a list for easier installation command
- name: Gather Android packages to download into a list
util_map:
function: 'zip_to_list'
input: "{{ android_tools }}"
args:
- "package"
register: android_packages
# Use the android sdk manager to install the build tools necessary for the edx mobile app # Use the android sdk manager to install the build tools necessary for the edx mobile app
- name: Install other Android tools - name: Install other Android tools
shell: "echo 'y' | {{ android_home }}/tools/android update sdk --no-ui --filter {{ ','.join(android_tools) }}" shell: "echo 'y' | {{ android_home }}/tools/android update sdk -a --no-ui --filter {{ android_packages.function_output | join(',') }}"
become: yes become: yes
become_user: "{{ android_user }}" become_user: "{{ android_user }}"
# The following libraries are only needed to run AVD emulation, not for compiling
- name: Install additional libraries used for Android emulation
apt:
name: "{{ item }}"
update_cache: yes
state: present
with_items: "{{ android_apt_libraries }}"
...@@ -31,9 +31,17 @@ dependencies: ...@@ -31,9 +31,17 @@ dependencies:
# individual android build targets to be downloaded via the android sdk manager # individual android build targets to be downloaded via the android sdk manager
android_build_targets: android_build_targets:
- android-23 - android-23
# other android dependencies that cannot be tested via the android sdk manager - android-21
# other android dependencies that cannot be tested via the android sdk manager. instead, stat the android_test_path
# to test for presence of the package
android_tools: android_tools:
- platform-tools - { package: 'platform-tools', android_test_path: 'platform-tools' }
- build-tools-23.0.3 - { package: 'build-tools-23.0.3', android_test_path: 'build-tools/23.0.3' }
- extra-google-m2repository - { package: 'extra-google-m2repository', android_test_path: 'extras/google/m2repository' }
- extra-android-m2repository - { package: 'extra-android-m2repository', android_test_path: 'extras/android/m2repository' }
- { package: 'sys-img-armeabi-v7a-android-21', android_test_path: 'system-images/android-21/default/armeabi-v7a/' }
- { package: 'sys-img-armeabi-v7a-android-23', android_test_path: 'system-images/android-23/default/armeabi-v7a/' }
# libraries needed for avd(android virtual device) emulation
android_apt_libraries:
- libstdc++6:i386
- lib32z1
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
register: android_version register: android_version
- assert: - assert:
that: that:
- "android_version.rc == 0" - "android_version.rc == 0"
# Test that the necessary build targets for building the edx app have # Test that the necessary build targets for building the edx app have
# been installed. # been installed.
- name: Verify correct Android build targets installed - name: Verify correct Android build targets installed
...@@ -15,3 +15,21 @@ ...@@ -15,3 +15,21 @@
assert: assert:
that: that:
- "'{{ item }}' in build_targets.stdout" - "'{{ item }}' in build_targets.stdout"
# Put the paths of downloaded packages into a list, so they can be iterated over
# in an assert block
- name: Gather paths of installed Android packages into a list
util_map:
function: 'zip_to_list'
input: "{{ android_tools }}"
args:
- "android_test_path"
register: android_test_paths
# Test that the correct android tools are installed
- name: Verify build tools installed
stat: path={{ android_home }}/{{ item }}
register: android_package_stats
with_items: "{{ android_test_paths.function_output }}"
- with_items: "{{ android_package_stats.results }}"
assert:
that:
- "item.stat.exists == True"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment