#!/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 '' "$POM" | sed -E 's/.*(.*)<\/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() { # 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