diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-06-13 11:05:01 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-06-13 11:05:01 +0300 |
commit | bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0 (patch) | |
tree | 1d1df72c0541a59a81439842f46d95396d3e7189 /build/plugins/lj_archive.py | |
parent | 8bfdfa9a9bd19bddbc58d888e180fbd1218681be (diff) | |
download | ydb-bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0.tar.gz |
add ymake export to ydb
Diffstat (limited to 'build/plugins/lj_archive.py')
-rw-r--r-- | build/plugins/lj_archive.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/build/plugins/lj_archive.py b/build/plugins/lj_archive.py new file mode 100644 index 0000000000..9f071f3d87 --- /dev/null +++ b/build/plugins/lj_archive.py @@ -0,0 +1,46 @@ +def onlj_archive(unit, *args): + """ + @usage: LJ_ARCHIVE(NAME Name LuaFiles...) + Precompile .lua files using LuaJIT and archive both sources and results using sources names as keys + """ + + def iter_luas(l): + for a in l: + if a.endswith('.lua'): + yield a + + def iter_objs(l): + for a in l: + s = a[:-3] + 'raw' + unit.on_luajit_objdump(['OUT', s, a]) + yield s + + luas = list(iter_luas(args)) + objs = list(iter_objs(luas)) + + unit.onarchive_by_keys(['DONTCOMPRESS', 'NAME', 'LuaScripts.inc', 'KEYS', ':'.join(luas)] + objs) + unit.onarchive_by_keys(['DONTCOMPRESS', 'NAME', 'LuaSources.inc', 'KEYS', ':'.join(luas)] + luas) + + +def onlj_21_archive(unit, *args): + """ + @usage: LJ_21_ARCHIVE(NAME Name LuaFiles...) # deprecated + Precompile .lua files using LuaJIT 2.1 and archive both sources and results using sources names as keys + """ + + def iter_luas(l): + for a in l: + if a.endswith('.lua'): + yield a + + def iter_objs(l): + for a in l: + s = a[:-3] + 'raw' + unit.on_luajit_21_objdump(['OUT', s, a]) + yield s + + luas = list(iter_luas(args)) + objs = list(iter_objs(luas)) + + unit.onarchive_by_keys(['DONTCOMPRESS', 'NAME', 'LuaScripts.inc', 'KEYS', ':'.join(luas)] + objs) + unit.onarchive_by_keys(['DONTCOMPRESS', 'NAME', 'LuaSources.inc', 'KEYS', ':'.join(luas)] + luas) |