-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync_versions.sh
More file actions
executable file
·95 lines (83 loc) · 3.31 KB
/
sync_versions.sh
File metadata and controls
executable file
·95 lines (83 loc) · 3.31 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
RED="$(tput setaf 1)" && readonly RED
GREEN="$(tput setaf 2)" && readonly GREEN
YELLOW="$(tput setaf 3)" && readonly YELLOW
END="$(tput sgr0)" && readonly END
warn() { echo "$YELLOW$*$END"; } >&2
die() { echo; echo "$RED$*$END"; echo; exit 1; } >&2
SOURCE_ROOT="$(cd "$(dirname "$0")" && pwd)" && readonly SOURCE_ROOT
declare -a PROJECTS=(
"$(cd "$SOURCE_ROOT/android-application" && pwd)"
"$(cd "$SOURCE_ROOT/android-library" && pwd)"
"$(cd "$SOURCE_ROOT/gradle-plugin" && pwd)"
"$(cd "$SOURCE_ROOT/jvm-application" && pwd)"
"$(cd "$SOURCE_ROOT/jvm-library" && pwd)"
) && readonly PROJECTS
GRADLE_WRAPPER_FILE='gradle/wrapper/gradle-wrapper.properties' && \
readonly GRADLE_WRAPPER_FILE
LIBS_FILE='gradle/libs.versions.toml' && readonly LIBS_FILE
update_gradle_wrapper() {
perl -i -pe "s|^$1=.*$|$1=$2|" "$GRADLE_WRAPPER_FILE"
}
update_libs() {
perl -i -pe "s|^$1 = \".*\"|$1 = \"$2\"|" "$LIBS_FILE"
}
for project in "${PROJECTS[@]}"; do
warn "Syncing $project..."
echo '(1/4) Generating Gradle wrapper'
cd "$project" || exit 1
update_gradle_wrapper \
'distributionUrl' \
'https\\\://services.gradle.org/distributions/gradle-9.4.1-bin.zip'
./gradlew -q wrapper
echo '(2/4) Updating base'
update_libs 'java-compile' '21'
update_libs 'java-support' '8'
update_libs 'checkstyle' '11.1.0'
update_libs 'git-publish' 'org.ajoberstar.git-publish:6.0.0'
update_libs 'pages' 'com.hanggrian.pages:0.3'
update_libs \
'rulebook-checkstyle' \
'com.hanggrian.rulebook:rulebook-checkstyle:0.2'
update_libs 'truth' 'com.google.truth:truth:1.4.5'
mockito_version='5.23.0'
dagger_version='2.59.2'
if [[ "$project" == *'android-'* ]]; then
echo '(3/4) Updating Android'
update_libs 'hilt' "$dagger_version"
update_libs 'android-compile' '36'
update_libs 'android-support' '21'
update_libs 'android-plugin' '9.1.0'
update_libs 'material' 'com.google.android.material:material:1.13.0'
update_libs 'androidx-appcompat' 'androidx.appcompat:appcompat:1.7.1'
update_libs 'androidx-core' 'androidx.core:core:1.17.0'
update_libs 'androidx-test-core' 'androidx.test:core:1.7.0'
update_libs 'androidx-test-runner' 'androidx.test:runner:1.7.0'
update_libs 'androidx-test-junit' 'androidx.test.ext:junit:1.3.0'
update_libs 'leakcanary' 'com.squareup.leakcanary:leakcanary-android:2.14'
update_libs 'mockito-core' "org.mockito:mockito-core:$mockito_version"
update_libs 'robolectric' 'org.robolectric:robolectric:4.16.1'
elif [[ "$project" == *'jvm-'* ]]; then
echo '(3/4) Updating JVM'
update_libs 'dagger' "$dagger_version"
update_libs 'junit' '5.14.3'
update_libs \
'junit-platform-launcher' \
'org.junit.platform:junit-platform-launcher:1.14.3'
update_libs \
'mockito-junit-jupiter' \
"org.mockito:mockito-junit-jupiter:$mockito_version"
else
echo '(3/4) Updating Gradle Publish'
update_libs 'gradle-publish' 'com.gradle.plugin-publish:2.1.1'
update_libs 'junit' 'junit:junit:4.13.2'
update_libs 'mockito-core' "org.mockito:mockito-core:$mockito_version"
fi
if [[ "$project" == *'-library' ]]; then
echo '(4/4) Updating Maven Publish'
update_libs 'maven-publish' 'com.vanniktech.maven.publish.base:0.36.0'
else
echo '(4/4) Skip Maven Publish'
fi
done
echo "${GREEN}Sync complete.$END"