aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/resolve_java_srcs.py
diff options
context:
space:
mode:
authorsvidyuk <svidyuk@yandex-team.com>2025-01-28 09:14:19 +0300
committersvidyuk <svidyuk@yandex-team.com>2025-01-28 09:34:14 +0300
commit54d7987cb11a25bb9811bba6a01d0d8a6942af59 (patch)
treeb8ec3f9d082e5de800305fcb6e8c10e9c2fefb53 /build/scripts/resolve_java_srcs.py
parent77d9db7a95c6ae81393fe72ed4b79768346c63f8 (diff)
downloadydb-54d7987cb11a25bb9811bba6a01d0d8a6942af59.tar.gz
All java sources sorting/preparation in a single python script
NOTE: there is still some kotlin source preparation remains in a separate call for `build/scripts/resolve_java_srcs.py` which is going to be joined into `prepare_jar_build.py` later. commit_hash:239933cba6b1a7090a9327d659bb8be3722db916
Diffstat (limited to 'build/scripts/resolve_java_srcs.py')
-rw-r--r--build/scripts/resolve_java_srcs.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/build/scripts/resolve_java_srcs.py b/build/scripts/resolve_java_srcs.py
index 446bb55476..4cce49136f 100644
--- a/build/scripts/resolve_java_srcs.py
+++ b/build/scripts/resolve_java_srcs.py
@@ -22,7 +22,7 @@ def pattern_to_regexp(p):
'^'
+ ('/' if not p.startswith('**') else '')
+ re.escape(p)
- .replace(r'\*\*\/', '[_DIR_]')
+ .replace(r'\*\*/', '[_DIR_]')
.replace(r'\*', '[_FILE_]')
.replace('[_DIR_]', '(.*/)?')
.replace('[_FILE_]', '([^/]*)')
@@ -99,7 +99,7 @@ def do_it(
open(kotlin_sources_file, mode).writelines(i + '\n' for i in k + j)
-if __name__ == '__main__':
+def cli_main(argv, force_skip_source_jars=False):
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--directory', required=True)
parser.add_argument('-s', '--sources-file', required=True)
@@ -110,6 +110,13 @@ if __name__ == '__main__':
parser.add_argument('--resolve-kotlin', action='store_true', default=False)
parser.add_argument('--include-patterns', nargs='*', default=[])
parser.add_argument('--exclude-patterns', nargs='*', default=[])
- args = parser.parse_args()
+ args = parser.parse_args(argv)
+
+ if force_skip_source_jars and args.all_resources:
+ return
do_it(**vars(args))
+
+
+if __name__ == '__main__':
+ cli_main(sys.argv[1:])