mirror of
https://github.com/actions/runner-images.git
synced 2025-12-18 15:57:17 +00:00
add dynamic installation for linux
This commit is contained in:
@@ -9,6 +9,23 @@ set -e
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/os.sh
|
||||
|
||||
function install_android_packages {
|
||||
minimumVersion=$( echo "$1" | sed 's/\.//g' )
|
||||
shift
|
||||
toolsArr=("$@")
|
||||
|
||||
for item in ${toolsArr[@]}
|
||||
do
|
||||
version=$(echo "${item##*[-;]}" | sed 's/\.//g')
|
||||
echo "version is $version"
|
||||
if (( $version >= $minimumVersion ))
|
||||
then
|
||||
echo "Start installing $item"
|
||||
echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager $item
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
|
||||
ANDROID_ROOT=/usr/local/lib/android
|
||||
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
|
||||
@@ -42,22 +59,22 @@ else
|
||||
fi
|
||||
|
||||
toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json"
|
||||
platforms=$(jq -r '.android.platform_list[]|"platforms;" + .' $toolset)
|
||||
buildtools=$(jq -r '.android.build_tools[]|"build-tools;" + .' $toolset)
|
||||
minimumBuildToolVersion=$(jq -r '.android.build_tools_min_version' $toolset)
|
||||
minimumPlatformVersion=$(jq -r '.android.platform_min_version' $toolset)
|
||||
extras=$(jq -r '.android.extra_list[]|"extras;" + .' $toolset)
|
||||
addons=$(jq -r '.android.addon_list[]|"add-ons;" + .' $toolset)
|
||||
additional=$(jq -r '.android.additional_tools[]' $toolset)
|
||||
|
||||
# Install the following SDKs and build tools, passing in "y" to accept licenses.
|
||||
echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager $platforms $buildtools $extras $google_api_list $addons $additional
|
||||
echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager $extras $google_api_list $addons $additional
|
||||
|
||||
# Document what was added to the image
|
||||
platforms=$(${ANDROID_SDK_ROOT}/tools/bin/sdkmanager --list | sed -n '/Available Packages:/,/^$/p' | grep "platforms;android" | sed -E "s/[[:space:]]+//g" | sed -E "s/\|.*//g")
|
||||
buildTools=$(${ANDROID_SDK_ROOT}/tools/bin/sdkmanager --list | sed -n '/Available Packages:/,/^$/p' | grep "build-tools;" | sed -E "s/[[:space:]]+//g" | sed -E "s/\|.*//g")
|
||||
|
||||
google_api_versions_list=$(echo "$addons"|awk -F- '/addon-google_apis-google/ {print $5}')
|
||||
constraint_layout_versions_list=$(echo "$extras"|awk -F';' '/constraint-layout;/ {print $8}')
|
||||
constraint_layout_solver_versions_list=$(echo "$extras"|awk -F';' '/constraint-layout-solver;/ {print $8}')
|
||||
platform_versions_list=$(echo "$platforms"|awk -F- '{print $2}')
|
||||
buildtools_versions_list=$(echo "$buildtools"|awk -F';' '{print $2}')
|
||||
platformsArr=(${platforms})
|
||||
install_android_packages $minimumPlatformVersion "${platformsArr[@]}"
|
||||
buildToolsArr=(${buildTools})
|
||||
install_android_packages $minimumBuildToolVersion "${buildToolsArr[@]}"
|
||||
|
||||
# Add required permissions
|
||||
chmod -R a+rwx ${ANDROID_SDK_ROOT}
|
||||
|
||||
@@ -62,12 +62,8 @@
|
||||
}
|
||||
],
|
||||
"android": {
|
||||
"platform_list": [
|
||||
"android-30", "android-29", "android-28", "android-27", "android-26", "android-25", "android-24", "android-23", "android-22", "android-21", "android-19","android-17","android-15","android-10"
|
||||
],
|
||||
"build_tools": [
|
||||
"30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0", "26.0.3", "26.0.2", "26.0.1", "26.0.0", "25.0.3", "25.0.2", "25.0.1", "25.0.0", "24.0.3", "24.0.2", "24.0.1", "24.0.0", "23.0.3", "23.0.2", "23.0.1", "22.0.1", "21.1.2", "20.0.0", "19.1.0", "17.0.0"
|
||||
],
|
||||
"platform_min_version": "10",
|
||||
"build_tools_min_version": "17.0.0",
|
||||
"extra_list": [
|
||||
"android;m2repository",
|
||||
"google;m2repository",
|
||||
|
||||
@@ -62,12 +62,8 @@
|
||||
}
|
||||
],
|
||||
"android": {
|
||||
"platform_list": [
|
||||
"android-30", "android-29", "android-28", "android-27", "android-26", "android-25", "android-24", "android-23", "android-22", "android-21", "android-19","android-17"
|
||||
],
|
||||
"build_tools": [
|
||||
"30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0", "26.0.3", "26.0.2", "26.0.1", "26.0.0", "25.0.3", "25.0.2", "25.0.1", "25.0.0", "24.0.3", "24.0.2", "24.0.1", "24.0.0", "23.0.3", "23.0.2", "23.0.1", "22.0.1", "21.1.2", "20.0.0", "19.1.0", "17.0.0"
|
||||
],
|
||||
"platform_min_version": "17",
|
||||
"build_tools_min_version": "17.0.0",
|
||||
"extra_list": [
|
||||
"android;m2repository",
|
||||
"google;m2repository",
|
||||
|
||||
@@ -48,12 +48,8 @@
|
||||
}
|
||||
],
|
||||
"android": {
|
||||
"platform_list": [
|
||||
"android-30", "android-29", "android-28", "android-27"
|
||||
],
|
||||
"build_tools": [
|
||||
"30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0"
|
||||
],
|
||||
"platform_min_version": "27",
|
||||
"build_tools_min_version": "27.0.0",
|
||||
"extra_list": [
|
||||
"android;m2repository",
|
||||
"google;m2repository",
|
||||
|
||||
Reference in New Issue
Block a user