Last active
June 15, 2022 05:55
-
-
Save akuma/380d76be0662fb3e08e8eaa7d5b38563 to your computer and use it in GitHub Desktop.
Diff maven module libs between two branches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
module=$1 | |
branch_a=$2 | |
branch_b=$3 | |
lib_a="${module}_a.lib" | |
lib_b="${module}_b.lib" | |
info=$4 | |
usage="usage: maven-lib-diff <maven module> <branch a> <branch b> [--info]" | |
if [ -z "$module" ]; then | |
echo $usage | |
echo | |
echo "maven module is empty" | |
exit 0 | |
fi | |
if [ -z "$branch_a" ]; then | |
echo $usage | |
echo | |
echo "branch a is empty" | |
exit 0 | |
fi | |
if [ -z "$branch_b" ]; then | |
echo $usage | |
echo | |
echo "branch b is empty" | |
exit 0 | |
fi | |
is_quiet="" | |
if [ "$info" != "--info" ]; then | |
is_quiet="--quiet" | |
fi | |
echo "=== diff module ===" | |
echo | |
echo $module | |
echo | |
echo "=== diff branches ===" | |
echo | |
echo "branch a: $branch_a" | |
echo "branch b: $branch_b" | |
echo | |
git checkout $is_quiet $branch_a && \ | |
echo | |
mvn -DskipTests=true $is_quiet install && \ | |
mvn dependency:resolve -pl $module | grep ":compile" | awk '{ print $2 }' | sort > $lib_a | |
echo | |
git checkout $is_quiet $branch_b && \ | |
echo | |
mvn -DskipTests=true $is_quiet install && \ | |
mvn dependency:resolve -pl $module | grep ":compile" | awk '{ print $2 }' | sort > $lib_b | |
echo | |
echo "=== diff result ===" | |
echo | |
diff -u $lib_a $lib_b | diff-so-fancy | |
rm -r $lib_a $lib_b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment