qmlcachegen: Reject using --only-bytecode with compiler-only options

[ChangeLog][QtQml] qmlcachegen will now exit with a failure state if
--only-bytecode is set as the same time as Script Compiler exclusive
options. The only-bytecode flag skips the compilation altogether.
Remove one of the conflicting flag to solve the issue.

Change-Id: I5c6a0610ec4c2eb06624c2d123ab62bc633a46b8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Olivier De Cannière 2024-08-22 15:57:59 +02:00
parent dd4a4816ed
commit 6ae36202fd
1 changed files with 17 additions and 0 deletions

View File

@ -140,6 +140,23 @@ int main(int argc, char **argv)
if (target == GenerateLoader && parser.isSet(resourceNameOption)) if (target == GenerateLoader && parser.isSet(resourceNameOption))
target = GenerateLoaderStandAlone; target = GenerateLoaderStandAlone;
if (parser.isSet(onlyBytecode)) {
const std::array<QCommandLineOption *, 5> compilerOnlyOptions{
&directCallsOption, &staticOption, &validateBasicBlocksOption, &dumpAotStatsOption,
&moduleIdOption
};
for (auto *compilerOnlyOption : compilerOnlyOptions) {
if (parser.isSet(*compilerOnlyOption)) {
std::string name = compilerOnlyOption->names().first().toStdString();
fprintf(stderr, "Passing mutually exclusive options \"only-bytecode\" and \"%s\".\n"
"Remove --only-bytecode to be able to use compiler options like --%s",
name.c_str(), name.c_str());
return EXIT_FAILURE;
}
}
}
if (parser.isSet(dumpAotStatsOption) && !parser.isSet(moduleIdOption)) { if (parser.isSet(dumpAotStatsOption) && !parser.isSet(moduleIdOption)) {
fprintf(stderr, "--dump-aot-stats set without setting --module-id"); fprintf(stderr, "--dump-aot-stats set without setting --module-id");
return EXIT_FAILURE; return EXIT_FAILURE;