Skip to content

Add copyright line when importing Analytics iOS headers, if missing #780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 2, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make copyright conditional to whether the file already has one.
  • Loading branch information
jonsimantov committed Dec 2, 2021
commit c8309eef00c3981cace34f9d94303c8db1dd97bc
8 changes: 7 additions & 1 deletion .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@ jobs:
for ios_header in *.h; do
# Each file in this directory matches a file in the Analytics iOS SDK.
cp -vf "${podtmp}/${header_dir}/${ios_header}" .
# If the file doesn't have a Google copyright, add one.
if ! grep -q '^// Copyright ' "${ios_header}"; then
copyright_line="// Copyright $(date +%Y) Google LLC\n"
else
copyright_line=
fi
# Add a note to each file about its source.
sed -i~ 's|^/// @file|// Copyright '"$(date +%Y)"' Google LLC\n\n// Copied from Firebase Analytics iOS SDK '"${analytics_version}"'.\n\n/// @file|' "${ios_header}"
sed -i~ "s|^/// @file|${copyright_line}\n// Copied from Firebase Analytics iOS SDK ${analytics_version}.\n\n/// @file|" "${ios_header}"
rm -f "${ios_header}~" # remove backup file that sed generated
python ../../scripts/format_code.py --f "${ios_header}"
done
Expand Down