forked from kubernetes/cloud-provider-gcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script for merging LICENSE files
- Loading branch information
Andrew Lytvynov
committed
Sep 28, 2018
1 parent
64abd3a
commit cd32059
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
bazel-* | ||
MERGED_LICENSES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,8 @@ config_setting( | |
"RELEASE": "devel", | ||
}, | ||
) | ||
|
||
sh_binary( | ||
name = "merge_licenses", | ||
srcs = ["merge_licenses.sh"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -o xtrace | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
output_path=${BUILD_WORKING_DIRECTORY}/MERGED_LICENSES | ||
# Truncate file. | ||
echo >"${output_path}" | ||
|
||
for path in $(find ${BUILD_WORKING_DIRECTORY}/vendor/ -name LICENSE); do | ||
>&2 echo "adding ${path}"; | ||
# Trim working directory prefix from output. | ||
cat <<EOF >>"${output_path}" | ||
----------------------------------------------------------- | ||
${path#"$BUILD_WORKING_DIRECTORY"} | ||
------------------------------------------------------------ | ||
EOF | ||
cat "${path}" >>"${output_path}" | ||
echo >>"${output_path}" | ||
done |