Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2011 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 17 | include art/build/Android.common_build.mk |
| 18 | |
Artem Kotsiuba | dc8fa4d | 2021-06-22 16:26:30 +0100 | [diff] [blame] | 19 | # We need to be in art directory to properly initialize ART_CPPLINT_SRC variable. |
| 20 | LOCAL_PATH := $(art_path) |
| 21 | |
Igor Murashkin | 2a2d311 | 2017-11-14 15:03:25 -0800 | [diff] [blame] | 22 | # Use upstream cpplint (toolpath from .repo/manifests/GLOBAL-PREUPLOAD.cfg). |
Orion Hodson | a1d4c56 | 2021-11-11 15:01:25 +0000 | [diff] [blame] | 23 | ART_CPPLINT := tools/repohooks/tools/cpplint.py |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 24 | |
Igor Murashkin | 2a2d311 | 2017-11-14 15:03:25 -0800 | [diff] [blame] | 25 | # This file previously configured many cpplint settings. |
| 26 | # Everything that could be moved to CPPLINT.cfg has moved there. |
| 27 | # Please add new settings to CPPLINT.cfg over adding new flags in this file. |
| 28 | |
| 29 | ART_CPPLINT_FLAGS := |
| 30 | # No output when there are no errors. |
| 31 | ART_CPPLINT_QUIET := --quiet |
| 32 | |
| 33 | # 1) Get list of all .h & .cc files in the art directory. |
Alex Light | 80c0d79 | 2016-01-12 11:10:23 -0800 | [diff] [blame] | 34 | # 2) Prepends 'art/' to each of them to make the full name. |
Igor Murashkin | 2a2d311 | 2017-11-14 15:03:25 -0800 | [diff] [blame] | 35 | ART_CPPLINT_SRC := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,*.h) $(call all-subdir-named-files,*$(ART_CPP_EXTENSION))) |
| 36 | |
| 37 | # 1) Get list of all CPPLINT.cfg files in the art directory. |
| 38 | # 2) Prepends 'art/' to each of them to make the full name. |
| 39 | ART_CPPLINT_CFG := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,CPPLINT.cfg)) |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 40 | |
| 41 | # "mm cpplint-art" to verify we aren't regressing |
Igor Murashkin | 2a2d311 | 2017-11-14 15:03:25 -0800 | [diff] [blame] | 42 | # - files not touched since the last build are skipped (quite fast). |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 43 | .PHONY: cpplint-art |
Igor Murashkin | 2a2d311 | 2017-11-14 15:03:25 -0800 | [diff] [blame] | 44 | cpplint-art: cpplint-art-phony |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 45 | |
Igor Murashkin | 2a2d311 | 2017-11-14 15:03:25 -0800 | [diff] [blame] | 46 | # "mm cpplint-art-all" to manually execute cpplint.py on all files (very slow). |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 47 | .PHONY: cpplint-art-all |
| 48 | cpplint-art-all: |
Colin Cross | 6744a5c | 2017-07-14 12:45:27 -0700 | [diff] [blame] | 49 | $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_SRC) |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 50 | |
| 51 | OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint |
| 52 | |
Igor Murashkin | 2a2d311 | 2017-11-14 15:03:25 -0800 | [diff] [blame] | 53 | # Build up the list of all targets for linting the ART source files. |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 54 | ART_CPPLINT_TARGETS := |
| 55 | |
| 56 | define declare-art-cpplint-target |
| 57 | art_cpplint_file := $(1) |
| 58 | art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file)) |
| 59 | |
Igor Murashkin | 2a2d311 | 2017-11-14 15:03:25 -0800 | [diff] [blame] | 60 | $$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) $(ART_CPPLINT_CFG) art/build/Android.cpplint.mk |
| 61 | $(hide) $(ART_CPPLINT) $(ART_CPPLINT_QUIET) $(ART_CPPLINT_FLAGS) $$< |
Alex Light | 91de25f | 2015-10-28 17:00:06 -0700 | [diff] [blame] | 62 | $(hide) mkdir -p $$(dir $$@) |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 63 | $(hide) touch $$@ |
| 64 | |
| 65 | ART_CPPLINT_TARGETS += $$(art_cpplint_touch) |
| 66 | endef |
| 67 | |
| 68 | $(foreach file, $(ART_CPPLINT_SRC), $(eval $(call declare-art-cpplint-target,$(file)))) |
| 69 | #$(info $(call declare-art-cpplint-target,$(firstword $(ART_CPPLINT_SRC)))) |
| 70 | |
| 71 | include $(CLEAR_VARS) |
| 72 | LOCAL_MODULE := cpplint-art-phony |
Bob Badour | 9150de6 | 2021-02-26 03:22:24 -0800 | [diff] [blame] | 73 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 |
| 74 | LOCAL_LICENSE_CONDITIONS := notice |
| 75 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 76 | LOCAL_MODULE_TAGS := optional |
| 77 | LOCAL_ADDITIONAL_DEPENDENCIES := $(ART_CPPLINT_TARGETS) |
| 78 | include $(BUILD_PHONY_PACKAGE) |