anki/qt/aqt/forms/compile.bzl
Damien Elmes 281f1b2bf9 build all the UI files in one go
On macOS, the overhead of importing PyQt for each file far exceeds
any gains we get from incremental recompilation.
2021-10-16 09:20:20 +10:00

28 lines
709 B
Python

def compile_all(name, builder, srcs):
py_files = []
for ui_file in srcs:
base = ui_file.replace(".ui", "")
qt5_file = base + "_qt5.py"
qt6_file = base + "_qt6.py"
py_files.extend([qt5_file, qt6_file])
native.genrule(
name = name + "_build",
srcs = srcs,
outs = py_files,
cmd = "$(location {builder}) $(location {first_ui}) $(location {first_py})".format(
builder = builder,
first_ui = srcs[0],
first_py = py_files[0],
),
tools = [
builder,
],
message = "Building Qt UI",
)
native.filegroup(
name = name,
srcs = py_files,
)