|
13 | 13 | # See the License for the specific language governing permissions and |
14 | 14 | # limitations under the License. |
15 | 15 |
|
16 | | -set -eo pipefail |
| 16 | +#set -eo pipefail |
17 | 17 |
|
18 | | -## Get the directory of the build script |
19 | | -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) |
| 18 | +## Helper functions |
20 | 19 | function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } |
21 | 20 | function msg() { println "$*" >&2; } |
22 | 21 | function println() { printf '%s\n' "$(now) $*"; } |
23 | 22 |
|
24 | | -function cleanup() { |
25 | | - rm .org-list.txt .new-list.txt .diff.txt |
26 | | -} |
27 | | - |
28 | | -## cd to the parent directory, i.e. the root of the git repo |
29 | | -cd ${scriptDir}/.. |
30 | | - |
31 | | -## Locally install artifacts |
32 | | -#mvn verify -DskipTests |
33 | | - |
34 | | -## Find client directory that continas flattened pom and cd into it |
35 | | -clientDir=$(find -iname ".flattened-pom.xml" | cut -d"/" -f1-2) |
36 | | -cd "$clientDir" |
37 | | - |
38 | 23 | ## Run dependency list completeness check |
| 24 | +function completenessCheck() { |
| 25 | + # cd into dir containing flattened pom |
| 26 | + cd "$1" || exit |
| 27 | + echo "checking in dir: $1" |
| 28 | + |
| 29 | + # Output dep list with compile scope generated using the original pom |
| 30 | + msg "Generating dependency list using original pom..." |
| 31 | + mvn dependency:list -f pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:compile' >.org-list.txt |
39 | 32 |
|
40 | | -# Output dep list with compile scope generated using the original pom |
41 | | -msg "Generating dependency list using original pom..." |
42 | | -mvn dependency:list -f pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:compile' >.org-list.txt |
| 33 | + # Output dep list generated using the flattened pom (test scope deps are ommitted) |
| 34 | + msg "Generating dependency list using flattened pom..." |
| 35 | + mvn dependency:list -f .flattened-pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt |
43 | 36 |
|
44 | | -# Output dep list with compile scope generated using the flattened pom |
45 | | -msg "Generating dependency list using flattened pom..." |
46 | | -mvn dependency:list -f .flattened-pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:compile' >.new-list.txt |
| 37 | + # Compare two dependency lists |
| 38 | + msg "Comparing dependency lists..." |
| 39 | + diff .org-list.txt .new-list.txt >.diff.txt && msg "Success. No diff!" || msg "Diff found. Check .diff.txt file located in $1. Exiting with exit code $?." && exit 1 |
47 | 40 |
|
48 | | -# Compare two dependency lists |
49 | | -msg "Comparing dependency lists..." |
50 | | -diff .org-list.txt .new-list.txt >.diff.txt && (msg "Success. No diff!" && cleanup) || (msg "Diff found: " && cat .diff.txt) |
| 41 | + # cd back to root of git repo |
| 42 | + cd .. |
| 43 | +} |
0 commit comments