diff options
author | 2017-11-14 15:03:25 -0800 | |
---|---|---|
committer | 2017-11-14 15:39:55 -0800 | |
commit | 2a2d3117e3912743527455ec2b7056eb66215ae1 (patch) | |
tree | b6dac3ae97a0f94e2ca95d8fafcb4d244167e07a /build/Android.cpplint.mk | |
parent | 2ffb703bf431d74326c88266b4ddaf225eb3c6ad (diff) |
cpplint: Use upstream cpplint
Also use CPPLINT.cfg instead of passing in extra flags to cpplint.py.
This unifies the handling and allows us to remove cpplint_presubmit
without loss of functionality.
Bug: 68951293
Change-Id: I6ece835440e3ac3f84fadc544307a9a5126a3e1c
Diffstat (limited to 'build/Android.cpplint.mk')
-rw-r--r-- | build/Android.cpplint.mk | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/build/Android.cpplint.mk b/build/Android.cpplint.mk index 247f4e3470..964a4c896f 100644 --- a/build/Android.cpplint.mk +++ b/build/Android.cpplint.mk @@ -16,42 +16,46 @@ include art/build/Android.common_build.mk -ART_CPPLINT := $(LOCAL_PATH)/tools/cpplint.py -ART_CPPLINT_FILTER := --filter=-whitespace/line_length,-build/include,-readability/function,-readability/streams,-readability/todo,-runtime/references,-runtime/sizeof,-runtime/threadsafe_fn,-runtime/printf -# Use `pwd` instead of $TOP for root, $TOP is always . and --root doesn't seem -# to work with a relative path (b/34787652). -ART_CPPLINT_FLAGS := --root=`pwd` +# Use upstream cpplint (toolpath from .repo/manifests/GLOBAL-PREUPLOAD.cfg). +ART_CPPLINT := external/google-styleguide/cpplint/cpplint.py + +# This file previously configured many cpplint settings. +# Everything that could be moved to CPPLINT.cfg has moved there. +# Please add new settings to CPPLINT.cfg over adding new flags in this file. + +ART_CPPLINT_FLAGS := +# No output when there are no errors. ART_CPPLINT_QUIET := --quiet -ART_CPPLINT_INGORED := \ - runtime/elf.h \ - openjdkjvmti/include/jvmti.h -# This: -# 1) Gets a list of all .h & .cc files in the art directory. +# 1) Get list of all .h & .cc files in the art directory. +# 2) Prepends 'art/' to each of them to make the full name. +ART_CPPLINT_SRC := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,*.h) $(call all-subdir-named-files,*$(ART_CPP_EXTENSION))) + +# 1) Get list of all CPPLINT.cfg files in the art directory. # 2) Prepends 'art/' to each of them to make the full name. -# 3) removes art/runtime/elf.h from the list. -ART_CPPLINT_SRC := $(filter-out $(patsubst %,$(LOCAL_PATH)/%,$(ART_CPPLINT_INGORED)), $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,*.h) $(call all-subdir-named-files,*$(ART_CPP_EXTENSION)))) +ART_CPPLINT_CFG := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,CPPLINT.cfg)) # "mm cpplint-art" to verify we aren't regressing +# - files not touched since the last build are skipped (quite fast). .PHONY: cpplint-art -cpplint-art: - $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $(ART_CPPLINT_SRC) +cpplint-art: cpplint-art-phony -# "mm cpplint-art-all" to see all warnings +# "mm cpplint-art-all" to manually execute cpplint.py on all files (very slow). .PHONY: cpplint-art-all cpplint-art-all: $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_SRC) OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint +# Build up the list of all targets for linting the ART source files. ART_CPPLINT_TARGETS := define declare-art-cpplint-target art_cpplint_file := $(1) art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file)) -$$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) art/build/Android.cpplint.mk - $(hide) $(ART_CPPLINT) $(ART_CPPLINT_QUIET) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $$< +$$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) $(ART_CPPLINT_CFG) art/build/Android.cpplint.mk + $(hide) $(ART_CPPLINT) $(ART_CPPLINT_QUIET) $(ART_CPPLINT_FLAGS) $$< $(hide) mkdir -p $$(dir $$@) $(hide) touch $$@ |