Fix (?) for usage within maven, then checks for xpath and html2text for jacoco reporting

This commit is contained in:
2024-04-12 09:19:45 -05:00
parent bd01bed62f
commit eb47a4f3ab

View File

@ -245,8 +245,7 @@ echo " See also target/site/jacoco/index.html"
echo " and https://www.jacoco.org/jacoco/trunk/doc/counters.html" echo " and https://www.jacoco.org/jacoco/trunk/doc/counters.html"
echo "------------------------------------------------------------" echo "------------------------------------------------------------"
which xpath > /dev/null 2>&1 if which xpath > /dev/null 2>&1; then
if [ "$?" == "0" ]; then
echo "Element\nInstructions Missed\nInstruction Coverage\nBranches Missed\nBranch Coverage\nComplexity Missed\nComplexity Hit\nLines Missed\nLines Hit\nMethods Missed\nMethods Hit\nClasses Missed\nClasses Hit\n" > /tmp/$$.headers echo "Element\nInstructions Missed\nInstruction Coverage\nBranches Missed\nBranch Coverage\nComplexity Missed\nComplexity Hit\nLines Missed\nLines Hit\nMethods Missed\nMethods Hit\nClasses Missed\nClasses Hit\n" > /tmp/$$.headers
xpath -n -q -e '/html/body/table/tfoot/tr[1]/td/text()' target/site/jacoco/index.html > /tmp/$$.values xpath -n -q -e '/html/body/table/tfoot/tr[1]/td/text()' target/site/jacoco/index.html > /tmp/$$.values
paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}' paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}'
@ -255,8 +254,7 @@ else
echo "xpath is not installed. Jacoco coverage summary will not be produced here..."; echo "xpath is not installed. Jacoco coverage summary will not be produced here...";
fi fi
which html2text > /dev/null 2>&1 if which html2text > /dev/null 2>&1; then
if [ "$?" == "0" ]; then
echo "Untested classes, per Jacoco:" echo "Untested classes, per Jacoco:"
echo "-----------------------------" echo "-----------------------------"
for i in target/site/jacoco/*/index.html; do for i in target/site/jacoco/*/index.html; do