Skip to content

Commit aac8317

Browse files
committed
qt-build-utils: only run qmlcachegen when there are QML files
Otherwise we have a build failure as qmlcache_loader.cpp file does not exist.
1 parent 7c74709 commit aac8317

File tree

1 file changed

+19
-15
lines changed
  • crates/qt-build-utils/src

1 file changed

+19
-15
lines changed

crates/qt-build-utils/src/lib.rs

+19-15
Original file line numberDiff line numberDiff line change
@@ -739,22 +739,26 @@ prefer :/qt/qml/{qml_uri_dirs}/
739739
qmlcachegen_loader.clone(),
740740
];
741741

742-
let cmd = Command::new(qmlcachegen_executable)
743-
.args(
744-
common_args
745-
.iter()
746-
.chain(&specific_args)
747-
.chain(&qml_file_qrc_paths),
748-
)
749-
.output()
750-
.unwrap_or_else(|_| panic!("qmlcachegen failed for QML module {uri}"));
751-
if !cmd.status.success() {
752-
panic!(
753-
"qmlcachegen failed for QML module {uri}:\n{}",
754-
String::from_utf8_lossy(&cmd.stderr)
755-
);
742+
// If there are no QML files there is nothing for qmlcachegen to run with
743+
if !qml_files.is_empty()
744+
{
745+
let cmd = Command::new(qmlcachegen_executable)
746+
.args(
747+
common_args
748+
.iter()
749+
.chain(&specific_args)
750+
.chain(&qml_file_qrc_paths),
751+
)
752+
.output()
753+
.unwrap_or_else(|_| panic!("qmlcachegen failed for QML module {uri}"));
754+
if !cmd.status.success() {
755+
panic!(
756+
"qmlcachegen failed for QML module {uri}:\n{}",
757+
String::from_utf8_lossy(&cmd.stderr)
758+
);
759+
}
760+
qmlcachegen_file_paths.push(PathBuf::from(&qmlcachegen_loader));
756761
}
757-
qmlcachegen_file_paths.push(PathBuf::from(&qmlcachegen_loader));
758762
}
759763

760764
// Run qmltyperegistrar

0 commit comments

Comments
 (0)