aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/build_dll_and_java.py
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
committeralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
commitbf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0 (patch)
tree1d1df72c0541a59a81439842f46d95396d3e7189 /build/scripts/build_dll_and_java.py
parent8bfdfa9a9bd19bddbc58d888e180fbd1218681be (diff)
downloadydb-bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0.tar.gz
add ymake export to ydb
Diffstat (limited to 'build/scripts/build_dll_and_java.py')
-rw-r--r--build/scripts/build_dll_and_java.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/build/scripts/build_dll_and_java.py b/build/scripts/build_dll_and_java.py
new file mode 100644
index 0000000000..b9d8aff4df
--- /dev/null
+++ b/build/scripts/build_dll_and_java.py
@@ -0,0 +1,47 @@
+import os
+import subprocess
+import sys
+
+
+def just_do_it(argv):
+ delim = argv[0]
+ args = []
+ for item in argv:
+ if item == delim:
+ args.append([])
+ else:
+ args[-1].append(item)
+ dll_cmd, java_cmd, inputs, dll_out, java_out, jsrs_out, roots = args
+ dll_out, java_out, jsrs_out, build_root, source_root = dll_out[0], java_out[0], jsrs_out[0], roots[0], roots[1]
+ for inp in inputs:
+ origin_inp = inp
+ if os.path.isabs(inp):
+ if os.path.relpath(inp, build_root).startswith('..'):
+ inp = os.path.relpath(inp, source_root)
+ else:
+ inp = os.path.relpath(inp, build_root)
+ ext = os.path.splitext(inp)[1]
+ if ext in ('.o', '.obj'):
+ if os.path.join(build_root, inp) in java_cmd:
+ inp = os.path.join(build_root, inp)
+ if sys.platform == 'win32':
+ inp = inp.replace('\\', '/')
+ if inp not in java_cmd:
+ inp = build_root + '/' + inp
+ java_cmd.remove(inp)
+ if ext in ('.java', '.jsrc'):
+ if origin_inp in dll_cmd:
+ inp = origin_inp
+ elif os.path.join(build_root, inp) in dll_cmd:
+ inp = os.path.join(build_root, inp)
+ if sys.platform == 'win32':
+ inp = inp.replace('\\', '/')
+ dll_cmd.remove(inp)
+ java_cmd.insert(java_cmd.index(dll_out), java_out)
+ java_cmd.remove(dll_out)
+ subprocess.check_call(java_cmd)
+ subprocess.check_call(dll_cmd)
+
+
+if __name__ == '__main__':
+ just_do_it(sys.argv[1:])