aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/resolve_java_srcs.py
diff options
context:
space:
mode:
authorakastornov <akastornov@yandex-team.ru>2022-02-10 16:46:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:03 +0300
commit8d3a5ed3a188a34167eaee54f1691ce5c9edf2f3 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /build/scripts/resolve_java_srcs.py
parent3a2de774d91ca8d7325aaf81c200b1d2047725e6 (diff)
downloadydb-8d3a5ed3a188a34167eaee54f1691ce5c9edf2f3.tar.gz
Restoring authorship annotation for <akastornov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build/scripts/resolve_java_srcs.py')
-rw-r--r--build/scripts/resolve_java_srcs.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/build/scripts/resolve_java_srcs.py b/build/scripts/resolve_java_srcs.py
index 4919e16ed7..a2e6c20012 100644
--- a/build/scripts/resolve_java_srcs.py
+++ b/build/scripts/resolve_java_srcs.py
@@ -14,8 +14,8 @@ def list_all_files(directory, prefix='/', hidden_files=False):
return result
-def pattern_to_regexp(p):
- return '^' + \
+def pattern_to_regexp(p):
+ return '^' + \
('/' if not p.startswith('**') else '') + \
re.escape(p).replace(
r'\*\*\/', '[_DIR_]'
@@ -26,8 +26,8 @@ def pattern_to_regexp(p):
).replace(
'[_FILE_]', '([^/]*)'
) + '$'
-
-
+
+
def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources, resolve_kotlin=False, resolve_groovy=False):
result = {'java': [], 'not_java': [], 'kotlin': [], 'groovy': []}
include_patterns_normal, include_patterns_hidden, exclude_patterns_normal, exclude_patterns_hidden = [], [], [], []
@@ -43,22 +43,22 @@ def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources,
else:
re_patterns = [re.compile(i) for i in re_patterns]
vis[:], hid[:] = re_patterns[:len(vis)], re_patterns[len(vis):]
-
+
for inc_patterns, exc_patterns, with_hidden_files in (
(include_patterns_normal, exclude_patterns_normal, False),
(include_patterns_hidden, exclude_patterns_hidden, True),
):
for f in list_all_files(srcdir, hidden_files=with_hidden_files):
excluded = False
-
+
for exc_re in exc_patterns:
if exc_re.match(f):
excluded = True
break
-
+
if excluded:
continue
-
+
for inc_re in inc_patterns:
if inc_re.match(f):
s = os.path.normpath(f[1:])
@@ -73,7 +73,7 @@ def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources,
else:
result['not_java'].append(s)
break
-
+
return sorted(result['java']), sorted(result['not_java']), sorted(result['kotlin']), sorted(result['groovy'])
@@ -99,8 +99,8 @@ if __name__ == '__main__':
parser.add_argument('--all-resources', action='store_true', default=False)
parser.add_argument('--resolve-kotlin', action='store_true', default=False)
parser.add_argument('--resolve-groovy', action='store_true', default=False)
- parser.add_argument('--include-patterns', nargs='*', default=[])
- parser.add_argument('--exclude-patterns', nargs='*', default=[])
+ parser.add_argument('--include-patterns', nargs='*', default=[])
+ parser.add_argument('--exclude-patterns', nargs='*', default=[])
args = parser.parse_args()
do_it(**vars(args))