Skip to content

Commit ce7a327

Browse files
author
deshevoy
committed
[build] Add optional SUFFIX to BUNDLE()
commit_hash:340460c18f39c151147e8e942a5e82e8f485f714
1 parent 8ab9bd7 commit ce7a327

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

build/plugins/bundle.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,29 @@
33

44
def onbundle(unit, *args):
55
"""
6-
@usage BUNDLE(<Dir [NAME Name]>...)
6+
@usage BUNDLE(<Dir [SUFFIX Suffix] [NAME Name]>...)
77
88
Brings build artefact from module Dir under optional Name to the current module (e.g. UNION)
99
If NAME is not specified, the name of the Dir's build artefact will be preserved
10+
Optional SUFFIX allows to use secondary module output. The suffix is appended to the primary output name, so the applicability is limited.
1011
It makes little sense to specify BUNDLE on non-final targets and so this may stop working without prior notice.
1112
Bundle on multimodule will select final target among multimodule variants and will fail if there are none or more than one.
1213
"""
1314
i = 0
1415
while i < len(args):
15-
if i + 2 < len(args) and args[i + 1] == "NAME":
16-
target, name = args[i], args[i + 2]
17-
i += 3
16+
target = args[i]
17+
i += 1
18+
19+
if i + 1 < len(args) and args[i] == "SUFFIX":
20+
suffix = args[i + 1]
21+
i += 2
22+
else:
23+
suffix = ""
24+
25+
if i + 1 < len(args) and args[i] == "NAME":
26+
name = args[i + 1]
27+
i += 2
1828
else:
19-
target, name = args[i], os.path.basename(args[i])
20-
i += 1
29+
name = os.path.basename(target) + suffix
2130

22-
unit.on_bundle_target([target, name])
31+
unit.on_bundle_target([target, name, suffix])

build/ymake.core.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,8 +2725,8 @@ macro ALL_RESOURCE_FILES_FROM_DIRS(PREFIX="", STRIP="", DIRS...) {
27252725
_ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${_ALL_RES_DIRS})
27262726
}
27272727

2728-
macro _BUNDLE_TARGET(Target, Destination) {
2729-
.CMD=$MOVE_FILE ${result:Target} ${noauto;output:Destination} ${hide;kv:"p BN"} ${hide;kv:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
2728+
macro _BUNDLE_TARGET(Target, Destination, Suffix) {
2729+
.CMD=$MOVE_FILE ${result:Target}$Suffix ${noauto;output:Destination} ${hide;kv:"p BN"} ${hide;kv:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
27302730
}
27312731

27322732
### @usage: TIMEOUT(TIMEOUT)

0 commit comments

Comments
 (0)