-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathpublishToMaven.sh
executable file
·70 lines (59 loc) · 1.6 KB
/
publishToMaven.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
#!/bin/bash
# Stop the script if any command fails
set -e
# Default publishing task
PUBLISH_TASK="publishToMavenLocal"
# Check for the --remote flag
if [ "$1" == "--remote" ]; then
PUBLISH_TASK="publishAllPublicationsToMavenCentralRepository"
shift
fi
# Default build types if none are passed
default_build_types=("core" "io" "korlibs" "kotlinx" "okio" "ktor2")
# If build types are passed, use them; otherwise, use the default list
if [ "$#" -ge 1 ]; then
build_types=("$@")
else
build_types=("${default_build_types[@]}")
fi
# Function to add projects based on the key
add_projects_based_on_key() {
local key="$1"
case "$key" in
"core")
projects=("ksoup")
;;
"io")
projects=("ksoup-io")
;;
"kotlinx")
projects=("ksoup-kotlinx" "ksoup-network")
;;
"korlibs")
projects=("ksoup-korlibs" "ksoup-network-korlibs")
;;
"ktor2")
projects=("ksoup-network-ktor2")
;;
"okio")
projects=("ksoup-okio")
;;
*)
echo "Unknown key: $key"
exit 1
;;
esac
}
# Loop through all projects and publish them
for buildType in "${build_types[@]}"; do
add_projects_based_on_key "$buildType"
# clean build
# echo "clean build"
# ./gradlew clean --quiet --warning-mode=none
for projectName in "${projects[@]}"; do
echo "*****buildType: $buildType, project: $projectName"
echo "Publishing $projectName with libBuildType=$buildType"
./gradlew ":$projectName:$PUBLISH_TASK" -PlibBuildType="$buildType" --quiet --warning-mode=none --no-configuration-cache
done
done
echo "Publishing completed successfully."