forked from android/testing-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_versions.sh
executable file
·72 lines (66 loc) · 3.5 KB
/
update_versions.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Simple script to update the androidx.test versions used in this project.
set -ex # Exit immediately if a command exits with a non-zero status.
#repourl="" # Leave empty to be ignored
#repourl="file:\/\/\/tmp\/test_repo\/m2repository"
#repourl="https:\/\/oss.sonatype.org\/content\/repositories\/orgrobolectric-1216"
#repourl="http:\/\/localhost:1480"
buildToolsVersion="31.0.0"
agpVersion="7.0.2"
kotlinVersion="1.4.31"
compileSdkVersion="30"
targetSdkVersion="30"
androidxAnnotationVersion="1.2.0"
androidxCompatVersion="1.3.1"
androidxCoreVersion="1.6.0"
androidxFragmentVersion="1.3.6"
androidxRecyclerVersion="1.2.1"
guavaVersion="30.1.1-android"
truthVersion="1.1.3"
runnerVersion="1.4.1-alpha03"
rulesVersion="1.4.1-alpha03"
servicesVersion="1.4.1-alpha03"
orchestratorVersion="1.4.1-alpha03"
coreVersion="1.4.1-alpha03"
extJUnitVersion="1.1.4-alpha03"
extTruthVersion="1.5.0-alpha03"
espressoVersion="3.5.0-alpha03"
robolectricVersion="4.6.1"
uiAutomatorVersion="2.2.0"
for p in $(cat projects.conf); do
echo
echo
echo Updating version in $p
echo "====================================================================="
pushd $p > /dev/null # Silent pushd
# Replace versions
sed -i "s/buildToolsVersion = \".*\"/buildToolsVersion = \"$buildToolsVersion\"/" build.gradle
sed -i "s/agpVersion = \".*\"/agpVersion = \"$agpVersion\"/" build.gradle
sed -i "s/kotlinVersion = \".*\"/kotlinVersion = \"$kotlinVersion\"/" build.gradle
sed -i "s/coreVersion = \".*\"/coreVersion = \"$coreVersion\"/" build.gradle
sed -i "s/extJUnitVersion = \".*\"/extJUnitVersion = \"$extJUnitVersion\"/" build.gradle
sed -i "s/extTruthVersion = \".*\"/extTruthVersion = \"$extTruthVersion\"/" build.gradle
sed -i "s/runnerVersion = \".*\"/runnerVersion = \"$runnerVersion\"/" build.gradle
sed -i "s/rulesVersion = \".*\"/rulesVersion = \"$rulesVersion\"/" build.gradle
sed -i "s/servicesVersion = \".*\"/servicesVersion = \"$servicesVersion\"/" build.gradle
sed -i "s/orchestratorVersion = \".*\"/orchestratorVersion = \"$orchestratorVersion\"/" build.gradle
sed -i "s/espressoVersion = \".*\"/espressoVersion = \"$espressoVersion\"/" build.gradle
sed -i "s/androidxAnnotationVersion = \".*\"/androidxAnnotationVersion = \"$androidxAnnotationVersion\"/" build.gradle
sed -i "s/androidxCompatVersion = \".*\"/androidxCompatVersion = \"$androidxCompatVersion\"/" build.gradle
sed -i "s/androidxCoreVersion = \".*\"/androidxCoreVersion = \"$androidxCoreVersion\"/" build.gradle
sed -i "s/androidxFragmentVersion = \".*\"/androidxFragmentVersion = \"$androidxFragmentVersion\"/" build.gradle
sed -i "s/androidxRecyclerVersion = \".*\"/androidxRecyclerVersion = \"$androidxRecyclerVersion\"/" build.gradle
sed -i "s/guavaVersion = \".*\"/guavaVersion = \"$guavaVersion\"/" build.gradle
sed -i "s/truthVersion = \".*\"/truthVersion = \"$truthVersion\"/" build.gradle
sed -i "s/compileSdkVersion .*/compileSdkVersion $compileSdkVersion/" app/build.gradle
sed -i "s/targetSdkVersion .*/targetSdkVersion $targetSdkVersion/" app/build.gradle
sed -i "s/uiAutomatorVersion = \".*\"/uiAutomatorVersion = \"$uiAutomatorVersion\"/" build.gradle
sed -i "s/robolectricVersion = \".*\"/robolectricVersion = \"$robolectricVersion\"/" build.gradle
if [ ! -z "$repourl" ]
then
sed -i "s/.*google()/ google()\n maven {\n url \"$repourl\"\n allowInsecureProtocol=true\n }/" build.gradle
fi
popd > /dev/null # Silent popd
done
echo
echo "All Converted"