@@ -29,19 +29,6 @@ function print_help() {
2929 echo " Use -l {deps_list} for a comma-separated list of dependencies to test (Format: dep1=1.0,dep2=2.0)"
3030}
3131
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-
4532# Default to the upper bounds file in the root of the repo
4633file=' dependencies.txt'
4734dependency_list=' '
@@ -78,7 +65,10 @@ if [ -z "${dependency_list}" ]; then
7865 if [[ " ${line} " =~ ^[[:space:]]* # ]] || [[ -z "${line}" ]]; then
7966 continue
8067 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} "
8272 done < " ${UPPER_BOUND_DEPENDENCY_FILE} "
8373else # This else block means that a list of dependencies was inputted
8474 # 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
9282 if [ -z " ${DEP_PAIR} " ]; then
9383 continue
9484 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} "
9689 done
9790fi
9891
0 commit comments