diff options
Diffstat (limited to 'tools/binarycreator/main.cpp')
-rw-r--r-- | tools/binarycreator/main.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/tools/binarycreator/main.cpp b/tools/binarycreator/main.cpp index c28a2ebb3..1840d4c2a 100644 --- a/tools/binarycreator/main.cpp +++ b/tools/binarycreator/main.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -30,8 +30,10 @@ #include <init.h> #include <utils.h> #include <loggingutils.h> +#include <archivefactory.h> #include <QtCore/QDebug> +#include <QMetaEnum> #include <iostream> @@ -44,6 +46,7 @@ static void printUsage() suffix = QLatin1String(".exe"); #endif const QString appName = QFileInfo(QCoreApplication::applicationFilePath()).fileName(); + const QString archiveFormats = ArchiveFactory::supportedTypes().join(QLatin1Char('|')); std::cout << "Usage: " << appName << " [options] target" << std::endl; std::cout << std::endl; std::cout << "Options:" << std::endl; @@ -69,9 +72,17 @@ static void printUsage() << std::endl; std::cout << " 'update.rcc' in the current path." << std::endl; #ifdef Q_OS_MACOS + std::cout << " --mt|--create-maintenancetool " << std::endl; + std::cout << " Creates maintenance tool app bundle. Target option is omitted, bundle name "<<std::endl; + std::cout << " can be configured in the config.xml using element <MaintenanceToolName>." << std::endl; std::cout << " -s|--sign identity Sign generated app bundle using the given code " << std::endl; std::cout << " signing identity" << std::endl; #endif + std::cout << " --af|--archive-format " << archiveFormats << std::endl; + std::cout << " Set the format used when packaging new component data archives. If" << std::endl; + std::cout << " you omit this option the 7z format will be used as a default." << std::endl; + std::cout << " --ac|--compression 0,1,3,5,7,9" << std::endl; + std::cout << " Sets the compression level used when packaging new data archives." << std::endl; std::cout << std::endl; std::cout << "Packages are to be found in the current working directory and get listed as " "their names" << std::endl << std::endl; @@ -91,6 +102,11 @@ static void printUsage() std::cout << "Example update.rcc:" << std::endl; std::cout << " " << appName << " -c installer-config" << sep << "config.xml -p packages-directory " "-rcc" << std::endl; +#ifdef Q_OS_MACOS + std::cout << "Example (maintenance tool bundle):" << std::endl; + std::cout << " " << appName << " -c installer-config" << sep << "config.xml" << " --mt" << std::endl; + std::cout << std::endl; +#endif } static int printErrorAndUsageAndExit(const QString &err) @@ -179,7 +195,28 @@ int main(int argc, char **argv) continue; } else if (*it == QLatin1String("-rcc") || *it == QLatin1String("--compile-resource")) { parsedArgs.compileResource = true; + } else if (*it == QLatin1String("--af") || *it == QLatin1String("--archive-format")) { + ++it; + if (it == args.end()) + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Archive format parameter missing argument.")); + parsedArgs.archiveSuffix = *it; + } else if (*it == QLatin1String("--ac") || *it == QLatin1String("--compression")) { + ++it; + if (it == args.end()) + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Compression parameter missing argument")); + + bool ok = false; + QMetaEnum levels = QMetaEnum::fromType<AbstractArchive::CompressionLevel>(); + const int value = it->toInt(&ok); + if (!ok || !levels.valueToKey(value)) { + return printErrorAndUsageAndExit(QString::fromLatin1( + "Error: Unknown compression level \"%1\".").arg(value)); + } + parsedArgs.compression = static_cast<AbstractArchive::CompressionLevel>(value); #ifdef Q_OS_MACOS + } else if (*it == QLatin1String("--mt") || *it == QLatin1String("--create-maintenancetool")) { + parsedArgs.createMaintenanceTool = true; + } else if (*it == QLatin1String("-s") || *it == QLatin1String("--sign")) { ++it; if (it == args.end() || it->startsWith(QLatin1String("-"))) |