34 lines
723 B
Bash
Executable File
34 lines
723 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
|
|
|
|
mapfile -d '' -t source_files < <(
|
|
git -C "$ROOT" ls-files \
|
|
--cached \
|
|
--others \
|
|
--exclude-standard \
|
|
-z \
|
|
-- android |
|
|
LC_ALL=C sort -z
|
|
)
|
|
|
|
if [[ "${#source_files[@]}" -eq 0 ]]; then
|
|
echo "No Android source files were found." >&2
|
|
exit 1
|
|
fi
|
|
|
|
{
|
|
for relative_path in "${source_files[@]}"; do
|
|
absolute_path="$ROOT/$relative_path"
|
|
|
|
if [[ ! -f "$absolute_path" ]]; then
|
|
echo "Android source input is not a regular file: $relative_path" >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf '%s\0' "$relative_path"
|
|
sha256sum "$absolute_path" | awk '{print $1}'
|
|
done
|
|
} | sha256sum | awk '{print $1}'
|