diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-03-15 19:59:12 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-03-15 19:59:12 +0300 |
commit | 056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11 (patch) | |
tree | 4740980126f32e3af7937ba0ca5f83e59baa4ab0 /build/plugins/large_files.py | |
parent | 269126dcced1cc8b53eb4398b4a33e5142f10290 (diff) | |
download | ydb-056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11.tar.gz |
add library/cpp/actors, ymake build to ydb oss export
Diffstat (limited to 'build/plugins/large_files.py')
-rw-r--r-- | build/plugins/large_files.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/build/plugins/large_files.py b/build/plugins/large_files.py new file mode 100644 index 0000000000..33a78d7110 --- /dev/null +++ b/build/plugins/large_files.py @@ -0,0 +1,39 @@ +import os +import ymake +from _common import strip_roots + +PLACEHOLDER_EXT = "external" + + +def onlarge_files(unit, *args): + """ + @usage LARGE_FILES([AUTOUPDATED] Files...) + + Use large file ether from working copy or from remote storage via placeholder <File>.external + If <File> is present locally (and not a symlink!) it will be copied to build directory. + Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase. + """ + args = list(args) + + if args and args[0] == 'AUTOUPDATED': + args = args[1:] + + for arg in args: + if arg == 'AUTOUPDATED': + unit.message(["warn", "Please set AUTOUPDATED argument before other file names"]) + continue + + src = unit.resolve_arc_path(arg) + if src.startswith("$S"): + msg = "Used local large file {}. Don't forget to run 'ya upload --update-external' and commit {}.{}".format(src, src, PLACEHOLDER_EXT) + unit.message(["warn", msg]) + unit.oncopy_file([arg, arg]) + else: + out_file = strip_roots(os.path.join(unit.path(), arg)) + external = "{}.{}".format(arg, PLACEHOLDER_EXT) + from_external_cmd = [external, out_file, 'OUT_NOAUTO', arg] + if os.path.dirname(arg): + from_external_cmd.extend(("RENAME", os.path.basename(arg))) + unit.on_from_external(from_external_cmd) + unit.onadd_check(['check.external', external]) + |