Files
hibernate-demo/embeddables/scripts/search-setting.sh
T

20 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Does the string "create_empty_composites" occur anywhere in the hibernate-core jar the build resolved?
# Writes output/10-setting-search.txt. Run after `mvn test` (or any build) so the jar is in ~/.m2.
set -euo pipefail
cd "$(dirname "$0")/.."
V=$(sed -n 's#.*<hibernate.version>\(.*\)</hibernate.version>.*#\1#p' pom.xml | head -1)
JAR="$HOME/.m2/repository/org/hibernate/orm/hibernate-core/$V/hibernate-core-$V.jar"
TMP=$(mktemp -d)
unzip -q -o "$JAR" -d "$TMP"
mkdir -p output
{
echo "# hibernate-core-$V.jar: every class and resource searched for the text 'create_empty_composites'"
echo "\$ grep -rl create_empty_composites <unzipped jar> | wc -l"
echo "$(grep -rl -a 'create_empty_composites' "$TMP" | wc -l)"
echo "\$ grep -rl 'hibernate.use_nationalized_character_data' <unzipped jar> | wc -l # control: a real setting is found"
echo "$(grep -rl -a 'hibernate.use_nationalized_character_data' "$TMP" | wc -l)"
} > output/10-setting-search.txt
rm -rf "$TMP"
cat output/10-setting-search.txt