aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-25 14:57:12 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-30 11:27:08 +0000
commitf332f2e8e66a5fa67b302893a13f0be3687ccc38 (patch)
tree282dbf2b6845b3c90d51c345ecbd55562a4814f9 /sources/shiboken2/generator
parentd79bb0f4877bd35af99f8ec97aa91ca56207bc23 (diff)
shiboken: Refactor progress message output handling
In class ReportHandler, replace the step counting by a simple pair of startProgress()/endProgress() functions that check for warnings and print the appropriate terminator. Module name and timestamp are now also printed. Add a few more messages and give proper names to the generators. Change-Id: I92b4ef2854b824fbba3d371417edc1f88561a2cb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r--sources/shiboken2/generator/main.cpp5
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.h3
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.h3
3 files changed, 10 insertions, 1 deletions
diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp
index 9beaf47c7..ac576d657 100644
--- a/sources/shiboken2/generator/main.cpp
+++ b/sources/shiboken2/generator/main.cpp
@@ -624,7 +624,10 @@ int main(int argc, char *argv[])
for (const GeneratorPtr &g : qAsConst(generators)) {
g->setOutputDirectory(outputDirectory);
g->setLicenseComment(licenseComment);
- if (!g->setup(extractor) || !g->generate()) {
+ ReportHandler::startProgress(QByteArray("Running ") + g->name() + "...");
+ const bool ok = g->setup(extractor) && g->generate();
+ ReportHandler::endProgress();
+ if (!ok) {
errorPrint(QLatin1String("Error running generator: ")
+ QLatin1String(g->name()) + QLatin1Char('.'));
return EXIT_FAILURE;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.h b/sources/shiboken2/generator/shiboken2/cppgenerator.h
index d2e04dba2..519e12b7b 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.h
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.h
@@ -38,6 +38,9 @@ class CppGenerator : public ShibokenGenerator
{
public:
CppGenerator();
+
+ const char *name() const override { return "Source generator"; }
+
protected:
QString fileNameSuffix() const override;
QString fileNameForContext(GeneratorContext &context) const override;
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.h b/sources/shiboken2/generator/shiboken2/headergenerator.h
index 821531aab..f59e0fd9a 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.h
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.h
@@ -42,6 +42,9 @@ class HeaderGenerator : public ShibokenGenerator
{
public:
OptionDescriptions options() const override { return OptionDescriptions(); }
+
+ const char *name() const override { return "Header generator"; }
+
protected:
QString fileNameSuffix() const override;
QString fileNameForContext(GeneratorContext &context) const override;