-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathlicenses-check
More file actions
executable file
·34 lines (26 loc) · 1006 Bytes
/
licenses-check
File metadata and controls
executable file
·34 lines (26 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
#
# Check that license files are up to date.
# This script regenerates the license files and compares them with the committed versions.
# If there are differences, it exits with an error.
set -e
# Store original files for comparison
TEMPDIR="$(mktemp -d)"
trap "rm -fr ${TEMPDIR}" EXIT
# Save original license markdown files
for goos in darwin linux windows; do
cp "third-party-licenses.${goos}.md" "${TEMPDIR}/"
done
# Save the state of third-party directory
cp -r third-party "${TEMPDIR}/third-party.orig"
# Regenerate using the same script
./script/licenses
# Check for any differences in workspace
if ! git diff --exit-code --quiet third-party-licenses.*.md third-party/; then
echo "License files are out of date:"
git diff third-party-licenses.*.md third-party/
echo ""
printf "\nLicense check failed.\n\nPlease update the license files by running \`./script/licenses\` and committing the output.\n"
exit 1
fi
echo "License check passed for all platforms."