Files
spring-boot-demo/boot42-rc1-checklist/scripts/compile-broken.sh
T

21 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Compiles src/broken/UsesRestTemplate.java with -Xlint:deprecation against the module classpath
# of the given pom (default pom.xml = 4.2.0-RC1; pass pom-41.xml for the 4.1.2 baseline) and
# stores the compiler's own message in output/05-resttemplate-compiler-warnings[-on-4.1.2].txt.
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"
OUT="output/05-resttemplate-compiler-warnings$SUFFIX.txt"
mvn -B -q -f "$POM" dependency:build-classpath -Dmdep.outputFile=target/cp.txt >/dev/null 2>&1
rm -rf target/broken && mkdir -p target/broken
{
echo "# 05-resttemplate-compiler-warnings (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/broken/UsesRestTemplate.java'
javac -Xlint:deprecation -cp "$(cat target/cp.txt)" -d target/broken src/broken/UsesRestTemplate.java 2>&1 \
| grep -v '^Picked up' | sed -e "s#^$(pwd)/##"
echo "exit: ${PIPESTATUS[0]}"
} > "$OUT"
cat "$OUT"