Skip to content

Commit ddaf370

Browse files
update based on comments
1 parent 07f44f0 commit ddaf370

File tree

2 files changed

+32
-26
lines changed

2 files changed

+32
-26
lines changed

.kokoro/completeness-check.sh

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,31 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
set -eo pipefail
16+
#set -eo pipefail
1717

18-
## Get the directory of the build script
19-
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
18+
## Helper functions
2019
function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; }
2120
function msg() { println "$*" >&2; }
2221
function println() { printf '%s\n' "$(now) $*"; }
2322

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-
3823
## 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
3932

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
4336

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
4740

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+
}

.kokoro/dependencies.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,16 @@ retry_with_backoff 3 10 \
3636
-Dclirr.skip=true
3737

3838
mvn -B dependency:analyze -DfailOnWarning=true
39+
40+
echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************"
41+
source ${scriptDir}/completeness-check.sh
42+
43+
## Locally install artifacts
44+
mvn verify -DskipTests
45+
46+
for path in $(find -name ".flattened-pom.xml")
47+
do
48+
dir=$(dirname "$path")
49+
# Check flattened pom in each dir that contains it for completeness
50+
completenessCheck "$dir"
51+
done

0 commit comments

Comments
 (0)