blob: 187a9d4a948d6a733a95a705a4fa19069934e5e2 [file] [log] [blame]
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -08001#!/bin/bash
2# Get versions
Aurimas Liutikas39f22262022-11-03 09:00:24 -07003AGP_VERSION=${1:-8.0.0-alpha07}
4STUDIO_VERSION_STRING=${2:-"Android Studio Flamingo (2022.2.1) Canary 7"}
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -08005STUDIO_IFRAME_LINK=`curl "https://developer.android.com/studio/archive.html" | grep iframe | sed "s/.*src=\"\([a-zA-Z0-9\/\._]*\)\".*/https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/https\/android-dot-devsite-v2-prod.appspot.com\1/g"`
6STUDIO_LINK=`curl -s $STUDIO_IFRAME_LINK | grep -C30 "$STUDIO_VERSION_STRING" | grep Linux | tail -n 1 | sed 's/.*a href="\(.*\).*"/\1/g'`
Aurimas Liutikase54847d2021-05-19 10:58:12 -07007STUDIO_VERSION=`echo $STUDIO_LINK | sed "s/.*ide-zips\/\(.*\)\/android-studio-.*/\1/g"`
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -08008
9# Update AGP
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080010ARTIFACTS_TO_DOWNLOAD="com.android.tools.build:gradle:$AGP_VERSION,"
11ARTIFACTS_TO_DOWNLOAD+="androidx.databinding:viewbinding:$AGP_VERSION,"
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -080012AAPT2_VERSIONS=`curl "https://dl.google.com/dl/android/maven2/com/android/tools/build/group-index.xml" | grep aapt2-proto | sed 's/.*versions="\(.*\)"\/>/\1/g'`
13AAPT2_VERSION=`echo $AAPT2_VERSIONS | sed "s/.*\($AGP_VERSION-[0-9]*\).*/\1/g"`
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080014ARTIFACTS_TO_DOWNLOAD+="com.android.tools.build:aapt2:$AAPT2_VERSION:linux,"
15ARTIFACTS_TO_DOWNLOAD+="com.android.tools.build:aapt2:$AAPT2_VERSION:osx,"
16ARTIFACTS_TO_DOWNLOAD+="com.android.tools.build:aapt2:$AAPT2_VERSION,"
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -080017LINT_VERSIONS=`curl "https://dl.google.com/dl/android/maven2/com/android/tools/lint/group-index.xml" | grep lint | sed 's/.*versions="\(.*\)"\/>/\1/g'`
18LINT_MINOR_VERSION=`echo $AGP_VERSION | sed 's/[0-9]\+\.\(.*\)/\1/g'`
19LINT_VERSION=`echo $LINT_VERSIONS | sed "s/.*[,| ]\([0-9]\+\.$LINT_MINOR_VERSION\).*/\1/g"`
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080020ARTIFACTS_TO_DOWNLOAD+="com.android.tools.lint:lint:$LINT_VERSION,"
21ARTIFACTS_TO_DOWNLOAD+="com.android.tools.lint:lint-tests:$LINT_VERSION,"
22ARTIFACTS_TO_DOWNLOAD+="com.android.tools.lint:lint-gradle:$LINT_VERSION,"
Aurimas Liutikas39f22262022-11-03 09:00:24 -070023ARTIFACTS_TO_DOWNLOAD+="com.android.tools:ninepatch:$LINT_VERSION,"
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -080024
25# Update studio_versions.properties
Aurimas Liutikas78273a32021-07-08 16:49:13 -070026sed -i "s/androidGradlePlugin = .*/androidGradlePlugin = \"$AGP_VERSION\"/g" gradle/libs.versions.toml
Jeff Gastona4baa262021-11-02 15:29:55 -040027sed -i "s/androidLint = \".*/androidLint = \"$LINT_VERSION\"/g" gradle/libs.versions.toml
Aurimas Liutikas78273a32021-07-08 16:49:13 -070028sed -i "s/androidStudio = .*/androidStudio = \"$STUDIO_VERSION\"/g" gradle/libs.versions.toml
Dustin Lam1ecd1f22021-07-15 15:29:45 -070029
30# Pull all UTP artifacts for ADT version
31ADT_VERSION=${3:-$LINT_VERSION}
Aurimas Liutikasb0470e52022-01-31 15:09:55 -080032while read line
Dustin Lam1ecd1f22021-07-15 15:29:45 -070033 do
34 ARTIFACT=`echo $line | sed 's/<\([[:lower:]-]\+\).*/\1/g'`
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080035 ARTIFACTS_TO_DOWNLOAD+="com.android.tools.utp:$ARTIFACT:$ADT_VERSION,"
Aurimas Liutikasb0470e52022-01-31 15:09:55 -080036 done < <(curl -sL "https://dl.google.com/android/maven2/com/android/tools/utp/group-index.xml" \
37 | tail -n +3 \
38 | head -n -1)
Dustin Lam1ecd1f22021-07-15 15:29:45 -070039
Aurimas Liutikas5ae47e82022-06-22 17:00:45 -070040ATP_VERSION=${4:-0.0.8-alpha08}
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080041ARTIFACTS_TO_DOWNLOAD+="com.google.testing.platform:android-test-plugin:$ATP_VERSION,"
42ARTIFACTS_TO_DOWNLOAD+="com.google.testing.platform:launcher:$ATP_VERSION,"
43ARTIFACTS_TO_DOWNLOAD+="com.google.testing.platform:android-driver-instrumentation:$ATP_VERSION,"
44ARTIFACTS_TO_DOWNLOAD+="com.google.testing.platform:core:$ATP_VERSION"
Dustin Lam1ecd1f22021-07-15 15:29:45 -070045
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080046# Download all the artifacts
Aurimas Liutikasa4fdba52022-07-07 15:04:19 -070047./development/importMaven/importMaven.sh "$ARTIFACTS_TO_DOWNLOAD"