aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhoden <khoden@yandex-team.com>2024-10-07 20:01:52 +0300
committerkhoden <khoden@yandex-team.com>2024-10-07 20:19:15 +0300
commit8c177d3c4490de1f49c0cfb575a8789249f77b8b (patch)
tree07177b3fcede6adee5941abf3d5d799170efd20a
parent3172c3e7f7cead9967382c3f865c03e737170294 (diff)
downloadydb-8c177d3c4490de1f49c0cfb575a8789249f77b8b.tar.gz
LARGE_FILES + TS_PACKAGE (dummy as example)
commit_hash:acf0bed98e822f7eee9ffeff2339c2250c46204d
-rw-r--r--build/conf/ts/ts.conf18
-rw-r--r--build/plugins/nots.py28
2 files changed, 46 insertions, 0 deletions
diff --git a/build/conf/ts/ts.conf b/build/conf/ts/ts.conf
index c938fa7349..928f5cf456 100644
--- a/build/conf/ts/ts.conf
+++ b/build/conf/ts/ts.conf
@@ -183,18 +183,36 @@ _TS_FILES_COPY_CMD=
### TS_FILES(Files...)
###
### Adds files to output as is. Similar to FILES but works for TS build modules
+### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-files
macro TS_FILES(Files...) {
+ # TODO: FBP-1795
_TS_FILES($Files)
}
### TS_FILES_GLOB(Glob...)
###
### Adds files to output by glob, e.g. TS_FILES_GLOB(**/*.css)
+### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-files-glob
macro TS_FILES_GLOB(Glob...) {
_GLOB(FILES_BY_GLOB ${Glob})
TS_FILES(${FILES_BY_GLOB})
}
+### @usage TS_LARGE_FILES(DESTINATION dest_dir 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.
+###
+### Then file will be copied to DESTINATION folder preserving file structure.
+### Copied file becomes output of TS_PACKAGE
+### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-large-files
+macro TS_LARGE_FILES(DESTINATION="~~required~~", FILES...) {
+ LARGE_FILES($FILES)
+ # TODO: FBP-1795
+ _TS_LARGE_FILES($DESTINATION $FILES)
+}
+
@import "${CONF_ROOT}/conf/ts/node_modules.conf"
@import "${CONF_ROOT}/conf/ts/ts_next.conf"
@import "${CONF_ROOT}/conf/ts/ts_package.conf"
diff --git a/build/plugins/nots.py b/build/plugins/nots.py
index 6dcff79bf7..a193dbb52b 100644
--- a/build/plugins/nots.py
+++ b/build/plugins/nots.py
@@ -28,6 +28,8 @@ COLOR_CODES = {
"reset": "49",
}
+REQUIRED_MISSING = "~~required~~"
+
class ConsoleColors(dict):
def __init__(self, color_codes):
@@ -885,6 +887,32 @@ def on_ts_files(unit, *files):
@_with_report_configure_error
+def on_ts_large_files(unit, destination: str, *files: list[str]):
+ if destination == REQUIRED_MISSING:
+ ymake.report_configure_error(
+ "Macro TS_LARGE_FILES() requires to use DESTINATION parameter.\n"
+ " TS_LARGE_FILES(\n"
+ " DESTINATION some_dir\n"
+ " large/file1\n"
+ " large/file2\n"
+ " )\n"
+ "Docs: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-large-files."
+ )
+ return
+
+ # TODO: FBP-1795
+ # ${BINDIR} prefix for input is important to resove to result of LARGE_FILES and not to SOURCEDIR
+ new_cmds = [
+ '$COPY_CMD ${{input;context=TEXT:"${{BINDIR}}/{0}"}} ${{output;noauto:"{1}/{0}"}}'.format(f, destination)
+ for f in files
+ ]
+ all_cmds = unit.get("_TS_FILES_COPY_CMD")
+ if all_cmds:
+ new_cmds.insert(0, all_cmds)
+ unit.set(["_TS_FILES_COPY_CMD", " && ".join(new_cmds)])
+
+
+@_with_report_configure_error
def on_ts_package_check_files(unit):
ts_files = unit.get("_TS_FILES_COPY_CMD")
if ts_files == "":