summaryrefslogtreecommitdiffstats
path: root/build/plugins/bundle.py
diff options
context:
space:
mode:
authorDevtools Arcadia <[email protected]>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <[email protected]>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /build/plugins/bundle.py
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'build/plugins/bundle.py')
-rw-r--r--build/plugins/bundle.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/build/plugins/bundle.py b/build/plugins/bundle.py
new file mode 100644
index 00000000000..0bec8254eec
--- /dev/null
+++ b/build/plugins/bundle.py
@@ -0,0 +1,22 @@
+import os
+
+
+def onbundle(unit, *args):
+ """
+ @usage BUNDLE(<Dir [NAME Name]>...)
+
+ Brings build artefact from module Dir under optional Name to the current module (e.g. UNION)
+ If NAME is not specified, the name of the Dir's build artefact will be preserved
+ It makes little sense to specify BUNDLE on non-final targets and so this may stop working without prior notice.
+ Bundle on multimodule will select final target among multimodule variants and will fail if there are none or more than one.
+ """
+ i = 0
+ while i < len(args):
+ if i + 2 < len(args) and args[i + 1] == "NAME":
+ target, name = args[i], args[i + 2]
+ i += 3
+ else:
+ target, name = args[i], os.path.basename(args[i])
+ i += 1
+
+ unit.on_bundle_target([target, name])