diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-20 11:42:02 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-23 10:16:02 +0000 |
commit | 047a658aac4c01d0ec3deb0459a1a88328ed9821 (patch) | |
tree | f10c1f88233af4e79fef1a00995ab9ce1ddcd8e4 /sources/shiboken2/generator | |
parent | e36aedaf2182cf81c919c5825c694c6ae3908198 (diff) |
shiboken: Add options for diff and dry-run
Refactor and breathe life back into the existing diff/dry-run
functionality of class FileOut and make it available via command line
options.
Change-Id: I32e1e262c0c2e8f107776923477fe9714ad295cf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r-- | sources/shiboken2/generator/main.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp index 900f69166..67d838ce8 100644 --- a/sources/shiboken2/generator/main.cpp +++ b/sources/shiboken2/generator/main.cpp @@ -34,6 +34,7 @@ #include <QtCore/QDir> #include <iostream> #include <apiextractor.h> +#include <fileout.h> #include "generator.h" #include "shibokenconfig.h" #include "cppgenerator.h" @@ -52,6 +53,9 @@ static inline QString frameworkIncludePathOption() { return QStringLiteral("fram static inline QString systemIncludePathOption() { return QStringLiteral("system-include-paths"); } static inline QString typesystemPathOption() { return QStringLiteral("typesystem-paths"); } static inline QString helpOption() { return QStringLiteral("help"); } +static inline QString diffOption() { return QStringLiteral("diff"); } +static inline QString dryrunOption() { return QStringLiteral("dry-run"); } + static const char helpHint[] = "Note: use --help or -h for more information.\n"; typedef QMap<QString, QString> CommandArgumentMap; @@ -316,6 +320,10 @@ void printUsage() QLatin1String("System include paths used by the C++ parser")) << qMakePair(QLatin1String("generator-set=<\"generator module\">"), QLatin1String("generator-set to be used. e.g. qtdoc")) + << qMakePair(diffOption(), + QLatin1String("Print a diff of wrapper files")) + << qMakePair(dryrunOption(), + QLatin1String("Dry run, do not generate wrapper files")) << qMakePair(QLatin1String("-h"), QString()) << qMakePair(helpOption(), QLatin1String("Display this help and exit")) @@ -437,6 +445,18 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } + ait = args.find(diffOption()); + if (ait != args.end()) { + args.erase(ait); + FileOut::diff = true; + } + + ait = args.find(dryrunOption()); + if (ait != args.end()) { + args.erase(ait); + FileOut::dummy = true; + } + QString licenseComment; ait = args.find(QLatin1String("license-file")); if (ait != args.end()) { |