From 251b42e622ad6eb590823acad464a35f224092b8 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Sun, 13 Jun 2021 22:29:12 +0900 Subject: [PATCH 01/17] Add AddLicense.sh --- Tools/AddLicense/AddLicense.sh | 87 ++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Tools/AddLicense/AddLicense.sh diff --git a/Tools/AddLicense/AddLicense.sh b/Tools/AddLicense/AddLicense.sh new file mode 100644 index 000000000..8dae0b743 --- /dev/null +++ b/Tools/AddLicense/AddLicense.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +function addLicense() { + local MPL=( + 'This Source Code Form is subject to the terms of the Mozilla Public' + 'License, v. 2.0. If a copy of the MPL was not distributed with this' + 'file, You can obtain one at https://mozilla.org/MPL/2.0/.' + ) + local comment='' + local lineNumber=1 + + # 各種ファイルに適したコメントを生成する処理 + if [ "$1" == '*.axml' ]; then + comment='\\n\n' + lineNumber=2 # XML 宣言の後に挿入する + + elif [ "$1" == '*.bat' ]; then + comment=$(printf '@REM %s\\n' "${MPL[@]}") + + elif [ "$1" == '*.cs' ]; then + comment=$(printf '// %s\\n' "${MPL[@]}") + + elif [ "$1" == '*.feature' ]; then + comment=$(printf '# %s\\n' "${MPL[@]}") + + elif [ "$1" == '*.resx' ]; then + comment='\\n\n' + lineNumber=2 # XML 宣言の後に挿入する + + elif [ "$1" == '*.sh' ]; then + comment='\\n'$(printf '# %s\\n' "${MPL[@]}") + lineNumber=2 # Shebang の後に挿入する + + elif [ "$1" == '*.storyboard' ]; then + comment='\\n\n' + lineNumber=2 # XML 宣言の後に挿入する + + elif [ "$1" == '*.strings' ]; then + comment='\\n/*\n'$(printf ' %s\\n' "${MPL[@]}")'*/\n' + + elif [ "$1" == '*.tf' ]; then + comment=$(printf '# %s\\n' "${MPL[@]}") + + elif [ "$1" == '*.xaml' ]; then + comment='\\n\n' + lineNumber=2 # XML 宣言の後に挿入する + + elif [ "$1" == '*.xlf' ]; then + comment='\\n\n' + lineNumber=2 # XML 宣言の後に挿入する + + elif [ "$1" == '*.xml' ]; then + comment='\\n\n' + lineNumber=2 # XML 宣言の後に挿入する + + elif [ "$1" == '*.yml' ]; then + comment=$(printf '# %s\\n' "${MPL[@]}") + fi + + # ライセンスの文言が無いファイルを探し,もしあれば生成したコメントを挿入する + git grep -z -L "${MPL[1]}" -- "$1" | xargs -0 sed -i -e "${lineNumber}i$comment" +} + +# 対象ファイル +FILES=( + '*.axml' + '*.bat' + '*.cs' + '*.feature' + '*.resx' + '*.sh' + '*.storyboard' + '*.strings' + '*.tf' + '*.xaml' + '*.xlf' + '*.xml' + '*.yml' +) + +for item in "${FILES[@]}"; do + addLicense "$item" +done From e9b276783c8a39dff9d4f0830f606cb7acb1e9dd Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Mon, 14 Jun 2021 18:25:21 +0900 Subject: [PATCH 02/17] Modify AddLicense.sh --- Tools/AddLicense/AddLicense.sh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Tools/AddLicense/AddLicense.sh b/Tools/AddLicense/AddLicense.sh index 8dae0b743..e92b46ce2 100644 --- a/Tools/AddLicense/AddLicense.sh +++ b/Tools/AddLicense/AddLicense.sh @@ -11,58 +11,59 @@ function addLicense() { 'file, You can obtain one at https://mozilla.org/MPL/2.0/.' ) local comment='' + local fileType=${1##*.} local lineNumber=1 # 各種ファイルに適したコメントを生成する処理 - if [ "$1" == '*.axml' ]; then + if [ "$fileType" == 'axml' ]; then comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する - elif [ "$1" == '*.bat' ]; then + elif [ "$fileType" == 'bat' ]; then comment=$(printf '@REM %s\\n' "${MPL[@]}") - elif [ "$1" == '*.cs' ]; then + elif [ "$fileType" == 'cs' ]; then comment=$(printf '// %s\\n' "${MPL[@]}") - elif [ "$1" == '*.feature' ]; then + elif [ "$fileType" == 'feature' ]; then comment=$(printf '# %s\\n' "${MPL[@]}") - elif [ "$1" == '*.resx' ]; then + elif [ "$fileType" == 'resx' ]; then comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する - elif [ "$1" == '*.sh' ]; then + elif [ "$fileType" == 'sh' ]; then comment='\\n'$(printf '# %s\\n' "${MPL[@]}") lineNumber=2 # Shebang の後に挿入する - elif [ "$1" == '*.storyboard' ]; then + elif [ "$fileType" == 'storyboard' ]; then comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する - elif [ "$1" == '*.strings' ]; then + elif [ "$fileType" == 'strings' ]; then comment='\\n/*\n'$(printf ' %s\\n' "${MPL[@]}")'*/\n' - elif [ "$1" == '*.tf' ]; then + elif [ "$fileType" == 'tf' ]; then comment=$(printf '# %s\\n' "${MPL[@]}") - elif [ "$1" == '*.xaml' ]; then + elif [ "$fileType" == 'xaml' ]; then comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する - elif [ "$1" == '*.xlf' ]; then + elif [ "$fileType" == 'xlf' ]; then comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する - elif [ "$1" == '*.xml' ]; then + elif [ "$fileType" == 'xml' ]; then comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する - elif [ "$1" == '*.yml' ]; then + elif [ "$fileType" == 'yml' ]; then comment=$(printf '# %s\\n' "${MPL[@]}") fi # ライセンスの文言が無いファイルを探し,もしあれば生成したコメントを挿入する - git grep -z -L "${MPL[1]}" -- "$1" | xargs -0 sed -i -e "${lineNumber}i$comment" + git grep -z -L "${MPL[0]}" -- "$1" | xargs -0 sed -i -e "${lineNumber}i$comment" } # 対象ファイル @@ -82,6 +83,6 @@ FILES=( '*.yml' ) -for item in "${FILES[@]}"; do - addLicense "$item" +for file in "${FILES[@]}"; do + addLicense "$file" done From 6ddae8e18e55ff74c8b5e3d5dc0113c729b32bc5 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Mon, 14 Jun 2021 21:18:24 +0900 Subject: [PATCH 03/17] Separated processing in AddLicense.sh into two --- Tools/AddLicense/AddLicense.sh | 25 ++--------------------- Tools/AddLicense/CheckAllFiles.sh | 34 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 Tools/AddLicense/CheckAllFiles.sh diff --git a/Tools/AddLicense/AddLicense.sh b/Tools/AddLicense/AddLicense.sh index e92b46ce2..97579f83b 100644 --- a/Tools/AddLicense/AddLicense.sh +++ b/Tools/AddLicense/AddLicense.sh @@ -14,7 +14,7 @@ function addLicense() { local fileType=${1##*.} local lineNumber=1 - # 各種ファイルに適したコメントを生成する処理 + # 各種ファイルに適したコメントを生成する if [ "$fileType" == 'axml' ]; then comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する @@ -62,27 +62,6 @@ function addLicense() { comment=$(printf '# %s\\n' "${MPL[@]}") fi - # ライセンスの文言が無いファイルを探し,もしあれば生成したコメントを挿入する + # ライセンスの文言が無いファイルを探し,該当するものに生成したコメントを挿入する git grep -z -L "${MPL[0]}" -- "$1" | xargs -0 sed -i -e "${lineNumber}i$comment" } - -# 対象ファイル -FILES=( - '*.axml' - '*.bat' - '*.cs' - '*.feature' - '*.resx' - '*.sh' - '*.storyboard' - '*.strings' - '*.tf' - '*.xaml' - '*.xlf' - '*.xml' - '*.yml' -) - -for file in "${FILES[@]}"; do - addLicense "$file" -done diff --git a/Tools/AddLicense/CheckAllFiles.sh b/Tools/AddLicense/CheckAllFiles.sh new file mode 100644 index 000000000..352cce7e2 --- /dev/null +++ b/Tools/AddLicense/CheckAllFiles.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +# リポジトリ内のファイルについて MPL の記載漏れをチェックします。 +# 詳しい処理につきましては Tools/GitHooks/PreCommit.sh をご参照ください。 + +# `addLicense` の読み込み +source Tools/GitHooks/PreCommit.sh + +# 対象ファイル +FILES=( + '*.axml' + '*.bat' + '*.cs' + '*.feature' + '*.resx' + '*.sh' + '*.storyboard' + '*.strings' + '*.tf' + '*.xaml' + '*.xlf' + '*.xml' + '*.yml' +) + +# 対象ファイルの内,MPL が抜けているもの対して文言を挿入する +for file in "${FILES[@]}"; do + addLicense "$file" + git add "$file" +done From 3fc8e5fd2234e7963e84b9d3a7655e78ee2e93be Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Mon, 14 Jun 2021 21:18:31 +0900 Subject: [PATCH 04/17] Add a script for pre-commit and its installer --- Tools/GitHooks/PreCommit.sh | 21 +++++++++++++++++++++ Tools/GitHooks/PrepareHooks.sh | 12 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Tools/GitHooks/PreCommit.sh create mode 100644 Tools/GitHooks/PrepareHooks.sh diff --git a/Tools/GitHooks/PreCommit.sh b/Tools/GitHooks/PreCommit.sh new file mode 100644 index 000000000..d9cbe8c18 --- /dev/null +++ b/Tools/GitHooks/PreCommit.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +# Commit 時に MPL の記載漏れをチェックします。 +# 有効化するには,GitHooks.sh を実行する必要があります。 +# 詳しい処理につきましては Tools/GitHooks/PreCommit.sh をご参照ください。 + +# `addLicense` の読み込み +source Tools/GitHooks/PreCommit.sh + +# ステージングエリアのファイル一覧を取得(削除を除く) +stagedFiles=$(git diff --name-only --cached --diff-filter=d) + +# 対象ファイルの内,MPL が抜けているもの対して文言を挿入する +for file in $stagedFiles; do + addLicense "$file" + git add "$file" +done diff --git a/Tools/GitHooks/PrepareHooks.sh b/Tools/GitHooks/PrepareHooks.sh new file mode 100644 index 000000000..bfc5d0237 --- /dev/null +++ b/Tools/GitHooks/PrepareHooks.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +# pre-commit 用のスクリプトを追加 +cp Tools/GitHooks/PreCommit.sh .git/hooks/pre-commit +chmod a+x .git/hooks/pre-commit + +# 追加した Git Hooks を有効にする +git init From edfbbfcdc0473bcfc46c625bc4996c80e091751f Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Mon, 14 Jun 2021 22:26:30 +0900 Subject: [PATCH 05/17] Set the repository root as the initial directory --- Tools/AddLicense/CheckAllFiles.sh | 5 ++++- Tools/GitHooks/PreCommit.sh | 3 +++ Tools/GitHooks/PrepareHooks.sh | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Tools/AddLicense/CheckAllFiles.sh b/Tools/AddLicense/CheckAllFiles.sh index 352cce7e2..d1166a496 100644 --- a/Tools/AddLicense/CheckAllFiles.sh +++ b/Tools/AddLicense/CheckAllFiles.sh @@ -7,10 +7,13 @@ # リポジトリ内のファイルについて MPL の記載漏れをチェックします。 # 詳しい処理につきましては Tools/GitHooks/PreCommit.sh をご参照ください。 +# リポジトリのルートへ移動 +cd "$(git rev-parse --show-toplevel)" || exit + # `addLicense` の読み込み source Tools/GitHooks/PreCommit.sh -# 対象ファイル +# 対象ファイル(リポジトリのルートを基準とした相対パスで記述) FILES=( '*.axml' '*.bat' diff --git a/Tools/GitHooks/PreCommit.sh b/Tools/GitHooks/PreCommit.sh index d9cbe8c18..3d6f293f3 100644 --- a/Tools/GitHooks/PreCommit.sh +++ b/Tools/GitHooks/PreCommit.sh @@ -8,6 +8,9 @@ # 有効化するには,GitHooks.sh を実行する必要があります。 # 詳しい処理につきましては Tools/GitHooks/PreCommit.sh をご参照ください。 +# リポジトリのルートへ移動 +cd "$(git rev-parse --show-toplevel)" || exit + # `addLicense` の読み込み source Tools/GitHooks/PreCommit.sh diff --git a/Tools/GitHooks/PrepareHooks.sh b/Tools/GitHooks/PrepareHooks.sh index bfc5d0237..7e78d7f8e 100644 --- a/Tools/GitHooks/PrepareHooks.sh +++ b/Tools/GitHooks/PrepareHooks.sh @@ -4,6 +4,9 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. +# リポジトリのルートへ移動 +cd "$(git rev-parse --show-toplevel)" || exit + # pre-commit 用のスクリプトを追加 cp Tools/GitHooks/PreCommit.sh .git/hooks/pre-commit chmod a+x .git/hooks/pre-commit From 6765ccde4971b15f38885b6e298cade596dc7c72 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Mon, 14 Jun 2021 23:06:48 +0900 Subject: [PATCH 06/17] Fix source path --- Tools/AddLicense/CheckAllFiles.sh | 4 ++-- Tools/GitHooks/PreCommit.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tools/AddLicense/CheckAllFiles.sh b/Tools/AddLicense/CheckAllFiles.sh index d1166a496..2dde95a19 100644 --- a/Tools/AddLicense/CheckAllFiles.sh +++ b/Tools/AddLicense/CheckAllFiles.sh @@ -5,13 +5,13 @@ # file, You can obtain one at https://mozilla.org/MPL/2.0/. # リポジトリ内のファイルについて MPL の記載漏れをチェックします。 -# 詳しい処理につきましては Tools/GitHooks/PreCommit.sh をご参照ください。 +# 詳しい処理につきましては Tools/AddLicense/AddLicense.sh をご参照ください。 # リポジトリのルートへ移動 cd "$(git rev-parse --show-toplevel)" || exit # `addLicense` の読み込み -source Tools/GitHooks/PreCommit.sh +source Tools/AddLicense/AddLicense.sh # 対象ファイル(リポジトリのルートを基準とした相対パスで記述) FILES=( diff --git a/Tools/GitHooks/PreCommit.sh b/Tools/GitHooks/PreCommit.sh index 3d6f293f3..7f2b7a217 100644 --- a/Tools/GitHooks/PreCommit.sh +++ b/Tools/GitHooks/PreCommit.sh @@ -6,13 +6,13 @@ # Commit 時に MPL の記載漏れをチェックします。 # 有効化するには,GitHooks.sh を実行する必要があります。 -# 詳しい処理につきましては Tools/GitHooks/PreCommit.sh をご参照ください。 +# 詳しい処理につきましては Tools/AddLicense/AddLicense.sh をご参照ください。 # リポジトリのルートへ移動 cd "$(git rev-parse --show-toplevel)" || exit # `addLicense` の読み込み -source Tools/GitHooks/PreCommit.sh +source Tools/AddLicense/AddLicense.sh # ステージングエリアのファイル一覧を取得(削除を除く) stagedFiles=$(git diff --name-only --cached --diff-filter=d) From d375985c80ab771b2b734ee3916a6a71d5796526 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Mon, 14 Jun 2021 23:54:41 +0900 Subject: [PATCH 07/17] Exclude xlf files --- Tools/AddLicense/AddLicense.sh | 4 ---- Tools/AddLicense/CheckAllFiles.sh | 1 - 2 files changed, 5 deletions(-) diff --git a/Tools/AddLicense/AddLicense.sh b/Tools/AddLicense/AddLicense.sh index 97579f83b..cae2b2c56 100644 --- a/Tools/AddLicense/AddLicense.sh +++ b/Tools/AddLicense/AddLicense.sh @@ -50,10 +50,6 @@ function addLicense() { comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する - elif [ "$fileType" == 'xlf' ]; then - comment='\\n\n' - lineNumber=2 # XML 宣言の後に挿入する - elif [ "$fileType" == 'xml' ]; then comment='\\n\n' lineNumber=2 # XML 宣言の後に挿入する diff --git a/Tools/AddLicense/CheckAllFiles.sh b/Tools/AddLicense/CheckAllFiles.sh index 2dde95a19..bfcd59093 100644 --- a/Tools/AddLicense/CheckAllFiles.sh +++ b/Tools/AddLicense/CheckAllFiles.sh @@ -25,7 +25,6 @@ FILES=( '*.strings' '*.tf' '*.xaml' - '*.xlf' '*.xml' '*.yml' ) From 05b89e5e308bc005aef8ba35902da7e6cfe8b827 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Wed, 16 Jun 2021 23:21:03 +0900 Subject: [PATCH 08/17] Modify comment in PreCommit.sh --- Tools/GitHooks/PreCommit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/GitHooks/PreCommit.sh b/Tools/GitHooks/PreCommit.sh index 7f2b7a217..ecb67bb2f 100644 --- a/Tools/GitHooks/PreCommit.sh +++ b/Tools/GitHooks/PreCommit.sh @@ -5,7 +5,7 @@ # file, You can obtain one at https://mozilla.org/MPL/2.0/. # Commit 時に MPL の記載漏れをチェックします。 -# 有効化するには,GitHooks.sh を実行する必要があります。 +# あらかじめ Tools/GitHooks/PrepareHooks.sh を実行する必要があります。 # 詳しい処理につきましては Tools/AddLicense/AddLicense.sh をご参照ください。 # リポジトリのルートへ移動 From 07c50602bc98f421923ceeee60a3fcdd760d0a99 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Tue, 22 Jun 2021 06:18:42 +0900 Subject: [PATCH 09/17] Remove `git add` in CheckAllFiles.sh --- Tools/AddLicense/CheckAllFiles.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/Tools/AddLicense/CheckAllFiles.sh b/Tools/AddLicense/CheckAllFiles.sh index bfcd59093..7ca92fe71 100644 --- a/Tools/AddLicense/CheckAllFiles.sh +++ b/Tools/AddLicense/CheckAllFiles.sh @@ -32,5 +32,4 @@ FILES=( # 対象ファイルの内,MPL が抜けているもの対して文言を挿入する for file in "${FILES[@]}"; do addLicense "$file" - git add "$file" done From fb4ef2c60eda76f55967a99c104bb8641223bc82 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Tue, 22 Jun 2021 23:19:30 +0900 Subject: [PATCH 10/17] Exclude no MPL-licensed file --- Tools/AddLicense/AddLicense.sh | 8 ++- Tools/AddLicense/CheckAllFiles.sh | 8 ++- Tools/AddLicense/Exclusions.txt | 103 ++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 5 deletions(-) create mode 100644 Tools/AddLicense/Exclusions.txt diff --git a/Tools/AddLicense/AddLicense.sh b/Tools/AddLicense/AddLicense.sh index cae2b2c56..66bc72b07 100644 --- a/Tools/AddLicense/AddLicense.sh +++ b/Tools/AddLicense/AddLicense.sh @@ -58,6 +58,10 @@ function addLicense() { comment=$(printf '# %s\\n' "${MPL[@]}") fi - # ライセンスの文言が無いファイルを探し,該当するものに生成したコメントを挿入する - git grep -z -L "${MPL[0]}" -- "$1" | xargs -0 sed -i -e "${lineNumber}i$comment" + # MPL の適用対象であるかを確認する。その中でライセンスの文言がないものに限り,生成したコメントを挿入する + if [ "$(grep -c "$1" Tools/AddLicense/Exclusions.txt)" -eq 0 ]; then + git grep -z -I -L "${MPL[0]}" -- "$1" | xargs -0 -r sed -i -e "${lineNumber}i$comment" + else + echo "Excluded: $1" + fi } diff --git a/Tools/AddLicense/CheckAllFiles.sh b/Tools/AddLicense/CheckAllFiles.sh index 7ca92fe71..2578adcca 100644 --- a/Tools/AddLicense/CheckAllFiles.sh +++ b/Tools/AddLicense/CheckAllFiles.sh @@ -8,7 +8,7 @@ # 詳しい処理につきましては Tools/AddLicense/AddLicense.sh をご参照ください。 # リポジトリのルートへ移動 -cd "$(git rev-parse --show-toplevel)" || exit +cd "$(git rev-parse --show-toplevel)" || exit 1 # `addLicense` の読み込み source Tools/AddLicense/AddLicense.sh @@ -30,6 +30,8 @@ FILES=( ) # 対象ファイルの内,MPL が抜けているもの対して文言を挿入する -for file in "${FILES[@]}"; do - addLicense "$file" +for path in "${FILES[@]}"; do + for file in $(git ls-files -- "$path"); do + addLicense "$file" + done done diff --git a/Tools/AddLicense/Exclusions.txt b/Tools/AddLicense/Exclusions.txt new file mode 100644 index 000000000..bfb7b413c --- /dev/null +++ b/Tools/AddLicense/Exclusions.txt @@ -0,0 +1,103 @@ +.editorconfig +.gitattributes +.github/ISSUE_TEMPLATE/bug_report.md +.github/ISSUE_TEMPLATE/config.yml +.github/ISSUE_TEMPLATE/feature_request.md +.github/PULL_REQUEST_TEMPLATE.md +.github/workflows/CI.yml +.gitignore +CONTRIBUTING.md +CONTRIBUTORS.md +Covid19Radar.Functions.runsettings +Covid19Radar.Functions.sln +Covid19Radar.sln +Covid19Radar/Covid19Radar.Android/Assets/AboutAssets.txt +Covid19Radar/Covid19Radar.Android/Covid19Radar.Android.csproj +Covid19Radar/Covid19Radar.Android/Resources/AboutResources.txt +Covid19Radar/Covid19Radar.iOS/Assets.xcassets/AppIcons.appiconset/Contents.json +Covid19Radar/Covid19Radar.iOS/Assets.xcassets/Contents.json +Covid19Radar/Covid19Radar.iOS/Covid19Radar.iOS.csproj +Covid19Radar/Covid19Radar.iOS/Entitlements.plist +Covid19Radar/Covid19Radar.iOS/Info.plist +Covid19Radar/Covid19Radar/Common/DateTimeUtility.cs +Covid19Radar/Covid19Radar/Covid19Radar.csproj +Covid19Radar/Covid19Radar/Memo.md +Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs +Covid19Radar/Covid19Radar/Resources/html/en/chatbot2.html +Covid19Radar/Covid19Radar/Resources/html/en/chatbot3.html +Covid19Radar/Covid19Radar/Resources/html/en/chatbot4.html +Covid19Radar/Covid19Radar/Resources/html/en/chatbot5.html +Covid19Radar/Covid19Radar/Resources/html/en/css/style.css +Covid19Radar/Covid19Radar/Resources/html/en/index.html +Covid19Radar/Covid19Radar/Resources/html/en/privacypolicy.html +Covid19Radar/Covid19Radar/Resources/html/en/privacypolicy.md +Covid19Radar/Covid19Radar/Resources/html/en/termofuse.html +Covid19Radar/Covid19Radar/Resources/html/en/termofuse.md +Covid19Radar/Covid19Radar/Resources/html/index.html +Covid19Radar/Covid19Radar/Resources/html/ja/chatbot2.html +Covid19Radar/Covid19Radar/Resources/html/ja/chatbot3.html +Covid19Radar/Covid19Radar/Resources/html/ja/chatbot4.html +Covid19Radar/Covid19Radar/Resources/html/ja/chatbot5.html +Covid19Radar/Covid19Radar/Resources/html/ja/css/style.css +Covid19Radar/Covid19Radar/Resources/html/ja/index.html +Covid19Radar/Covid19Radar/Resources/html/ja/privacypolicy.html +Covid19Radar/Covid19Radar/Resources/html/ja/privacypolicy.md +Covid19Radar/Covid19Radar/Resources/html/ja/termofuse.html +Covid19Radar/Covid19Radar/Resources/html/ja/termofuse.md +Covid19Radar/Covid19Radar/Resources/html/zh-hans/chatbot2.html +Covid19Radar/Covid19Radar/Resources/html/zh-hans/chatbot3.html +Covid19Radar/Covid19Radar/Resources/html/zh-hans/chatbot4.html +Covid19Radar/Covid19Radar/Resources/html/zh-hans/chatbot5.html +Covid19Radar/Covid19Radar/Resources/html/zh-hans/css/style.css +Covid19Radar/Covid19Radar/Resources/html/zh-hans/index.html +Covid19Radar/Covid19Radar/Resources/html/zh-hans/privacypolicy.html +Covid19Radar/Covid19Radar/Resources/html/zh-hans/privacypolicy.md +Covid19Radar/Covid19Radar/Resources/html/zh-hans/termofuse.html +Covid19Radar/Covid19Radar/Resources/html/zh-hans/termofuse.md +Covid19Radar/Covid19Radar/settings.json +Covid19Radar/Tests/Covid19Radar.UITest/App.config +Covid19Radar/Tests/Covid19Radar.UITest/Covid19Radar.UITest.csproj +Covid19Radar/Tests/Covid19Radar.UITest/Features/HomePage/ContributorsList.feature.cs +Covid19Radar/Tests/Covid19Radar.UITest/Features/HomePage/Home.feature.cs +Covid19Radar/Tests/Covid19Radar.UITest/Features/HomePage/LicenseAgreement.feature.cs +Covid19Radar/Tests/Covid19Radar.UITest/Features/HomePage/UpdateInformation.feature.cs +Covid19Radar/Tests/Covid19Radar.UITest/Features/Tutorial/Tutorial.feature.cs +Covid19Radar/Tests/Covid19Radar.UITest/ReadMe.txt +Covid19Radar/Tests/Covid19Radar.UITest/TestConfig.json +Covid19Radar/Tests/Covid19Radar.UnitTests/Covid19Radar.UnitTests.csproj +Covid19Radar/Xamarin.ExposureNotification/CallbackService.android.cs +Covid19Radar/Xamarin.ExposureNotification/ExposureInfo.shared.cs +Covid19Radar/Xamarin.ExposureNotification/ExposureNotification.android.cs +Covid19Radar/Xamarin.ExposureNotification/ExposureNotification.customize.android.cs +Covid19Radar/Xamarin.ExposureNotification/ExposureNotification.ios.cs +Covid19Radar/Xamarin.ExposureNotification/ExposureNotification.netstandard.cs +Covid19Radar/Xamarin.ExposureNotification/ExposureNotification.shared.cs +Covid19Radar/Xamarin.ExposureNotification/IExposureNotificationHandler.shared.cs +Covid19Radar/Xamarin.ExposureNotification/TemporaryExposureKey.shared.cs +Covid19Radar/Xamarin.ExposureNotification/Xamarin.ExposureNotification.csproj +OPERATION_POLICY.md +README.ja.md +README.md +Tools/ConvertBase64/ConvertBase64.sln +Tools/ConvertBase64/ConvertBase64/ConvertBase64.csproj +Tools/GenerateKeys/GenerateKeys.sln +Tools/GenerateKeys/GenerateKeys/GenerateKeys.csproj +Tools/UpdateUserStatusTool/UpdateUserStatusTool.sln +Tools/UpdateUserStatusTool/UpdateUserStatusTool/App.config.example +Tools/UpdateUserStatusTool/UpdateUserStatusTool/Properties/launchSettings.json +Tools/UpdateUserStatusTool/UpdateUserStatusTool/UpdateUserStatusTool.csproj +infrastructure/01_init/Readme.md +infrastructure/02_runtime/Readme.md +infrastructure/Readme.md +src/Covid19Radar.Api.Common/Covid19Radar.Api.Common.csproj +src/Covid19Radar.Api.External/Covid19Radar.Api.External.csproj +src/Covid19Radar.Api.External/host.json +src/Covid19Radar.Api.External/local.settings.json.example +src/Covid19Radar.Api.Tests/Covid19Radar.Api.Tests.csproj +src/Covid19Radar.Api/Covid19Radar.Api.csproj +src/Covid19Radar.Api/host.json +src/Covid19Radar.Api/local.settings.json.example +src/Covid19Radar.Background/Covid19Radar.Background.csproj +src/Covid19Radar.Background/Protobuf/TemporaryExposureKeyExportFileFormat.proto +src/Covid19Radar.Background/host.json +src/Covid19Radar.Background/local.settings.json.example From 0a01c68ccb26815daa34248d3392dc7b33473e3e Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Tue, 22 Jun 2021 23:19:38 +0900 Subject: [PATCH 11/17] Modify pre-commit --- Tools/GitHooks/PreCommit.sh | 5 ++--- Tools/GitHooks/PrepareHooks.sh | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Tools/GitHooks/PreCommit.sh b/Tools/GitHooks/PreCommit.sh index ecb67bb2f..9b2611da5 100644 --- a/Tools/GitHooks/PreCommit.sh +++ b/Tools/GitHooks/PreCommit.sh @@ -9,7 +9,7 @@ # 詳しい処理につきましては Tools/AddLicense/AddLicense.sh をご参照ください。 # リポジトリのルートへ移動 -cd "$(git rev-parse --show-toplevel)" || exit +cd "$(git rev-parse --show-toplevel)" || exit 1 # `addLicense` の読み込み source Tools/AddLicense/AddLicense.sh @@ -19,6 +19,5 @@ stagedFiles=$(git diff --name-only --cached --diff-filter=d) # 対象ファイルの内,MPL が抜けているもの対して文言を挿入する for file in $stagedFiles; do - addLicense "$file" - git add "$file" + addLicense "$file" && git add "$file" done diff --git a/Tools/GitHooks/PrepareHooks.sh b/Tools/GitHooks/PrepareHooks.sh index 7e78d7f8e..ad0e61df8 100644 --- a/Tools/GitHooks/PrepareHooks.sh +++ b/Tools/GitHooks/PrepareHooks.sh @@ -5,11 +5,10 @@ # file, You can obtain one at https://mozilla.org/MPL/2.0/. # リポジトリのルートへ移動 -cd "$(git rev-parse --show-toplevel)" || exit +cd "$(git rev-parse --show-toplevel)" || exit 1 # pre-commit 用のスクリプトを追加 -cp Tools/GitHooks/PreCommit.sh .git/hooks/pre-commit -chmod a+x .git/hooks/pre-commit +install -m a+x -D Tools/GitHooks/PreCommit.sh .git/hooks/pre-commit # 追加した Git Hooks を有効にする git init From 1a0c98596ca6e9b473432d47fc0414812feee4ea Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Wed, 23 Jun 2021 23:08:40 +0900 Subject: [PATCH 12/17] Modify CheckAllFiles.sh --- Tools/AddLicense/CheckAllFiles.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Tools/AddLicense/CheckAllFiles.sh b/Tools/AddLicense/CheckAllFiles.sh index 2578adcca..123051c4b 100644 --- a/Tools/AddLicense/CheckAllFiles.sh +++ b/Tools/AddLicense/CheckAllFiles.sh @@ -11,7 +11,7 @@ cd "$(git rev-parse --show-toplevel)" || exit 1 # `addLicense` の読み込み -source Tools/AddLicense/AddLicense.sh +source Tools/AddLicense/AddLicense.sh && export -f addLicense # 対象ファイル(リポジトリのルートを基準とした相対パスで記述) FILES=( @@ -30,8 +30,6 @@ FILES=( ) # 対象ファイルの内,MPL が抜けているもの対して文言を挿入する -for path in "${FILES[@]}"; do - for file in $(git ls-files -- "$path"); do - addLicense "$file" - done +for file in "${FILES[@]}"; do + git ls-files -- "$file" | xargs -r -P 4 -I '%' bash -c 'addLicense %' done From bacae18d0a8fa9a511e7aea02515d94d85c7906c Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Sat, 26 Jun 2021 20:03:17 +0900 Subject: [PATCH 13/17] Fix permission --- Tools/GitHooks/PrepareHooks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/GitHooks/PrepareHooks.sh b/Tools/GitHooks/PrepareHooks.sh index ad0e61df8..7f4c7a24c 100644 --- a/Tools/GitHooks/PrepareHooks.sh +++ b/Tools/GitHooks/PrepareHooks.sh @@ -8,7 +8,7 @@ cd "$(git rev-parse --show-toplevel)" || exit 1 # pre-commit 用のスクリプトを追加 -install -m a+x -D Tools/GitHooks/PreCommit.sh .git/hooks/pre-commit +install -m 755 -D Tools/GitHooks/PreCommit.sh .git/hooks/pre-commit # 追加した Git Hooks を有効にする git init From 8c271c676b71b1884c83eae170b98cd5cf6bc446 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Sat, 26 Jun 2021 20:03:41 +0900 Subject: [PATCH 14/17] Modify comment formats --- Tools/AddLicense/AddLicense.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Tools/AddLicense/AddLicense.sh b/Tools/AddLicense/AddLicense.sh index 66bc72b07..5442c1577 100644 --- a/Tools/AddLicense/AddLicense.sh +++ b/Tools/AddLicense/AddLicense.sh @@ -16,42 +16,42 @@ function addLicense() { # 各種ファイルに適したコメントを生成する if [ "$fileType" == 'axml' ]; then - comment='\\n\n' + comment=$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'bat' ]; then comment=$(printf '@REM %s\\n' "${MPL[@]}") elif [ "$fileType" == 'cs' ]; then - comment=$(printf '// %s\\n' "${MPL[@]}") + comment=$(printf '/* %s\\n * %s\\n * %s */\\n' "${MPL[@]}") elif [ "$fileType" == 'feature' ]; then comment=$(printf '# %s\\n' "${MPL[@]}") elif [ "$fileType" == 'resx' ]; then - comment='\\n\n' + comment=$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'sh' ]; then - comment='\\n'$(printf '# %s\\n' "${MPL[@]}") + comment=$(printf '# %s\\n' "${MPL[@]}") lineNumber=2 # Shebang の後に挿入する elif [ "$fileType" == 'storyboard' ]; then - comment='\\n\n' + comment=$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'strings' ]; then - comment='\\n/*\n'$(printf ' %s\\n' "${MPL[@]}")'*/\n' + comment=$(printf '/* %s\\n * %s\\n * %s */\\n' "${MPL[@]}") elif [ "$fileType" == 'tf' ]; then comment=$(printf '# %s\\n' "${MPL[@]}") elif [ "$fileType" == 'xaml' ]; then - comment='\\n\n' + comment=$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'xml' ]; then - comment='\\n\n' + comment=$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'yml' ]; then From 434090c425d6d4629942e52fd2264b382c0850c9 Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Sat, 26 Jun 2021 20:17:58 +0900 Subject: [PATCH 15/17] Modify comment format --- Tools/AddLicense/AddLicense.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tools/AddLicense/AddLicense.sh b/Tools/AddLicense/AddLicense.sh index 5442c1577..932482461 100644 --- a/Tools/AddLicense/AddLicense.sh +++ b/Tools/AddLicense/AddLicense.sh @@ -16,7 +16,7 @@ function addLicense() { # 各種ファイルに適したコメントを生成する if [ "$fileType" == 'axml' ]; then - comment=$(printf '\\n' "${MPL[@]}") + comment='\\n'$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'bat' ]; then @@ -29,15 +29,15 @@ function addLicense() { comment=$(printf '# %s\\n' "${MPL[@]}") elif [ "$fileType" == 'resx' ]; then - comment=$(printf '\\n' "${MPL[@]}") + comment='\\n'$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'sh' ]; then - comment=$(printf '# %s\\n' "${MPL[@]}") + comment='\\n'$(printf '# %s\\n' "${MPL[@]}") lineNumber=2 # Shebang の後に挿入する elif [ "$fileType" == 'storyboard' ]; then - comment=$(printf '\\n' "${MPL[@]}") + comment='\\n'$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'strings' ]; then @@ -47,11 +47,11 @@ function addLicense() { comment=$(printf '# %s\\n' "${MPL[@]}") elif [ "$fileType" == 'xaml' ]; then - comment=$(printf '\\n' "${MPL[@]}") + comment='\\n'$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'xml' ]; then - comment=$(printf '\\n' "${MPL[@]}") + comment='\\n'$(printf '\\n' "${MPL[@]}") lineNumber=2 # XML 宣言の後に挿入する elif [ "$fileType" == 'yml' ]; then From f172584c1f8e52c72af7d61851df034b9081bd2f Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Tue, 29 Jun 2021 22:55:02 +0900 Subject: [PATCH 16/17] Modify AddLicense.sh --- Tools/AddLicense/AddLicense.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/AddLicense/AddLicense.sh b/Tools/AddLicense/AddLicense.sh index 932482461..a5b080513 100644 --- a/Tools/AddLicense/AddLicense.sh +++ b/Tools/AddLicense/AddLicense.sh @@ -59,7 +59,7 @@ function addLicense() { fi # MPL の適用対象であるかを確認する。その中でライセンスの文言がないものに限り,生成したコメントを挿入する - if [ "$(grep -c "$1" Tools/AddLicense/Exclusions.txt)" -eq 0 ]; then + if [ "$comment" != '' ] && [ "$(grep -c "$1" Tools/AddLicense/Exclusions.txt)" -eq 0 ]; then git grep -z -I -L "${MPL[0]}" -- "$1" | xargs -0 -r sed -i -e "${lineNumber}i$comment" else echo "Excluded: $1" From e27345c362cb0f91a0f0c315b95885322e0e688a Mon Sep 17 00:00:00 2001 From: Meiryo7743 <46659204+Meiryo7743@users.noreply.github.com> Date: Tue, 29 Jun 2021 22:55:10 +0900 Subject: [PATCH 17/17] Remove DateTimeUtility.cs from Exclusions.txt --- Tools/AddLicense/Exclusions.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Tools/AddLicense/Exclusions.txt b/Tools/AddLicense/Exclusions.txt index bfb7b413c..5db70a4b3 100644 --- a/Tools/AddLicense/Exclusions.txt +++ b/Tools/AddLicense/Exclusions.txt @@ -19,7 +19,6 @@ Covid19Radar/Covid19Radar.iOS/Assets.xcassets/Contents.json Covid19Radar/Covid19Radar.iOS/Covid19Radar.iOS.csproj Covid19Radar/Covid19Radar.iOS/Entitlements.plist Covid19Radar/Covid19Radar.iOS/Info.plist -Covid19Radar/Covid19Radar/Common/DateTimeUtility.cs Covid19Radar/Covid19Radar/Covid19Radar.csproj Covid19Radar/Covid19Radar/Memo.md Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs