Files
spring-boot-demo/boot42-upgrade/scripts/compile-broken.sh
T
Claude 5f85ec8d53 Add boot42-upgrade module: Spring Boot 4.2.0 GA vs 4.1.3 upgrade checklist
Re-runs the RC1 checklist on GA and adds SSL-bundle options on the LDAP client,
the migrator fail switch, OpenTelemetry convention spellings, migrated
RestClient/RestTestClient, compiler removal warnings for RestTemplate,
TestRestTemplate and Pulsar, and jar/BOM probes. Transcripts in output/.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b5G8Z7wYEQnr5w4DfG
2026-11-20 19:27:32 +00:00

34 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Compiles each file in src/broken/ with -Xlint:deprecation against the module classpath of the
# given pom (default pom.xml = 4.2.0; pass pom-41.xml for the 4.1.3 baseline) and stores the
# compiler's own messages in output/05-... and output/06-... (suffix -on-4.1.3 for the baseline).
set -u
cd "$(dirname "$0")/.."
POM="${1:-pom.xml}"
LABEL=$(grep -m1 '<boot.label>' "$POM" | sed -E 's/.*<boot.label>(.*)<\/boot.label>.*/\1/')
SUFFIX=""; [[ "$LABEL" == 4.2* ]] || SUFFIX="-on-$LABEL"
mvn -B -q -f "$POM" dependency:build-classpath -Dmdep.outputFile=target/cp.txt >/dev/null 2>&1
# spring-boot-pulsar is not a dependency of the module (it would auto-configure a Pulsar client);
# it is added to the compile classpath for UsesPulsarProperties only.
PULSAR="$HOME/.m2/repository/org/springframework/boot/spring-boot-pulsar/$LABEL/spring-boot-pulsar-$LABEL.jar"
[ -f "$PULSAR" ] || mvn -B -q dependency:get -Dartifact="org.springframework.boot:spring-boot-pulsar:$LABEL" >/dev/null 2>&1
CP="$(cat target/cp.txt):$PULSAR"
compile_one() { # <source> <outfile-base> <title>
local src="$1" base="$2" title="$3" out="output/$2$SUFFIX.txt"
rm -rf target/broken && mkdir -p target/broken
{
echo "# $base (Spring Boot $LABEL, JDK $(javac -version 2>&1 | grep -v Picked | awk '{print $2}'))"
echo "\$ javac -Xlint:deprecation -cp <module classpath> -d target/broken $src"
javac -Xlint:deprecation -cp "$CP" -d target/broken "$src" 2>&1 | grep -v '^Picked up' | sed -e "s#^$(pwd)/##"
echo "exit: ${PIPESTATUS[0]}"
} > "$out"
cat "$out"
}
compile_one src/broken/UsesRestTemplate.java 05-resttemplate-compiler-warnings "RestTemplate"
{ compile_one src/broken/UsesTestRestTemplate.java 06-testresttemplate-compiler-warnings "TestRestTemplate"; } >/dev/null
{ compile_one src/broken/UsesPulsarProperties.java 07-pulsar-compiler-warnings "Pulsar"; } >/dev/null
# The migrated form must compile with no [removal] warning at all.
{ compile_one src/main/java/com/ankurm/boot42up/PingClient.java 14-migrated-client-compiler "PingClient"; } >/dev/null