#!/usr/bin/env bash # Facts read straight out of the MapStruct processor jar (output/25). set -euo pipefail cd "$(dirname "$0")/.." MS=${MAPSTRUCT_VERSION:-1.6.3} JAR=$HOME/.m2/repository/org/mapstruct/mapstruct-processor/$MS/mapstruct-processor-$MS.jar mkdir -p output target/facts rm -rf target/facts/p && mkdir -p target/facts/p unzip -o -q "$JAR" 'org/mapstruct/ap/MappingProcessor*' -d target/facts/p { echo "# mapstruct-processor $MS: what the jar itself declares" echo echo "--- META-INF/services/javax.annotation.processing.Processor (comments dropped) ---" unzip -p "$JAR" META-INF/services/javax.annotation.processing.Processor | tr -d '\r' | grep -v '^#' | grep -v '^$' echo echo "--- Implementation-Version in the manifest ---" unzip -p "$JAR" META-INF/MANIFEST.MF | tr -d '\r' | grep '^Implementation-Version' echo echo "--- options the processor accepts (-Akey=value), from @SupportedOptions via javap ---" javap -v -cp target/facts/p org.mapstruct.ap.MappingProcessor | tr -d '\r' | grep -o 'Utf8 *mapstruct\.[A-Za-z.]*' | sed 's/Utf8 *//' | sort -u } > output/25-processor-jar-facts.txt echo "wrote output/25-processor-jar-facts.txt"