From e261526d2c9113382bee2d9d1cb8663f0e360585 Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Fri, 12 Aug 2022 11:45:06 +0200 Subject: [PATCH] Add a ktfmt hook for some SystemUI files This CL enables a ktfmt hook to check that Kotlin files are properly formatted. The set of files or directories that should be included is specified in a simple ktfmt_includes.txt file. That way, existing files that are not properly formatted yet won't be checked and uploaders won't be bothered by this check. In the future, we will check all files created after some baseline. At the moment, only Kotlin files that I know are already formatted with ktfmt were included in that list. Test: Manual Bug: 235461679 Change-Id: Idaed15c39f6af413c305f4c74f142a2895b5a753 --- PREUPLOAD.cfg | 2 ++ ktfmt_includes.txt | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 ktfmt_includes.txt diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index 65b2511bb30f0..c10c380c23cf6 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -26,6 +26,8 @@ hidden_api_txt_checksorted_hook = ${REPO_ROOT}/tools/platform-compat/hiddenapi/c hidden_api_txt_exclude_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/exclude.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} +ktfmt_hook = ${REPO_ROOT}/external/ktfmt/ktfmt.py --check -i ${REPO_ROOT}/frameworks/base/ktfmt_includes.txt ${PREUPLOAD_FILES} + ktlint_hook = ${REPO_ROOT}/prebuilts/ktlint/ktlint.py -f ${PREUPLOAD_FILES} owners_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "OWNERS$" diff --git a/ktfmt_includes.txt b/ktfmt_includes.txt new file mode 100644 index 0000000000000..96da8c9c803b6 --- /dev/null +++ b/ktfmt_includes.txt @@ -0,0 +1,9 @@ +packages/SystemUI/compose/ +packages/SystemUI/screenshot/ +packages/SystemUI/src/com/android/systemui/people/data +packages/SystemUI/src/com/android/systemui/people/ui +packages/SystemUI/src/com/android/systemui/keyguard/data +packages/SystemUI/src/com/android/systemui/keyguard/dagger +packages/SystemUI/src/com/android/systemui/keyguard/domain +packages/SystemUI/src/com/android/systemui/keyguard/shared +packages/SystemUI/src/com/android/systemui/keyguard/ui \ No newline at end of file