Browse Source
In order to automate maintenance of copyright headers in our source code (especially when merging PRs from external contributors), this commit introduces an update_copyright_headers.sh script (tested on mac OS) that will update the copyright headers of all Java, Kotlin, and Groovy source files that have been added or modified this year (or at least as far back as the git log history supports it). For example, running this script currently outputs the following. Updating copyright headers in Java, Kotlin, and Groovy source code for year 2022 warning: log for 'main' only goes back to Tue, 16 Aug 2022 16:24:55 +0200pull/29613/head
Sam Brannen
2 years ago
1 changed files with 15 additions and 0 deletions
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh |
||||
# |
||||
# This shell script updates the copyright headers in source code files |
||||
# in the current branch that have been added or modified during the |
||||
# current year (at least as much as the `git diff` command supports the |
||||
# date range in terms of log history). |
||||
# |
||||
# This has only been tested on mac OS. |
||||
|
||||
current_year=$(date +'%Y') |
||||
echo Updating copyright headers in Java, Kotlin, and Groovy source code for year $current_year |
||||
|
||||
for file in $(git --no-pager diff --name-only --diff-filter=AM @{$current_year-01-01}..@{$current_year-12-31} | egrep "^.+\.(java|kotlin|groovy)$" | uniq); do |
||||
sed -i '' -E "s/Copyright 2002-[0-9]{4}/Copyright 2002-$current_year/g" $file; |
||||
done |
Loading…
Reference in new issue