anki/qt/aqt/forms/compile.bzl

31 lines
880 B
Python
Raw Normal View History

def compile(name, ui_file, qt5_file, qt6_file, builder):
native.genrule(
name = name,
srcs = [ui_file],
outs = [qt5_file, qt6_file],
cmd = "$(location {builder}) $(location {ui_file}) $(location {qt5_file}) $(location {qt6_file})".format(
2021-10-05 05:18:43 +02:00
builder = builder,
ui_file = ui_file,
qt5_file = qt5_file,
qt6_file = qt6_file,
),
tools = [
2021-10-05 05:18:43 +02:00
builder,
],
message = "Building UI",
)
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])
compile(base, ui_file, qt5_file, qt6_file, builder)
native.filegroup(
2021-10-05 05:18:43 +02:00
name = name,
srcs = py_files,
)