diff options
author | spreis <spreis@yandex-team.com> | 2024-09-25 10:45:40 +0300 |
---|---|---|
committer | spreis <spreis@yandex-team.com> | 2024-09-25 10:56:58 +0300 |
commit | ad946eabc17a47b71bfb0619b4c45d51e0a83f94 (patch) | |
tree | 6777ce8709b4a94aa28426d3e7dcbf3b96a9724f | |
parent | c3f7aa6885ed705af12ee35462b4efa2a7b2ea28 (diff) | |
download | ydb-ad946eabc17a47b71bfb0619b4c45d51e0a83f94.tar.gz |
Support DONT_COMPRESS in RESOURCE_FILES macro
commit_hash:472aa616870fc2bf68d96f5c8e86143a35d0a142
-rw-r--r-- | build/plugins/res.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/build/plugins/res.py b/build/plugins/res.py index 3057c96a2c..8dcea72d48 100644 --- a/build/plugins/res.py +++ b/build/plugins/res.py @@ -13,7 +13,7 @@ def remove_prefix(text, prefix): def onresource_files(unit, *args): """ - @usage: RESOURCE_FILES([PREFIX {prefix}] [STRIP prefix_to_strip] {path}) + @usage: RESOURCE_FILES([DONT_COMPRESS] [PREFIX {prefix}] [STRIP prefix_to_strip] {path}) This macro expands into RESOURCE(DONT_PARSE {path} resfs/file/{prefix}{path} @@ -26,8 +26,7 @@ def onresource_files(unit, *args): resfs/file/{key} stores any value whose source was a file on a filesystem. resfs/src/resfs/file/{key} must store its path. - DONT_PARSE disables parsing for source code files (determined by extension) - Please don't abuse: use separate DONT_PARSE macro call only for files subject to parsing + DONT_COMPRESS allows optionally disable resource compression on platforms where it is supported This form is for use from other plugins: RESOURCE_FILES([DEST {dest}] {path}) expands into RESOURCE({path} resfs/file/{dest}) @@ -43,9 +42,14 @@ def onresource_files(unit, *args): # GO_RESOURCE currently doesn't support DONT_PARSE res.append('DONT_PARSE') + if args and not unit.enabled('_GO_MODULE') and 'DONT_COMPRESS' in args: + res.append('DONT_COMPRESS') + args = iter(args) for arg in args: - if arg == 'PREFIX': + if arg == 'DONT_COMPRESS': + pass + elif arg == 'PREFIX': prefix, dest = next(args), None elif arg == 'DEST': dest, prefix = next(args), None @@ -58,7 +62,7 @@ def onresource_files(unit, *args): ) if key in res: unit.message( - ['warn', "Dublicated resource file {} in RESOURCE_FILES() macro. Skipped it.".format(path)] + ['warn', "Duplicated resource file {} in RESOURCE_FILES() macro. Skipped it.".format(path)] ) continue src = 'resfs/src/{}={}'.format(key, rootrel_arc_src(path, unit)) |