Browse Source

intermediate changes
ref:5bc2a57c5d394201cd37814df101c8d32e444ce8

arcadia-devtools 2 years ago
parent
commit
60928c4d64
3 changed files with 35 additions and 4 deletions
  1. 1 1
      build/plugins/copy_files_to_build_prefix.py
  2. 11 0
      build/plugins/res.py
  3. 23 3
      build/ymake.core.conf

+ 1 - 1
build/plugins/copy_files_to_build_prefix.py

@@ -7,7 +7,7 @@ CURDIR = '${CURDIR}/'
 BINDIR = '${BINDIR}/'
 
 
-def oncopy_files_to_build_prefix(unit, *args):
+def on_copy_files_to_build_prefix(unit, *args):
     keywords = {'PREFIX': 1, 'GLOBAL': 0}
     # NB! keyword 'GLOBAL' is a way to skip this word from the list of files
 

+ 11 - 0
build/plugins/res.py

@@ -1,4 +1,5 @@
 from _common import iterpair, listid, pathid, rootrel_arc_src, tobuilddir, filter_out_by_keyword
+import ymake
 
 
 def split(lst, limit):
@@ -88,6 +89,9 @@ def onresource_files(unit, *args):
 
     args = iter(args[first:])
     for arg in args:
+        if arg == 'DONT_PARSE':
+            # ignore explicit specification
+            continue
         if arg == 'PREFIX':
             prefix, dest = next(args), None
         elif arg == 'DEST':
@@ -104,3 +108,10 @@ def onresource_files(unit, *args):
         unit.on_go_resource(res)
     else:
         unit.onresource(res)
+
+def onall_resource_files(unit, *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')
+

+ 23 - 3
build/ymake.core.conf

@@ -5307,6 +5307,26 @@ macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO":"", OUTPUT_INCLUDES[]) {
     .CMD=$COPY_FILE($FILE $DEST $AUTO OUTPUT_INCLUDES $FILE $OUTPUT_INCLUDES)
 }
 
+### This is to join $ALL_RES_ and $EXT
+macro _ARF_HELPER(Args...) {
+     RESOURCE_FILES($Args)
+}
+
+### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
+###
+### This macro collects all files with extension `Ext` and
+### Passes them to `RESOURCE_FILES` macro as relative to current directory
+###
+### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
+###
+### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
+### Note: Wildcards are not allowed neither as Ext nor in Dirs
+macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
+     _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
+     _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}${pre=/:STRIP} ${pre=$ALL_RES_:EXT})
+}
+
+
 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__
 }
@@ -7652,9 +7672,9 @@ macro USE_EXT_PROTO(EXTRA_TAGS...) {
 ### FILES() macro). Currently this macro copies only files with the following
 ### extensions: .proto, .gztproto, .ev
 macro _RAW_PROTO_SRCS(FILES...) {
-    COPY_FILES_TO_BUILD_PREFIX(${ext=.proto:FILES} PREFIX ${_EXT_PROTO_DIR})
-    COPY_FILES_TO_BUILD_PREFIX(${ext=.gztproto:FILES} PREFIX ${_EXT_PROTO_DIR})
-    COPY_FILES_TO_BUILD_PREFIX(${ext=.ev:FILES} PREFIX ${_EXT_PROTO_DIR})
+    _COPY_FILES_TO_BUILD_PREFIX(${ext=.proto:FILES} PREFIX ${_EXT_PROTO_DIR})
+    _COPY_FILES_TO_BUILD_PREFIX(${ext=.gztproto:FILES} PREFIX ${_EXT_PROTO_DIR})
+    _COPY_FILES_TO_BUILD_PREFIX(${ext=.ev:FILES} PREFIX ${_EXT_PROTO_DIR})
 }
 
 module PROTO_DESCRIPTIONS: _BARE_UNIT {