1# python3
2# Copyright (C) 2019 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"""Define a project list to sort warnings by project directory path."""
17
18
19def create_pattern(name, pattern=None):
20  """Return a tuple of name and warn patten."""
21  if pattern is not None:
22    return [name, '(^|.*/)' + pattern + '/.*: warning:']
23  return [name, '(^|.*/)' + name + '/.*: warning:']
24
25
26# A list of [project_name, file_path_pattern].
27# project_name should not contain comma, to be used in CSV output.
28project_list = [
29    create_pattern('art'),
30    create_pattern('bionic'),
31    create_pattern('bootable'),
32    create_pattern('build'),
33    create_pattern('cts'),
34    create_pattern('dalvik'),
35    create_pattern('developers'),
36    create_pattern('development'),
37    create_pattern('device'),
38    create_pattern('doc'),
39    # match external/google* before external/
40    create_pattern('external/google', 'external/google.*'),
41    create_pattern('external/non-google', 'external'),
42    create_pattern('frameworks/av/camera'),
43    create_pattern('frameworks/av/cmds'),
44    create_pattern('frameworks/av/drm'),
45    create_pattern('frameworks/av/include'),
46    create_pattern('frameworks/av/media/img_utils'),
47    create_pattern('frameworks/av/media/libcpustats'),
48    create_pattern('frameworks/av/media/libeffects'),
49    create_pattern('frameworks/av/media/libmediaplayerservice'),
50    create_pattern('frameworks/av/media/libmedia'),
51    create_pattern('frameworks/av/media/libstagefright'),
52    create_pattern('frameworks/av/media/mtp'),
53    create_pattern('frameworks/av/media/ndk'),
54    create_pattern('frameworks/av/media/utils'),
55    create_pattern('frameworks/av/media/Other', 'frameworks/av/media'),
56    create_pattern('frameworks/av/radio'),
57    create_pattern('frameworks/av/services'),
58    create_pattern('frameworks/av/soundtrigger'),
59    create_pattern('frameworks/av/Other', 'frameworks/av'),
60    create_pattern('frameworks/base/cmds'),
61    create_pattern('frameworks/base/core'),
62    create_pattern('frameworks/base/drm'),
63    create_pattern('frameworks/base/media'),
64    create_pattern('frameworks/base/libs'),
65    create_pattern('frameworks/base/native'),
66    create_pattern('frameworks/base/packages'),
67    create_pattern('frameworks/base/rs'),
68    create_pattern('frameworks/base/services'),
69    create_pattern('frameworks/base/tests'),
70    create_pattern('frameworks/base/tools'),
71    create_pattern('frameworks/base/Other', 'frameworks/base'),
72    create_pattern('frameworks/compile/libbcc'),
73    create_pattern('frameworks/compile/mclinker'),
74    create_pattern('frameworks/compile/slang'),
75    create_pattern('frameworks/compile/Other', 'frameworks/compile'),
76    create_pattern('frameworks/minikin'),
77    create_pattern('frameworks/ml'),
78    create_pattern('frameworks/native/cmds'),
79    create_pattern('frameworks/native/include'),
80    create_pattern('frameworks/native/libs'),
81    create_pattern('frameworks/native/opengl'),
82    create_pattern('frameworks/native/services'),
83    create_pattern('frameworks/native/vulkan'),
84    create_pattern('frameworks/native/Other', 'frameworks/native'),
85    create_pattern('frameworks/opt'),
86    create_pattern('frameworks/rs'),
87    create_pattern('frameworks/webview'),
88    create_pattern('frameworks/wilhelm'),
89    create_pattern('frameworks/Other', 'frameworks'),
90    create_pattern('hardware/akm'),
91    create_pattern('hardware/broadcom'),
92    create_pattern('hardware/google'),
93    create_pattern('hardware/intel'),
94    create_pattern('hardware/interfaces'),
95    create_pattern('hardware/libhardware'),
96    create_pattern('hardware/libhardware_legacy'),
97    create_pattern('hardware/qcom'),
98    create_pattern('hardware/ril'),
99    create_pattern('hardware/Other', 'hardware'),
100    create_pattern('kernel'),
101    create_pattern('libcore'),
102    create_pattern('libnativehelper'),
103    create_pattern('ndk'),
104    # match vendor/unbungled_google/packages before other packages
105    create_pattern('unbundled_google'),
106    create_pattern('packages/providers/MediaProvider'),
107    create_pattern('packages'),
108    create_pattern('pdk'),
109    create_pattern('prebuilts'),
110    create_pattern('system/bt'),
111    create_pattern('system/connectivity'),
112    create_pattern('system/core/adb'),
113    create_pattern('system/libbase'),
114    create_pattern('system/core/debuggerd'),
115    create_pattern('system/core/fastboot'),
116    create_pattern('system/core/fingerprintd'),
117    create_pattern('system/core/fs_mgr'),
118    create_pattern('system/core/gatekeeperd'),
119    create_pattern('system/core/healthd'),
120    create_pattern('system/core/include'),
121    create_pattern('system/core/init'),
122    create_pattern('system/unwinding/libbacktrace'),
123    create_pattern('system/logging/liblog'),
124    create_pattern('system/core/libpixelflinger'),
125    create_pattern('system/core/libprocessgroup'),
126    create_pattern('system/core/libsysutils'),
127    create_pattern('system/core/logcat'),
128    create_pattern('system/core/logd'),
129    create_pattern('system/core/run-as'),
130    create_pattern('system/core/sdcard'),
131    create_pattern('system/core/toolbox'),
132    create_pattern('system/core/Other', 'system/core'),
133    create_pattern('system/extras/ANRdaemon'),
134    create_pattern('system/extras/cpustats'),
135    create_pattern('system/extras/crypto-perf'),
136    create_pattern('system/extras/ext4_utils'),
137    create_pattern('system/extras/f2fs_utils'),
138    create_pattern('system/extras/iotop'),
139    create_pattern('system/extras/libfec'),
140    create_pattern('system/extras/memory_replay'),
141    create_pattern('system/extras/mmap-perf'),
142    create_pattern('system/extras/multinetwork'),
143    create_pattern('system/extras/perfprofd'),
144    create_pattern('system/extras/procrank'),
145    create_pattern('system/extras/runconuid'),
146    create_pattern('system/extras/showmap'),
147    create_pattern('system/extras/simpleperf'),
148    create_pattern('system/extras/su'),
149    create_pattern('system/extras/tests'),
150    create_pattern('system/extras/verity'),
151    create_pattern('system/extras/Other', 'system/extras'),
152    create_pattern('system/gatekeeper'),
153    create_pattern('system/keymaster'),
154    create_pattern('system/libhidl'),
155    create_pattern('system/libhwbinder'),
156    create_pattern('system/media'),
157    create_pattern('system/netd'),
158    create_pattern('system/nvram'),
159    create_pattern('system/security'),
160    create_pattern('system/sepolicy'),
161    create_pattern('system/tools'),
162    create_pattern('system/update_engine'),
163    create_pattern('system/vold'),
164    create_pattern('system/Other', 'system'),
165    create_pattern('toolchain'),
166    create_pattern('test'),
167    create_pattern('tools'),
168    # match vendor/google* before vendor/
169    create_pattern('vendor/google', 'vendor/google.*'),
170    create_pattern('vendor/non-google', 'vendor'),
171    # keep out/obj and other patterns at the end.
172    [
173        'out/obj', '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|'
174        'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:'
175    ],
176    ['other', '.*']  # all other unrecognized patterns
177]
178