@@ -29,19 +29,6 @@ function print_help() {
29
29
echo " Use -l {deps_list} for a comma-separated list of dependencies to test (Format: dep1=1.0,dep2=2.0)"
30
30
}
31
31
32
- # Function to parse a dependency string and append it to the Maven command
33
- function add_dependency_to_maven_command() {
34
- local dep_pair=$1
35
- if [[ ! " ${dep_pair} " =~ .* :.* :.* ]]; then
36
- echo " Malformed dependency string: ${dep_pair} . Expected format: {GroupID}:{ArtifactID}:{Version}:{MavenPropertyName}"
37
- exit 1
38
- fi
39
- local full_dependency=$( echo " ${dep_pair} " | rev | cut -d' :' -f2- | rev)
40
- local dependency=$( echo " ${dep_pair} " | rev | cut -d' :' -f1 | rev)
41
- local version=$( echo " ${full_dependency} " | awk -F' :' ' {print $NF}' )
42
- MAVEN_COMMAND+=" -D${dependency} .version=${version} "
43
- }
44
-
45
32
# Default to the upper bounds file in the root of the repo
46
33
file=' dependencies.txt'
47
34
dependency_list=' '
@@ -78,7 +65,10 @@ if [ -z "${dependency_list}" ]; then
78
65
if [[ " ${line} " =~ ^[[:space:]]* # ]] || [[ -z "${line}" ]]; then
79
66
continue
80
67
fi
81
- add_dependency_to_maven_command " ${line} "
68
+ # Format from `dependencies.txt`: {GroupID}:{ArtifactID}:{Version}:{MavenPropertyName}
69
+ dependency= $( echo " ${line} " | cut -d' :' -f4)
70
+ version= $( echo " ${line} " | cut -d' :' -f3)
71
+ MAVEN_COMMAND+= " -D${dependency} .version=${version} "
82
72
done < " ${UPPER_BOUND_DEPENDENCY_FILE} "
83
73
else # This else block means that a list of dependencies was inputted
84
74
# Set the Internal Field Separator (IFS) to a comma.
@@ -92,7 +82,10 @@ else # This else block means that a list of dependencies was inputted
92
82
if [ -z " ${DEP_PAIR} " ]; then
93
83
continue
94
84
fi
95
- add_dependency_to_maven_command " ${DEP_PAIR} "
85
+ # Format: {MavenPropertyName}:{Version}
86
+ dependency=$( echo " ${DEP_PAIR} " | cut -d' :' -f1)
87
+ version=$( echo " ${DEP_PAIR} " | cut -d' :' -f2)
88
+ MAVEN_COMMAND+=" -D${dependency} .version=${version} "
96
89
done
97
90
fi
98
91
0 commit comments