blob: 60159c2262d49dcea6a6b30f1d65dd0544e990ff [file] [log] [blame]
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -08001#!/bin/bash
Aurimas Liutikas65920d32023-02-14 18:38:24 -08002
3function echoAndDo() {
4 echo "$@"
5 eval "$@"
6}
7
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -08008# Get versions
Aurimas Liutikas65920d32023-02-14 18:38:24 -08009echo Getting Studio version and link
Aurimas Liutikas09f57222023-05-09 20:46:57 -070010AGP_VERSION=${1:-8.1.0-beta02}
11STUDIO_VERSION_STRING=${2:-"Android Studio Giraffe | 2022.3.1 Beta 2"}
Aurimas Liutikas65920d32023-02-14 18:38:24 -080012STUDIO_IFRAME_LINK=`curl "https://developer.android.com/studio/archive.html" | grep "<iframe " | sed "s/.* src=\"\([^\"]*\)\".*/\1/g"`
13echo iframe link $STUDIO_IFRAME_LINK
14STUDIO_IFRAME_REDIRECT=`curl -s $STUDIO_IFRAME_LINK | grep href | sed 's/.*href="\([^"]*\)".*/\1/g'`
15echo iframe redirect $STUDIO_IFRAME_REDIRECT
16STUDIO_LINK=`curl -s $STUDIO_IFRAME_REDIRECT | grep -C30 "$STUDIO_VERSION_STRING" | grep Linux | tail -n 1 | sed 's/.*a href="\(.*\).*"/\1/g' | sed 's/>.*//'`
17echo STUDIO_LINK: $STUDIO_LINK
18if [ "$STUDIO_LINK" == "" ]; then
19 echo "Error: STUDIO_LINK must not be empty. Open this script and look for parsing errors. Does studio version '$STUDIO_VERSION_STRING' exist?"
20 exit 1
21fi
Aurimas Liutikase54847d2021-05-19 10:58:12 -070022STUDIO_VERSION=`echo $STUDIO_LINK | sed "s/.*ide-zips\/\(.*\)\/android-studio-.*/\1/g"`
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -080023
24# Update AGP
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080025ARTIFACTS_TO_DOWNLOAD="com.android.tools.build:gradle:$AGP_VERSION,"
26ARTIFACTS_TO_DOWNLOAD+="androidx.databinding:viewbinding:$AGP_VERSION,"
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -080027AAPT2_VERSIONS=`curl "https://dl.google.com/dl/android/maven2/com/android/tools/build/group-index.xml" | grep aapt2-proto | sed 's/.*versions="\(.*\)"\/>/\1/g'`
28AAPT2_VERSION=`echo $AAPT2_VERSIONS | sed "s/.*\($AGP_VERSION-[0-9]*\).*/\1/g"`
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080029ARTIFACTS_TO_DOWNLOAD+="com.android.tools.build:aapt2:$AAPT2_VERSION:linux,"
30ARTIFACTS_TO_DOWNLOAD+="com.android.tools.build:aapt2:$AAPT2_VERSION:osx,"
31ARTIFACTS_TO_DOWNLOAD+="com.android.tools.build:aapt2:$AAPT2_VERSION,"
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -080032LINT_VERSIONS=`curl "https://dl.google.com/dl/android/maven2/com/android/tools/lint/group-index.xml" | grep lint | sed 's/.*versions="\(.*\)"\/>/\1/g'`
33LINT_MINOR_VERSION=`echo $AGP_VERSION | sed 's/[0-9]\+\.\(.*\)/\1/g'`
34LINT_VERSION=`echo $LINT_VERSIONS | sed "s/.*[,| ]\([0-9]\+\.$LINT_MINOR_VERSION\).*/\1/g"`
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080035ARTIFACTS_TO_DOWNLOAD+="com.android.tools.lint:lint:$LINT_VERSION,"
36ARTIFACTS_TO_DOWNLOAD+="com.android.tools.lint:lint-tests:$LINT_VERSION,"
37ARTIFACTS_TO_DOWNLOAD+="com.android.tools.lint:lint-gradle:$LINT_VERSION,"
Aurimas Liutikas39f22262022-11-03 09:00:24 -070038ARTIFACTS_TO_DOWNLOAD+="com.android.tools:ninepatch:$LINT_VERSION,"
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -080039
Aurimas Liutikas65920d32023-02-14 18:38:24 -080040# Update libs.versions.toml
41echo Updating dependency versions
Aurimas Liutikas78273a32021-07-08 16:49:13 -070042sed -i "s/androidGradlePlugin = .*/androidGradlePlugin = \"$AGP_VERSION\"/g" gradle/libs.versions.toml
Jeff Gastona4baa262021-11-02 15:29:55 -040043sed -i "s/androidLint = \".*/androidLint = \"$LINT_VERSION\"/g" gradle/libs.versions.toml
Aurimas Liutikas78273a32021-07-08 16:49:13 -070044sed -i "s/androidStudio = .*/androidStudio = \"$STUDIO_VERSION\"/g" gradle/libs.versions.toml
Dustin Lam1ecd1f22021-07-15 15:29:45 -070045
46# Pull all UTP artifacts for ADT version
47ADT_VERSION=${3:-$LINT_VERSION}
Aurimas Liutikasb0470e52022-01-31 15:09:55 -080048while read line
Dustin Lam1ecd1f22021-07-15 15:29:45 -070049 do
50 ARTIFACT=`echo $line | sed 's/<\([[:lower:]-]\+\).*/\1/g'`
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080051 ARTIFACTS_TO_DOWNLOAD+="com.android.tools.utp:$ARTIFACT:$ADT_VERSION,"
Aurimas Liutikasb0470e52022-01-31 15:09:55 -080052 done < <(curl -sL "https://dl.google.com/android/maven2/com/android/tools/utp/group-index.xml" \
53 | tail -n +3 \
54 | head -n -1)
Dustin Lam1ecd1f22021-07-15 15:29:45 -070055
Aurimas Liutikas5ae47e82022-06-22 17:00:45 -070056ATP_VERSION=${4:-0.0.8-alpha08}
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080057ARTIFACTS_TO_DOWNLOAD+="com.google.testing.platform:android-test-plugin:$ATP_VERSION,"
58ARTIFACTS_TO_DOWNLOAD+="com.google.testing.platform:launcher:$ATP_VERSION,"
59ARTIFACTS_TO_DOWNLOAD+="com.google.testing.platform:android-driver-instrumentation:$ATP_VERSION,"
60ARTIFACTS_TO_DOWNLOAD+="com.google.testing.platform:core:$ATP_VERSION"
Dustin Lam1ecd1f22021-07-15 15:29:45 -070061
Aurimas Liutikas4e9ba5f2022-01-13 16:15:21 -080062# Download all the artifacts
Aurimas Liutikas65920d32023-02-14 18:38:24 -080063echoAndDo ./development/importMaven/importMaven.sh "$ARTIFACTS_TO_DOWNLOAD"