|
#!/usr/bin/env bash |
|
|
|
|
|
# If you're interested in running this script yourself, make sure you've got a directory structure similar to the following: |
|
# blast$ ls jars/*.jar |
|
# jars/guardrail-cli_2.12-0.65.1-7-g388eba3-SNAPSHOT.jar jars/guardrail-java-spring-mvc_2.12-0.65.1-8-g388eba3-SNAPSHOT.jar jars/guardrail-scala-endpoints_2.12-0.65.1-8-g388eba3-SNAPSHOT.jar jars/guardrail_2.12-0.64.4.jar |
|
# jars/guardrail-core_2.12-0.65.3-8-g388eba3-SNAPSHOT.jar jars/guardrail-java-support_2.12-0.65.1-8-g388eba3-SNAPSHOT.jar jars/guardrail-scala-http4s_2.12-0.65.3-8-g388eba3-SNAPSHOT.jar jars/guardrail_2.12-0.65.3.jar |
|
# jars/guardrail-java-async-http_2.12-0.65.1-8-g388eba3-SNAPSHOT.jar jars/guardrail-scala-akka-http_2.12-0.65.1-8-g388eba3-SNAPSHOT.jar jars/guardrail-scala-support_2.12-0.65.1-8-g388eba3-SNAPSHOT.jar |
|
# jars/guardrail-java-dropwizard_2.12-0.65.1-8-g388eba3-SNAPSHOT.jar jars/guardrail-scala-dropwizard_2.12-0.65.1-8-g388eba3-SNAPSHOT.jar jars/guardrail_2.12-0.65.4-8-g388eba3-SNAPSHOT.jar |
|
|
|
for fname in *.jar; do |
|
module=${fname#guardrail-} |
|
module="${module%-*-SNAPSHOT.jar}" |
|
version=${module#*_2.12-} |
|
module="${module%_2.12-*}" |
|
echo "$module $version" |
|
unzip -l "jars/$fname" | grep -ho '[a-zA-Z/$0-9]*.class' > "${module}-${version}.txt" |
|
done |
|
|
|
module=guardrail |
|
version=0.64.4 |
|
fname="${module}_2.12-${version}.jar" |
|
unzip -l "jars/$fname" | grep -ho '[a-zA-Z/$0-9]*.class' > ../"${module}-${version}.txt" |
|
|
|
for fname in cli-0.65.1.txt core-0.65.3.txt guardrail-0.65.4.txt java-async-http-0.65.1.txt java-dropwizard-0.65.1.txt java-spring-mvc-0.65.1.txt java-support-0.65.1.txt scala-akka-http-0.65.1.txt scala-dropwizard-0.65.1.txt scala-endpoints-0.65.1.txt scala-http4s-0.65.3.txt scala-support-0.65.1.txt; do |
|
module="${fname%-0.65.*}" |
|
if true; then |
|
grep -Ff "$fname" guardrail-0.64.4.txt > "moved-to-$module.txt" |
|
if [ -s "moved-to-$module.txt" ]; then |
|
grep -Fvf "moved-to-$module.txt" "$fname" > "missing-$module.txt" |
|
else |
|
cat "$fname" > "missing-$module.txt" |
|
fi |
|
rm -f "missing-2-$module.txt" "missing-3-$module.txt" |
|
touch "missing-2-$module.txt" "missing-3-$module.txt" |
|
( cat "missing-$module.txt" | while read line; do |
|
( [ "${line##*/}" = "package.class" ] || [ "${line##*/}" = "package$.class" ] ) && continue |
|
if ! echo "$(grep -F "/${line##*/}" guardrail-0.64.4.txt) -> $line" | grep -v "^ -> " ; then |
|
echo "$line" >> "missing-2-$module.txt" |
|
fi |
|
done ) > "repackaged-in-$module.txt" |
|
grep -Fvf "missing-2-$module.txt" -f <(cut -f 3 -d ' ' "repackaged-in-$module.txt") "missing-$module.txt" > "lost-$module.txt" |
|
( cat "missing-2-$module.txt" | while read line; do |
|
[ "${line#*$}" = ".class" ] && continue |
|
[[ "$line" == *'$$anon$'* ]] && continue |
|
if ! echo "$(grep -F "\$${line#*$}" guardrail-0.64.4.txt) -> $line" | grep -v "^ -> " ; then |
|
echo "$line" >> "missing-3-$module.txt" |
|
fi |
|
done ) > "moved-to-object-$module.txt" |
|
grep -Fvf "missing-3-$module.txt" -f <(cut -f 3 -d ' ' "moved-to-object-$module.txt") "missing-2-$module.txt" > "lost-2-$module.txt" |
|
fi |
|
|
|
cat > "_notes-$module.md" <<! |
|
Classes that have been moved to $module with no repackaging: |
|
|
|
$(sed 's/^/ /' < "moved-to-$module.txt") |
|
|
|
Classes that have been moved to $module as well as repackaged: |
|
|
|
$(sed 's/^/ /' < "repackaged-in-$module.txt") |
|
|
|
Inner classes or defiitions that have been moved to new objects during the move to $module |
|
|
|
$(sed 's/^/ /' < "moved-to-object-$module.txt") |
|
|
|
References that weren't able to be located automatically: |
|
|
|
$(sed 's/^/ /' < "lost-$module.txt") |
|
$(sed 's/^/ /' < "lost-2-$module.txt") |
|
! |
|
|
|
done |