Skip to content

Commit 86cfdd7

Browse files
authored
Add copyright line when importing Analytics iOS headers, if missing (#780)
* Add copyright line to iOS headers * Make copyright conditional to whether the file already has one.
1 parent 562f5c7 commit 86cfdd7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/update-dependencies.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@ jobs:
108108
for ios_header in *.h; do
109109
# Each file in this directory matches a file in the Analytics iOS SDK.
110110
cp -vf "${podtmp}/${header_dir}/${ios_header}" .
111+
# If the file doesn't have a Google copyright, add one.
112+
if ! grep -q "^// Copyright [0-9]* Google LLC" "${ios_header}"; then
113+
copyright_line="// Copyright $(date +%Y) Google LLC\n"
114+
else
115+
copyright_line=
116+
fi
111117
# Add a note to each file about its source.
112-
sed -i~ 's|^/// @file|\n// Copied from Firebase Analytics iOS SDK '"${analytics_version}"'.\n\n/// @file|' "${ios_header}"
118+
sed -i~ "s|^/// @file|${copyright_line}\n// Copied from Firebase Analytics iOS SDK ${analytics_version}.\n\n/// @file|" "${ios_header}"
113119
rm -f "${ios_header}~" # remove backup file that sed generated
114120
python ../../scripts/format_code.py --f "${ios_header}"
115121
done

0 commit comments

Comments
 (0)