blob: 6b9ce3464ff67b5994337f172243e5337e6656a9 [file] [log] [blame]
Aurimas Liutikasc1250fc2021-02-04 16:08:34 -08001#!/bin/bash
2# Get versions
3AGP_VERSION=${1:-4.1.0-beta01}
4STUDIO_VERSION_STRING=${2:-Android Studio 4.1 Beta 1}
5STUDIO_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'`
7STUDIO_VERSION=`echo $STUDIO_LINK | sed "s/.*ide-zips\/\(.*\)\/android-studio-ide-\([0-9]\+\)\.\([0-9]\+\).*/\1/g"`
8IDEA_MAJOR_VERSION=`echo $STUDIO_LINK | sed "s/.*ide-zips\/\(.*\)\/android-studio-ide-\([0-9]\+\)\.\([0-9]\+\).*/\2/g"`
9STUDIO_BUILD_NUMBER=`echo $STUDIO_LINK | sed "s/.*ide-zips\/\(.*\)\/android-studio-ide-\([0-9]\+\)\.\([0-9]\+\).*/\3/g"`
10
11# Update AGP
12./development/importMaven/import_maven_artifacts.py -n com.android.tools.build:gradle:$AGP_VERSION
13./development/importMaven/import_maven_artifacts.py -n androidx.databinding:viewbinding:$AGP_VERSION
14AAPT2_VERSIONS=`curl "https://dl.google.com/dl/android/maven2/com/android/tools/build/group-index.xml" | grep aapt2-proto | sed 's/.*versions="\(.*\)"\/>/\1/g'`
15AAPT2_VERSION=`echo $AAPT2_VERSIONS | sed "s/.*\($AGP_VERSION-[0-9]*\).*/\1/g"`
16./development/importMaven/import_maven_artifacts.py -n com.android.tools.build:aapt2:$AAPT2_VERSION:linux
17./development/importMaven/import_maven_artifacts.py -n com.android.tools.build:aapt2:$AAPT2_VERSION:osx
18./development/importMaven/import_maven_artifacts.py -n com.android.tools.build:aapt2:$AAPT2_VERSION
19LINT_VERSIONS=`curl "https://dl.google.com/dl/android/maven2/com/android/tools/lint/group-index.xml" | grep lint | sed 's/.*versions="\(.*\)"\/>/\1/g'`
20LINT_MINOR_VERSION=`echo $AGP_VERSION | sed 's/[0-9]\+\.\(.*\)/\1/g'`
21LINT_VERSION=`echo $LINT_VERSIONS | sed "s/.*[,| ]\([0-9]\+\.$LINT_MINOR_VERSION\).*/\1/g"`
22./development/importMaven/import_maven_artifacts.py -n com.android.tools.lint:lint:$LINT_VERSION
23./development/importMaven/import_maven_artifacts.py -n com.android.tools.lint:lint-tests:$LINT_VERSION
24./development/importMaven/import_maven_artifacts.py -n com.android.tools.lint:lint-gradle:$LINT_VERSION
25
26# Update studio_versions.properties
27sed -i "s/agp=.*/agp=$AGP_VERSION/g" buildSrc/studio_versions.properties
28sed -i "s/lint=.*/lint=$LINT_VERSION/g" buildSrc/studio_versions.properties
29sed -i "s/studio_version=.*/studio_version=$STUDIO_VERSION/g" buildSrc/studio_versions.properties
30sed -i "s/idea_major_version=.*/idea_major_version=$IDEA_MAJOR_VERSION/g" buildSrc/studio_versions.properties
31sed -i "s/studio_build_number=.*/studio_build_number=$STUDIO_BUILD_NUMBER/g" buildSrc/studio_versions.properties