aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlaotstats/main.cpp
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2024-10-30 13:40:55 +0100
committerOlivier De Cannière <olivier.decanniere@qt.io>2024-11-04 15:21:09 +0100
commit318ac440653a570d2bd18fc3d25e1b2fc8af88fa (patch)
treeb20109a0333f44538565c69a4d69cd0683495133 /tools/qmlaotstats/main.cpp
parent09f51978f4ab03f9dcaa36aba4f0c861f59b890c (diff)
aotstats: Support --only-bytecode and modules with no qml files
It is possible to pass --only-bytecode to qmlcachegen. As the name implies, this only generates the bytecode for the qml files and does not compile them. This case was not taken into account which could lead to files commands depend upon not being generated. Therefore, keep track of empty and only-bytecode modules in files generated by cmake and pass them to qmlaotstats upon aggregation such that it can include that information in the report. Also, only pass the arguments specific to aotstats to qmlcachegen if --only-bytecode is not set for that module. Fixes: QTBUG-130084 Task-number: QTBUG-124667 Pick-to: 6.8 Change-Id: I44b4a80e8a6fd2f9bc16ae1bb2c8d540ff3b697b Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tools/qmlaotstats/main.cpp')
-rw-r--r--tools/qmlaotstats/main.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/qmlaotstats/main.cpp b/tools/qmlaotstats/main.cpp
index 24b34efec3..42ef263979 100644
--- a/tools/qmlaotstats/main.cpp
+++ b/tools/qmlaotstats/main.cpp
@@ -54,6 +54,10 @@ int main(int argc, char **argv)
parser.addPositionalArgument("output", "Aggregate mode: the path where to store the "
"aggregated aotstats. Format mode: the the path where "
"the formatted output will be saved.");
+ QCommandLineOption emptyModulesOption("empty-modules", QCoreApplication::translate("main", "Format mode: File containing a list of modules with no QML files."), "file");
+ parser.addOption(emptyModulesOption);
+ QCommandLineOption onlyBytecodeModulesOption("only-bytecode-modules", QCoreApplication::translate("main", "Format mode: File containing a list of modules for which only the bytecode is generated."), "file");
+ parser.addOption(onlyBytecodeModulesOption);
parser.process(app);
const auto &positionalArgs = parser.positionalArguments();
@@ -74,7 +78,18 @@ int main(int argc, char **argv)
const auto aotstats = QQmlJS::AotStats::parseAotstatsFile(positionalArgs[1]);
if (!aotstats.has_value())
return EXIT_FAILURE;
- const QQmlJS::AotStatsReporter reporter(aotstats.value());
+
+ const auto emptyModules = parser.isSet(emptyModulesOption)
+ ? QQmlJS::AotStats::readAllLines(parser.value(emptyModulesOption))
+ : QStringList();
+ const auto onlyBytecodeModules = parser.isSet(onlyBytecodeModulesOption)
+ ? QQmlJS::AotStats::readAllLines(parser.value(onlyBytecodeModulesOption))
+ : QStringList();
+ if (!emptyModules || !onlyBytecodeModules)
+ return EXIT_FAILURE;
+
+ const QQmlJS::AotStatsReporter reporter(aotstats.value(), emptyModules.value(),
+ onlyBytecodeModules.value());
if (!saveFormattedStats(reporter.format(), positionalArgs[2]))
return EXIT_FAILURE;
}