#!/usr/bin/env bash # Facts that come from jars rather than from running the scenarios: # 12 what Spring Modulith's @ApplicationModuleListener is made of (read with javap) # 13 what DataSourceTransactionManager does when a transaction is cleaned up (read with javap) set -euo pipefail cd "$(dirname "$0")/.." mkdir -p output target/facts M2=~/.m2/repository MODULITH=2.1.1 # newest GA in maven-metadata.xml at the time of writing; 2.2.0-M1 is a milestone fetch() { # url, destination: Maven Central rate-limits shared addresses, so retry politely for i in 1 2 3 4 5 6; do code=$(curl -s -o "$2" -w '%{http_code}' "$1" || true) [ "$code" = 200 ] && return 0 sleep $((i * 10)) done echo "could not fetch $1 (last status $code)" >&2; return 1 } JAR=target/facts/spring-modulith-events-api-$MODULITH.jar [ -s "$JAR" ] || fetch "https://repo1.maven.org/maven2/org/springframework/modulith/spring-modulith-events-api/$MODULITH/spring-modulith-events-api-$MODULITH.jar" "$JAR" SPRING=7.0.9 CP="$JAR" for a in spring-core spring-context spring-tx spring-aop spring-beans; do CP="$CP:$(find "$M2/org/springframework/$a/$SPRING" -name "$a-$SPRING.jar" | head -1)" done { echo "# spring-modulith-events-api $MODULITH: the annotations that @ApplicationModuleListener carries (reflection)" echo java -cp "$CP" scripts/facts/PrintAnnotations.java org.springframework.modulith.events.ApplicationModuleListener 2>/dev/null \ | grep -E 'Async|Transactional' } > output/12-modulith-application-module-listener.txt cat output/12-modulith-application-module-listener.txt SPRINGJDBC=$(find "$M2/org/springframework/spring-jdbc/7.0.9" -name 'spring-jdbc-7.0.9.jar' | head -1) rm -rf target/facts/jdbc && mkdir -p target/facts/jdbc unzip -o -q "$SPRINGJDBC" 'org/springframework/jdbc/datasource/DataSourceTransactionManager.class' -d target/facts/jdbc { echo "# DataSourceTransactionManager.doCleanupAfterCompletion in spring-jdbc 7.0.9: the calls it makes (javap -c)" echo javap -c -p -cp target/facts/jdbc org.springframework.jdbc.datasource.DataSourceTransactionManager \ | awk '/void doCleanupAfterCompletion/,/resetConnectionAfterTransaction/' | grep -E 'invoke' | sed -E 's/^.*\/\/ (Interface)?Method //' } > output/13-transaction-cleanup-calls.txt cat output/13-transaction-cleanup-calls.txt