2021-10-16 00:59:09 +02:00
|
|
|
def compile(name, ui_file, qt5_file, qt6_file, builder):
|
2020-11-01 05:26:58 +01:00
|
|
|
native.genrule(
|
|
|
|
name = name,
|
|
|
|
srcs = [ui_file],
|
2021-10-16 00:59:09 +02:00
|
|
|
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,
|
2020-11-01 05:26:58 +01:00
|
|
|
ui_file = ui_file,
|
2021-10-16 00:59:09 +02:00
|
|
|
qt5_file = qt5_file,
|
|
|
|
qt6_file = qt6_file,
|
2020-11-01 05:26:58 +01:00
|
|
|
),
|
|
|
|
tools = [
|
2021-10-05 05:18:43 +02:00
|
|
|
builder,
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
|
|
|
message = "Building UI",
|
|
|
|
)
|
|
|
|
|
2021-10-16 00:59:09 +02:00
|
|
|
def compile_all(name, builder, srcs):
|
2020-11-01 05:26:58 +01:00
|
|
|
py_files = []
|
|
|
|
for ui_file in srcs:
|
2021-10-16 00:59:09 +02:00
|
|
|
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)
|
2020-11-01 05:26:58 +01:00
|
|
|
|
|
|
|
native.filegroup(
|
2021-10-05 05:18:43 +02:00
|
|
|
name = name,
|
|
|
|
srcs = py_files,
|
2020-11-01 05:26:58 +01:00
|
|
|
)
|