Browse Source

Introduce ALL_RESOURCE_FILES_FROM_DIRS

spreis 1 year ago
parent
commit
8037faa61b
2 changed files with 25 additions and 2 deletions
  1. 10 2
      build/plugins/res.py
  2. 15 0
      build/ymake.core.conf

+ 10 - 2
build/plugins/res.py

@@ -65,11 +65,19 @@ def onresource_files(unit, *args):
         unit.onresource(res)
 
 
-def onall_resource_files(unit, *args):
+def on_all_resource_files(unit, macro, *args):
     # This is only validation, actual work is done in ymake.core.conf implementation
     for arg in args:
         if '*' in arg or '?' in arg:
-            ymake.report_configure_error('Wildcards in [[imp]]ALL_RESOURCE_FILES[[rst]] are not allowed')
+            ymake.report_configure_error('Wildcards in [[imp]]{}[[rst]] are not allowed'.format(macro))
+
+
+def onall_resource_files(unit, *args):
+    on_all_resource_files(unit, 'ALL_RESOURCE_FILES', args)
+
+
+def onall_resource_files_from_dirs(unit, *args):
+    on_all_resource_files(unit, 'ALL_RESOURCE_FILES_FROM_DIRS', args)
 
 
 def on_ya_conf_json(unit, conf_file):

+ 15 - 0
build/ymake.core.conf

@@ -2560,6 +2560,21 @@ macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
      _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
 }
 
+### @usage ALL_RESOURCE_FILES_FROM_DIRS([PREFIX {prefix}] [STRIP {strip}] Dirs...)
+###
+### This macro collects all files non-recursively from listed Dirs and
+### Passes them to `RESOURCE_FILES` macro as relative to current directory
+### The macro is usefull if literally all files are needed because `ALL_RESOURCE_FILES` requires extension to be specified
+###
+### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
+###
+### Note: This macro can be used only once per ya.make
+### Note: Wildcards are not allowed neither as Ext nor in Dirs
+macro ALL_RESOURCE_FILES_FROM_DIRS(PREFIX="", STRIP="", DIRS...) {
+     _GLOB(_ALL_RES_DIRS ${suf=/*:DIRS})
+     _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${_ALL_RES_DIRS})
+}
+
 macro _BUNDLE_TARGET(Target, Destination) {
     .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
 }