YETUS-371. build driver: speed up checkstyle Signed-off-by: Allen Wittenauer <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/67d32844 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/67d32844 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/67d32844 Branch: refs/heads/YETUS-156 Commit: 67d3284423d8ee5ff82b8f391faf35416207076a Parents: a24b5cb Author: Allen Wittenauer <[email protected]> Authored: Tue Apr 12 08:53:04 2016 -0700 Committer: Allen Wittenauer <[email protected]> Committed: Fri Apr 22 13:25:07 2016 -0700 ---------------------------------------------------------------------- precommit/test-patch.d/checkstyle.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/67d32844/precommit/test-patch.d/checkstyle.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/checkstyle.sh b/precommit/test-patch.d/checkstyle.sh index bba3369..f0b3e57 100755 --- a/precommit/test-patch.d/checkstyle.sh +++ b/precommit/test-patch.d/checkstyle.sh @@ -341,12 +341,21 @@ function checkstyle_postapply module=${MODULE[$i]} fn=$(module_file_fragment "${module}") - # call calcdiffs to allow overrides - calcdiffs \ - "${PATCH_DIR}/branch-checkstyle-${fn}.txt" \ - "${PATCH_DIR}/patch-checkstyle-${fn}.txt" \ - checkstyle \ - > "${PATCH_DIR}/diff-checkstyle-${fn}.txt" + # if there is no comparison to be done, + # we can speed this up tremendously + if [[ "${BUILDMODE}" = full ]]; then + touch "${PATCH_DIR}/branch-checkstyle-${fn}.txt" + cp -p "${PATCH_DIR}/patch-checkstyle-${fn}.txt" \ + "${PATCH_DIR}/diff-checkstyle-${fn}.txt" + else + + # call calcdiffs to allow overrides + calcdiffs \ + "${PATCH_DIR}/branch-checkstyle-${fn}.txt" \ + "${PATCH_DIR}/patch-checkstyle-${fn}.txt" \ + checkstyle \ + > "${PATCH_DIR}/diff-checkstyle-${fn}.txt" + fi #shellcheck disable=SC2016 numbranch=$(wc -l "${PATCH_DIR}/branch-checkstyle-${fn}.txt" | ${AWK} '{print $1}')
