Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
main.cpp File Reference
#include <QCoreApplication>
#include <QStringList>
#include <QDir>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonValue>
#include <QDebug>
#include <QDataStream>
#include <QXmlStreamReader>
#include <QStandardPaths>
#include <QUuid>
#include <QDirIterator>
#include <QElapsedTimer>
#include <QRegularExpression>
#include <QSettings>
#include <QHash>
#include <QSet>
#include <QMap>
#include <depfile_shared.h>
#include <shellquote_shared.h>
#include <algorithm>
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Classes

struct  QtDependency
 
struct  QtInstallDirectoryWithTriple
 
struct  Options
 
struct  GradleFlags
 

Macros

#define QT_POPEN_READ   "r"
 

Typedefs

typedef QMap< QByteArray, QByteArrayGradleProperties
 

Enumerations

enum  PackageType { AAB , UnsignedAPK , SignedAPK }
 
enum  ErrorCode {
  Success , SyntaxErrorOrHelpRequested = 1 , CannotReadInputFile = 2 , CannotCopyAndroidTemplate = 3 ,
  CannotReadDependencies = 4 , CannotCopyGnuStl = 5 , CannotCopyQtFiles = 6 , CannotFindApplicationBinary = 7 ,
  CannotCopyAndroidExtraLibs = 10 , CannotCopyAndroidSources = 11 , CannotUpdateAndroidFiles = 12 , CannotCreateAndroidProject = 13 ,
  CannotBuildAndroidProject = 14 , CannotSignPackage = 15 , CannotInstallApk = 16 , CannotCopyAndroidExtraResources = 19 ,
  CannotCopyApk = 20 , CannotCreateRcc = 21
}
 

Functions

FILE * openProcess (const QString &command)
 
bool goodToCopy (const Options *options, const QString &file, QStringList *unmetDependencies)
 
bool checkCanImportFromRootPaths (const Options *options, const QString &absolutePath, const QString &moduleUrl)
 
bool readDependenciesFromElf (Options *options, const QString &fileName, QSet< QString > *usedDependencies, QSet< QString > *remainingDependencies)
 
QString architectureFromName (const QString &name)
 
static QString execSuffixAppended (QString path)
 
static QString batSuffixAppended (QString path)
 
QString defaultLibexecDir ()
 
static QString llvmReadobjPath (const Options &options)
 
QString fileArchitecture (const Options &options, const QString &path)
 
bool checkArchitecture (const Options &options, const QString &fileName)
 
void deleteMissingFiles (const Options &options, const QDir &srcDir, const QDir &dstDir)
 
Options parseOptions ()
 
void printHelp ()
 
bool quasiLexicographicalReverseLessThan (const QFileInfo &fi1, const QFileInfo &fi2)
 
bool alwaysOverwritableFile (const QString &fileName)
 
bool copyFileIfNewer (const QString &sourceFileName, const QString &destinationFileName, const Options &options, bool forceOverwrite=false)
 
QString cleanPackageName (QString packageName)
 
QString detectLatestAndroidPlatform (const QString &sdkPath)
 
QString packageNameFromAndroidManifest (const QString &androidManifestPath)
 
bool parseCmakeBoolean (const QJsonValue &value)
 
bool readInputFileDirectory (Options *options, QJsonObject &jsonObject, const QString keyName)
 
bool readInputFile (Options *options)
 
bool isDeployment (const Options *options, Options::DeploymentMechanism deployment)
 
bool copyFiles (const QDir &sourceDirectory, const QDir &destinationDirectory, const Options &options, bool forceOverwrite=false)
 
void cleanTopFolders (const Options &options, const QDir &srcDir, const QString &dstDir)
 
void cleanAndroidFiles (const Options &options)
 
bool copyAndroidTemplate (const Options &options, const QString &androidTemplate, const QString &outDirPrefix=QString())
 
bool copyGradleTemplate (const Options &options)
 
bool copyAndroidTemplate (const Options &options)
 
bool copyAndroidSources (const Options &options)
 
bool copyAndroidExtraLibs (Options *options)
 
QStringList allFilesInside (const QDir &current, const QDir &rootDir)
 
bool copyAndroidExtraResources (Options *options)
 
bool updateFile (const QString &fileName, const QHash< QString, QString > &replacements)
 
bool updateLibsXml (Options *options)
 
bool updateStringsXml (const Options &options)
 
bool updateAndroidManifest (Options &options)
 
bool updateAndroidFiles (Options &options)
 
static QString absoluteFilePath (const Options *options, const QString &relativeFileName)
 
QList< QtDependencyfindFilesRecursively (const Options &options, const QFileInfo &info, const QString &rootPath)
 
QList< QtDependencyfindFilesRecursively (const Options &options, const QString &fileName)
 
bool readAndroidDependencyXml (Options *options, const QString &moduleName, QSet< QString > *usedDependencies, QSet< QString > *remainingDependencies)
 
QStringList getQtLibsFromElf (const Options &options, const QString &fileName)
 
bool scanImports (Options *options, QSet< QString > *usedDependencies)
 
bool runCommand (const Options &options, const QString &command)
 
bool createRcc (const Options &options)
 
bool readDependencies (Options *options)
 
bool containsApplicationBinary (Options *options)
 
FILE * runAdb (const Options &options, const QString &arguments)
 
bool copyQtFiles (Options *options)
 
QStringList getLibraryProjectsInOutputFolder (const Options &options)
 
QString findInPath (const QString &fileName)
 
static GradleProperties readGradleProperties (const QString &path)
 
static bool mergeGradleProperties (const QString &path, GradleProperties properties)
 
GradleFlags gradleBuildFlags (const QString &path)
 
bool buildAndroidProject (const Options &options)
 
bool uninstallApk (const Options &options)
 
QString packagePath (const Options &options, PackageType pt)
 
bool installApk (const Options &options)
 
bool copyPackage (const Options &options)
 
bool copyStdCpp (Options *options)
 
static QString zipalignPath (const Options &options, bool *ok)
 
bool signAAB (const Options &options)
 
bool signPackage (const Options &options)
 
bool writeDependencyFile (const Options &options)
 
int main (int argc, char *argv[])
 [2]
 

Variables

static const bool mustReadOutputAnyway = true
 
static QStringList dependenciesForDepfile
 
static const QHash< QByteArray, QByteArrayelfArchitectures
 

Macro Definition Documentation

◆ QT_POPEN_READ

#define QT_POPEN_READ   "r"

Definition at line 38 of file main.cpp.

Typedef Documentation

◆ GradleProperties

Definition at line 2616 of file main.cpp.

Enumeration Type Documentation

◆ ErrorCode

enum ErrorCode
Enumerator
Success 
SyntaxErrorOrHelpRequested 
CannotReadInputFile 
CannotCopyAndroidTemplate 
CannotReadDependencies 
CannotCopyGnuStl 
CannotCopyQtFiles 
CannotFindApplicationBinary 
CannotCopyAndroidExtraLibs 
CannotCopyAndroidSources 
CannotUpdateAndroidFiles 
CannotCreateAndroidProject 
CannotBuildAndroidProject 
CannotSignPackage 
CannotInstallApk 
CannotCopyAndroidExtraResources 
CannotCopyApk 
CannotCreateRcc 

Definition at line 3195 of file main.cpp.

◆ PackageType

Enumerator
AAB 
UnsignedAPK 
SignedAPK 

Definition at line 2875 of file main.cpp.

Function Documentation

◆ absoluteFilePath()

static QString absoluteFilePath ( const Options options,
const QString relativeFileName 
)
static

Definition at line 1791 of file main.cpp.

References dir, QString::endsWith(), QFile::exists(), Options::extraLibraryDirs, Options::extraPrefixDirs, QString::mid(), Options::qtDataDirectory, Options::qtInstallDirectory, Options::qtLibsDirectory, and QString::startsWith().

Referenced by QResourceFileEngine::fileName(), getQtLibsFromElf(), goodToCopy(), QQmlPluginImporter::importDynamicPlugin(), QQmlPluginImporter::importStaticPlugin(), readAndroidDependencyXml(), readDependencies(), readDependenciesFromElf(), and QDeviceDiscoveryStatic::scanConnectedDevices().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allFilesInside()

QStringList allFilesInside ( const QDir current,
const QDir rootDir 
)

Definition at line 1446 of file main.cpp.

References allFilesInside(), dir, QDir::Dirs, QDir::entryList(), file, QDir::filePath(), QDir::Files, files, QDir::NoDotAndDotDot, and QDir::relativeFilePath().

Referenced by allFilesInside(), and copyAndroidExtraResources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alwaysOverwritableFile()

bool alwaysOverwritableFile ( const QString fileName)

Definition at line 686 of file main.cpp.

References fileName.

Referenced by copyFileIfNewer().

+ Here is the caller graph for this function:

◆ architectureFromName()

QString architectureFromName ( const QString name)

Definition at line 256 of file main.cpp.

References QRegularExpression::match(), match(), and QStringLiteral.

Referenced by fileArchitecture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ batSuffixAppended()

static QString batSuffixAppended ( QString  path)
static

Definition at line 273 of file main.cpp.

Referenced by buildAndroidProject(), and signPackage().

+ Here is the caller graph for this function:

◆ buildAndroidProject()

◆ checkArchitecture()

bool checkArchitecture ( const Options options,
const QString fileName 
)

Definition at line 332 of file main.cpp.

References Options::currentArchitecture, fileArchitecture(), and fileName.

Referenced by copyAndroidExtraLibs(), copyAndroidExtraResources(), goodToCopy(), readAndroidDependencyXml(), and scanImports().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkCanImportFromRootPaths()

bool checkCanImportFromRootPaths ( const Options options,
const QString absolutePath,
const QString moduleUrl 
)

Definition at line 2288 of file main.cpp.

References absolutePath(), and Options::rootPaths.

Referenced by scanImports().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanAndroidFiles()

void cleanAndroidFiles ( const Options options)

Definition at line 1320 of file main.cpp.

References Options::androidSourceDirectory, cleanTopFolders(), QString::isEmpty(), Options::outputDirectory, Options::qtDataDirectory, and Options::qtInstallDirectory.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanPackageName()

QString cleanPackageName ( QString  packageName)

Definition at line 734 of file main.cpp.

References ch, QString::indexOf(), QString::insert(), QString::isEmpty(), keywords, QString::mid(), next, and QString::size().

Referenced by packageNameFromAndroidManifest(), and readInputFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanTopFolders()

void cleanTopFolders ( const Options options,
const QDir srcDir,
const QString dstDir 
)

Definition at line 1311 of file main.cpp.

References deleteMissingFiles(), dir, QDir::Dirs, QDir::entryInfoList(), and QDir::NoDotAndDotDot.

Referenced by cleanAndroidFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ containsApplicationBinary()

bool containsApplicationBinary ( Options options)

Definition at line 2427 of file main.cpp.

References Options::applicationBinary, QString::arg(), Options::build, Options::currentArchitecture, QFile::exists(), Options::outputDirectory, qPrintable, and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyAndroidExtraLibs()

bool copyAndroidExtraLibs ( Options options)

Definition at line 1398 of file main.cpp.

References Options::archExtraLibs, Options::Bundled, checkArchitecture(), copyFileIfNewer(), Options::currentArchitecture, Options::deploymentMechanism, QFileInfo::exists(), Options::extraLibs, QFileInfo::fileName(), QFileInfo::filePath(), isDeployment(), Options::outputDirectory, qPrintable, QString::startsWith(), QFileInfo::suffix(), Options::Unbundled, and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyAndroidExtraResources()

bool copyAndroidExtraResources ( Options options)

Definition at line 1461 of file main.cpp.

References allFilesInside(), Options::archExtraPlugins, checkArchitecture(), copyFileIfNewer(), Options::currentArchitecture, QDir::dirName(), QFileInfo::exists(), Options::extraPlugins, QDir::filePath(), files, isDeployment(), QFileInfo::isDir(), Options::outputDirectory, qPrintable, Options::Unbundled, and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyAndroidSources()

bool copyAndroidSources ( const Options options)

Definition at line 1381 of file main.cpp.

References Options::androidSourceDirectory, copyFiles(), QDir::exists(), QString::isEmpty(), Options::outputDirectory, qPrintable, and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyAndroidTemplate() [1/2]

bool copyAndroidTemplate ( const Options options)

Definition at line 1367 of file main.cpp.

References copyAndroidTemplate(), copyGradleTemplate(), and Options::verbose.

+ Here is the call graph for this function:

◆ copyAndroidTemplate() [2/2]

bool copyAndroidTemplate ( const Options options,
const QString androidTemplate,
const QString outDirPrefix = QString() 
)

Definition at line 1331 of file main.cpp.

References QDir::absolutePath(), copyFiles(), QDir::current(), QDir::exists(), Options::outputDirectory, qPrintable, Options::qtDataDirectory, and Options::qtInstallDirectory.

Referenced by copyAndroidTemplate(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyFileIfNewer()

bool copyFileIfNewer ( const QString sourceFileName,
const QString destinationFileName,
const Options options,
bool  forceOverwrite = false 
)

Definition at line 695 of file main.cpp.

References alwaysOverwritableFile(), QFile::copy(), dependenciesForDepfile, QFile::exists(), QFileInfo::lastModified(), qPrintable, remove(), and Options::verbose.

Referenced by copyAndroidExtraLibs(), copyAndroidExtraResources(), copyFiles(), copyQtFiles(), and copyStdCpp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyFiles()

bool copyFiles ( const QDir sourceDirectory,
const QDir destinationDirectory,
const Options options,
bool  forceOverwrite = false 
)

Definition at line 1288 of file main.cpp.

References QDir::absoluteFilePath(), copyFileIfNewer(), copyFiles(), destination, dir, QDir::Dirs, QDir::entryInfoList(), QDir::Files, QDir::mkpath(), QDir::NoDotAndDotDot, QDir::path(), and qPrintable.

Referenced by copyAndroidSources(), copyAndroidTemplate(), copyFiles(), and copyGradleTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyGradleTemplate()

bool copyGradleTemplate ( const Options options)

Definition at line 1349 of file main.cpp.

References QDir::absolutePath(), copyFiles(), QDir::current(), QDir::exists(), Options::outputDirectory, qPrintable, Options::qtDataDirectory, and Options::qtInstallDirectory.

Referenced by copyAndroidTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyPackage()

bool copyPackage ( const Options options)

Definition at line 2946 of file main.cpp.

References Options::apkPath, QFile::copy(), QString::isEmpty(), Options::keyStore, packagePath(), QFile::remove(), SignedAPK, and UnsignedAPK.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyQtFiles()

bool copyQtFiles ( Options options)

Definition at line 2501 of file main.cpp.

References Options::build, Options::Bundled, Options::bundledFiles, copyFileIfNewer(), Options::currentArchitecture, Options::deploymentMechanism, QString::endsWith(), QFile::exists(), QDir::fromNativeSeparators(), goodToCopy(), isDeployment(), QString::mid(), Options::outputDirectory, qMakePair(), qPrintable, Options::qtDependencies, QHash< Key, T >::size(), QString::startsWith(), Options::Unbundled, and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyStdCpp()

bool copyStdCpp ( Options options)

Definition at line 2954 of file main.cpp.

References Options::architectures, QString::arg(), copyFileIfNewer(), Options::currentArchitecture, QFile::exists(), isDeployment(), Options::outputDirectory, qPrintable, Options::stdCppName, Options::stdCppPath, Options::Unbundled, and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createRcc()

bool createRcc ( const Options options)

Definition at line 2319 of file main.cpp.

References QDir::currentPath(), execSuffixAppended(), QDir::exists(), QFile::exists(), QString::isEmpty(), Options::isZstdCompressionEnabled, Options::noRccBundleCleanup, Options::outputDirectory, qPrintable, Options::qtLibExecsDirectory, Options::rccBinaryPath, QFile::remove(), QDir::removeRecursively(), QFile::rename(), runCommand(), QDir::setCurrent(), shellQuote(), and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defaultLibexecDir()

QString defaultLibexecDir ( )

Definition at line 281 of file main.cpp.

Referenced by readInputFileDirectory().

+ Here is the caller graph for this function:

◆ deleteMissingFiles()

void deleteMissingFiles ( const Options options,
const QDir srcDir,
const QDir dstDir 
)

Definition at line 337 of file main.cpp.

References QDir::absolutePath(), deleteMissingFiles(), QDir::Dirs, QDir::entryInfoList(), QDir::Files, QDir::NoDotAndDotDot, qPrintable, QFile::remove(), and Options::verbose.

Referenced by cleanTopFolders(), and deleteMissingFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detectLatestAndroidPlatform()

QString detectLatestAndroidPlatform ( const QString sdkPath)

Definition at line 795 of file main.cpp.

References QFileInfo::baseName(), QList< T >::begin(), dir, QDir::Dirs, QList< T >::end(), QList< T >::first(), QList< T >::isEmpty(), QDir::NoDotAndDotDot, qPrintable, and quasiLexicographicalReverseLessThan().

Referenced by readInputFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ execSuffixAppended()

static QString execSuffixAppended ( QString  path)
static

Definition at line 265 of file main.cpp.

Referenced by createRcc(), llvmReadobjPath(), runAdb(), scanImports(), signAAB(), and zipalignPath().

+ Here is the caller graph for this function:

◆ fileArchitecture()

QString fileArchitecture ( const Options options,
const QString path 
)

Definition at line 298 of file main.cpp.

References architectureFromName(), QString::arg(), QHash< Key, T >::constEnd(), elfArchitectures, QFile::exists(), QHash< Key, T >::find(), QString::fromLatin1(), QByteArray::fromRawData(), it, line, llvmReadobjPath(), QString::mid(), openProcess(), qPrintable, qstrlen(), shellQuote(), QString::startsWith(), and QString::trimmed().

Referenced by checkArchitecture(), and readInputFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findFilesRecursively() [1/2]

QList< QtDependency > findFilesRecursively ( const Options options,
const QFileInfo info,
const QString rootPath 
)

Definition at line 1827 of file main.cpp.

References QFileInfo::absoluteFilePath(), dir, QDir::Dirs, QFileInfo::exists(), QFileInfo::filePath(), QDir::Files, findFilesRecursively(), info, QFileInfo::isDir(), QString::mid(), QDir::NoDotAndDotDot, ret, and QString::size().

Referenced by findFilesRecursively(), findFilesRecursively(), and readAndroidDependencyXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findFilesRecursively() [2/2]

QList< QtDependency > findFilesRecursively ( const Options options,
const QString fileName 
)

Definition at line 1850 of file main.cpp.

References QFileInfo::absolutePath(), QFileInfo::exists(), Options::extraPrefixDirs, fileName, findFilesRecursively(), info, and Options::qtInstallDirectory.

+ Here is the call graph for this function:

◆ findInPath()

QString findInPath ( const QString fileName)

Definition at line 2597 of file main.cpp.

References QFileInfo::exists(), fileName, QString::fromLocal8Bit(), QFileInfo::isExecutable(), QFileInfo::isFile(), and qgetenv().

Referenced by deploy(), findMinGWRuntimePaths(), and signAAB().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLibraryProjectsInOutputFolder()

QStringList getLibraryProjectsInOutputFolder ( const Options options)

Definition at line 2569 of file main.cpp.

References QFileDevice::atEnd(), QFileInfo::canonicalFilePath(), QFileInfo::exists(), file, QString::fromLocal8Bit(), QString::indexOf(), info, QFileInfo::isDir(), QDir::isRelativePath(), line, QString::mid(), QFile::open(), Options::outputDirectory, QIODevice::readLine(), QIODeviceBase::ReadOnly, ret, and QString::startsWith().

+ Here is the call graph for this function:

◆ getQtLibsFromElf()

QStringList getQtLibsFromElf ( const Options options,
const QString fileName 
)

Definition at line 1968 of file main.cpp.

References absoluteFilePath(), QString::arg(), QHash< Key, T >::constEnd(), Options::currentArchitecture, elfArchitectures, QFile::exists(), fileName, QHash< Key, T >::find(), QString::fromLatin1(), QByteArray::fromRawData(), it, line, llvmReadobjPath(), QString::mid(), openProcess(), qPrintable, qstrlen(), ret, shellQuote(), QString::startsWith(), QString::toLatin1(), QString::trimmed(), and Options::verbose.

Referenced by goodToCopy(), and readDependenciesFromElf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ goodToCopy()

bool goodToCopy ( const Options options,
const QString file,
QStringList unmetDependencies 
)

Definition at line 2481 of file main.cpp.

References absoluteFilePath(), checkArchitecture(), QHash< Key, T >::contains(), Options::currentArchitecture, file, getQtLibsFromElf(), Options::qtDependencies, and ret.

Referenced by copyQtFiles(), and readDependencies().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gradleBuildFlags()

GradleFlags gradleBuildFlags ( const QString path)

Definition at line 2701 of file main.cpp.

References QString::contains(), file, line, QFile::open(), QIODevice::readAll(), QIODeviceBase::ReadOnly, QByteArray::split(), QByteArrayView::startsWith(), and QString::trimmed().

Referenced by buildAndroidProject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ installApk()

bool installApk ( const Options options)

Definition at line 2912 of file main.cpp.

References QString::isEmpty(), Options::keyStore, mustReadOutputAnyway, packagePath(), runAdb(), SignedAPK, Options::uninstallApk, uninstallApk(), UnsignedAPK, and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isDeployment()

bool isDeployment ( const Options options,
Options::DeploymentMechanism  deployment 
)

Definition at line 1283 of file main.cpp.

References Options::deploymentMechanism.

Referenced by copyAndroidExtraLibs(), copyAndroidExtraResources(), copyQtFiles(), copyStdCpp(), and updateLibsXml().

+ Here is the caller graph for this function:

◆ llvmReadobjPath()

static QString llvmReadobjPath ( const Options options)
static

Definition at line 290 of file main.cpp.

References arg, execSuffixAppended(), Options::ndkHost, Options::ndkPath, and Options::toolchainPrefix.

Referenced by fileArchitecture(), and getQtLibsFromElf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

[2]

[3]

[2]

[0]

[0] [1]

[1]

[0]

[0]

[1]

[1] [2]

[2]

[0]

[0]

[2]

[2]

[22]

[22]

[3]

[3]

[4]

[4]

[10]

[10]

[qcinfo_stream]

[qcinfo_stream]

[11]

[11]

[12]

[12]

[13]

[13]

[qcinfo_printf]

[qcinfo_printf]

[14]

[14]

[15]

[15]

[16]

[16]

[17]

[17]

[0]

[0]

[1]

[1]

[2]

[2]

[Window class using revision]

[Window class using revision]

[0]

[0]

[0]

[0]

[1]

[1]

[2]

[2]

[0]

[0]

[write output] [start stream]

[start stream]

[write element]

[write element]

[finish stream]

[finish stream] [write output]

[1]

[1]

[0]

[0]

[0]

[0] //! [1]

[1]

[0]

[0] //! [1]

[1]

[0]

[0] //! [1]

[1] //! [2]

[2]

[0]

[0]

[1]

[1]

[Adding a resource]

[Adding a resource]

[Inserting an image with a cursor]

[Inserting an image with a cursor]

[Inserting an image using HTML]

[Inserting an image using HTML]

[0]

[0] //! [1]

[1]

Definition at line 3247 of file main.cpp.

References Options::androidPlatform, Options::apkPath, Options::applicationBinary, Options::architectures, arg, Options::auxMode, Options::build, buildAndroidProject(), CannotBuildAndroidProject, CannotCopyAndroidExtraLibs, CannotCopyAndroidExtraResources, CannotCopyAndroidSources, CannotCopyAndroidTemplate, CannotCopyApk, CannotCopyGnuStl, CannotCopyQtFiles, CannotCreateRcc, CannotFindApplicationBinary, CannotInstallApk, CannotReadDependencies, CannotReadInputFile, CannotSignPackage, CannotUpdateAndroidFiles, cleanAndroidFiles(), QHash< Key, T >::constBegin(), QHash< Key, T >::constEnd(), containsApplicationBinary(), copyAndroidExtraLibs(), copyAndroidExtraResources(), copyAndroidSources(), copyAndroidTemplate(), Options::copyDependenciesOnly, copyPackage(), copyQtFiles(), copyStdCpp(), createRcc(), Options::currentArchitecture, Options::depFilePath, Options::deploymentMechanism, QElapsedTimer::elapsed(), Options::helpRequested, Options::inputFileName, Options::installApk, installApk(), Options::installLocation, QString::isEmpty(), it, Options::keyStore, QElapsedTimer::nsecsElapsed(), Options::outputDirectory, packagePath(), parseOptions(), printHelp(), Q_UNLIKELY, qPrintable, readDependencies(), readInputFile(), QFile::remove(), Options::setCurrentQtArchitecture(), SignedAPK, signPackage(), QElapsedTimer::start(), SyntaxErrorOrHelpRequested, Options::timer, Options::timing, Options::Unbundled, UnsignedAPK, updateAndroidFiles(), and writeDependencyFile().

+ Here is the call graph for this function:

◆ mergeGradleProperties()

static bool mergeGradleProperties ( const QString path,
GradleProperties  properties 
)
static

Definition at line 2638 of file main.cpp.

References QList< T >::at(), QFileDevice::atEnd(), QFileDevice::close(), file, QFile::fileName(), it, line, QFile::open(), properties, qPrintable, QIODevice::readLine(), QIODeviceBase::ReadOnly, QFile::remove(), QFile::rename(), QList< T >::size(), QString::split(), QIODeviceBase::Text, QString::trimmed(), QIODeviceBase::Truncate, QIODevice::write(), and QIODeviceBase::WriteOnly.

Referenced by buildAndroidProject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openProcess()

FILE * openProcess ( const QString command)

Definition at line 47 of file main.cpp.

References QByteArray::constData(), QT_POPEN_READ, and QString::toLocal8Bit().

Referenced by buildAndroidProject(), fileArchitecture(), getQtLibsFromElf(), runAdb(), runCommand(), signAAB(), and signPackage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ packageNameFromAndroidManifest()

QString packageNameFromAndroidManifest ( const QString androidManifestPath)

Definition at line 815 of file main.cpp.

References cleanPackageName(), QFile::open(), and QIODeviceBase::ReadOnly.

Referenced by readInputFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ packagePath()

QString packagePath ( const Options options,
PackageType  pt 
)

Definition at line 2881 of file main.cpp.

References QString::chop(), QDir::dirName(), QDir::exists(), Options::outputDirectory, QStringLiteral, Options::releasePackage, SignedAPK, and UnsignedAPK.

Referenced by copyPackage(), installApk(), main(), signAAB(), and signPackage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseCmakeBoolean()

bool parseCmakeBoolean ( const QJsonValue value)

Definition at line 829 of file main.cpp.

References Qt::CaseInsensitive, QString::compare(), QString::fromUtf8(), and QString::toInt().

Referenced by readInputFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseOptions()

Options parseOptions ( )

Definition at line 367 of file main.cpp.

References Options::androidPlatform, Options::apkPath, QString::arg(), argument, QCoreApplication::arguments(), arguments, QList< T >::at(), Options::auxMode, Options::build, Options::buildAAB, Options::buildDirectory, Options::Bundled, QFileInfo::canonicalFilePath(), Qt::CaseInsensitive, QString::clear(), QString::compare(), Options::copyDependenciesOnly, QDir::current(), Options::depFilePath, Options::deploymentMechanism, Options::digestAlg, QString::endsWith(), Options::helpRequested, i, Options::inputFileName, Options::installApk, Options::installLocation, Options::internalSf, QString::isEmpty(), Options::jdkPath, Options::keyPass, Options::keyStore, Options::keyStoreAlias, Options::keyStorePassword, Options::noRccBundleCleanup, Options::outputDirectory, Options::protectedAuthenticationPath, qEnvironmentVariable(), qEnvironmentVariableIsSet(), Options::qmlImportScannerBinaryPath, qPrintable, Options::releasePackage, Options::sectionsOnly, Options::sigAlg, Options::sigFile, QList< T >::size(), Options::storeType, Options::timing, Options::tsaCert, Options::tsaUrl, Options::Unbundled, Options::uninstallApk, and Options::verbose.

Referenced by QQnxIntegration::QQnxIntegration(), main(), and QWindowsIntegrationPrivate::parseOptions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printHelp()

void printHelp ( )

Definition at line 560 of file main.cpp.

Referenced by main().

+ Here is the caller graph for this function:

◆ quasiLexicographicalReverseLessThan()

bool quasiLexicographicalReverseLessThan ( const QFileInfo fi1,
const QFileInfo fi2 
)

Definition at line 673 of file main.cpp.

References QFileInfo::baseName(), and s2.

Referenced by detectLatestAndroidPlatform().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readAndroidDependencyXml()

bool readAndroidDependencyXml ( Options options,
const QString moduleName,
QSet< QString > *  usedDependencies,
QSet< QString > *  remainingDependencies 
)

Definition at line 1862 of file main.cpp.

References absoluteFilePath(), QtDependency::absolutePath, checkArchitecture(), QDir::cleanPath(), QSet< T >::contains(), Options::currentArchitecture, QImageReader::errorString(), QFile::exists(), Options::features, file, fileName, fileNames, findFilesRecursively(), i, Options::initClasses, QSet< T >::insert(), Options::localLibs, QFile::open(), Options::permissions, qPrintable, Options::qtDependencies, readDependenciesFromElf(), QIODeviceBase::ReadOnly, QHash< Key, T >::size(), and Options::verbose.

Referenced by readDependenciesFromElf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDependencies()

bool readDependencies ( Options options)

Definition at line 2372 of file main.cpp.

References absoluteFilePath(), Options::applicationBinary, QHash< Key, T >::begin(), QSet< T >::begin(), Options::currentArchitecture, QHash< Key, T >::end(), QSet< T >::erase(), QHash< Key, T >::erase(), fileName, goodToCopy(), QSet< T >::isEmpty(), QHash< Key, T >::isEmpty(), it, Options::localLibs, ok, Options::outputDirectory, Options::qmlSkipImportScanning, qPrintable, Options::qrcFiles, Options::qtDependencies, readDependenciesFromElf(), Options::rootPaths, scanImports(), and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDependenciesFromElf()

bool readDependenciesFromElf ( Options options,
const QString fileName,
QSet< QString > *  usedDependencies,
QSet< QString > *  remainingDependencies 
)

Definition at line 2017 of file main.cpp.

References absoluteFilePath(), QList< T >::append(), QSet< T >::contains(), Options::currentArchitecture, fileName, getQtLibsFromElf(), QSet< T >::insert(), QString::left(), QString::mid(), qPrintable, Options::qtDependencies, readAndroidDependencyXml(), readDependenciesFromElf(), QString::size(), and Options::verbose.

Referenced by readAndroidDependencyXml(), readDependencies(), readDependenciesFromElf(), and scanImports().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readGradleProperties()

static GradleProperties readGradleProperties ( const QString path)
static

Definition at line 2618 of file main.cpp.

References QFileDevice::close(), file, QString::indexOf(), QString::left(), line, QString::mid(), QFile::open(), properties, QIODevice::readAll(), QIODeviceBase::ReadOnly, QByteArray::split(), QString::startsWith(), and QString::trimmed().

Referenced by buildAndroidProject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readInputFile()

bool readInputFile ( Options options)

Definition at line 899 of file main.cpp.

References QFileInfo::absolutePath(), absolutePath(), Options::androidPlatform, Options::androidSourceDirectory, Options::applicationArguments, Options::applicationBinary, Options::architectures, QString::arg(), Options::build, Options::Bundled, cleanPackageName(), QJsonObject::constBegin(), QHash< Key, T >::constBegin(), QJsonObject::constEnd(), QHash< Key, T >::constEnd(), QSet< T >::constEnd(), QHash< Key, T >::contains(), dependenciesForDepfile, Options::deploymentMechanism, detectLatestAndroidPlatform(), directory, QStringView::endsWith(), QDir::exists(), QFile::exists(), Options::extraLibraryDirs, Options::extraLibs, Options::extraPlugins, Options::extraPrefixDirs, file, fileArchitecture(), QJsonDocument::fromJson(), QChar::fromLatin1(), QDir::fromNativeSeparators(), QSettings::IniFormat, Options::inputFileName, QHash< Key, T >::insert(), QJsonValue::isArray(), QJsonValue::isBool(), QJsonObject::isEmpty(), QString::isEmpty(), QJsonDocument::isNull(), QJsonValue::isObject(), QJsonValue::isString(), QJsonValue::isUndefined(), Options::isZstdCompressionEnabled, it, QHash< Key, T >::keys(), Options::minSdkVersion, Options::ndkHost, Options::ndkPath, Options::ndkVersion, QJsonDocument::object(), QFile::open(), Options::outputDirectory, Options::packageName, packageNameFromAndroidManifest(), parseCmakeBoolean(), Options::qmlImportPaths, Options::qmlImportScannerBinaryPath, Options::qmlSkipImportScanning, qPrintable, Options::qrcFiles, QStringLiteral, Options::qtDependencies, Options::qtHostDirectory, Options::qtInstallDirectory, Options::rccBinaryPath, QIODevice::readAll(), readInputFileDirectory(), QIODeviceBase::ReadOnly, Options::rootPaths, Options::sdkBuildToolsVersion, Options::sdkPath, settings, QString::size(), Qt::SkipEmptyParts, QString::split(), Options::stdCppPath, QDirIterator::Subdirectories, subPath(), Options::systemLibsPath, Options::targetSdkVersion, QJsonValue::toArray(), QJsonValue::toBool(), QJsonValue::toObject(), Options::toolchainPrefix, QVariant::toString(), QJsonValue::toString(), QStringView::toString(), QString::toUtf8(), Options::Unbundled, QJsonObject::value(), QSettings::value(), Options::verbose, Options::versionCode, and Options::versionName.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readInputFileDirectory()

bool readInputFileDirectory ( Options options,
QJsonObject jsonObject,
const QString  keyName 
)

Definition at line 839 of file main.cpp.

References Options::architectures, QHash< Key, T >::constBegin(), QHash< Key, T >::constEnd(), QSet< T >::constEnd(), QHash< Key, T >::contains(), defaultLibexecDir(), directory, Options::inputFileName, QJsonValue::isObject(), QJsonValue::isString(), QJsonValue::isUndefined(), it, keyName(), QHash< Key, T >::keys(), qPrintable, QJsonValue::toObject(), QJsonValue::toString(), and QJsonObject::value().

Referenced by readInputFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ runAdb()

FILE * runAdb ( const Options options,
const QString arguments 
)

Definition at line 2456 of file main.cpp.

References QString::arg(), arguments, QByteArray::constData(), execSuffixAppended(), QFile::exists(), Options::installLocation, QString::isEmpty(), openProcess(), qPrintable, Options::sdkPath, shellQuote(), QString::toLocal8Bit(), and Options::verbose.

Referenced by installApk(), and uninstallApk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ runCommand()

bool runCommand ( const Options options,
const QString command 
)

Definition at line 2298 of file main.cpp.

References openProcess(), qPrintable, runCommand(), and Options::verbose.

Referenced by createRcc(), and runCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scanImports()

◆ signAAB()

bool signAAB ( const Options options)

Definition at line 2993 of file main.cpp.

References AAB, QString::arg(), Options::buildAAB, Options::digestAlg, execSuffixAppended(), QFile::exists(), file, findInPath(), QString::fromLocal8Bit(), Options::internalSf, QString::isEmpty(), Options::jdkPath, Options::keyPass, Options::keyStore, Options::keyStoreAlias, Options::keyStorePassword, openProcess(), packagePath(), Options::protectedAuthenticationPath, qgetenv(), qPrintable, Options::sectionsOnly, shellQuote(), Options::sigAlg, Options::sigFile, Options::signedJar, Options::storeType, Options::tsaCert, Options::tsaUrl, and Options::verbose.

Referenced by signPackage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ signPackage()

bool signPackage ( const Options options)

Definition at line 3080 of file main.cpp.

References QString::arg(), batSuffixAppended(), Options::buildAAB, QFile::copy(), QFile::exists(), QString::isEmpty(), Options::keyPass, Options::keyStore, Options::keyStoreAlias, Options::keyStorePassword, ok, openProcess(), packagePath(), QFile::remove(), Options::sdkBuildToolsVersion, Options::sdkPath, shellQuote(), signAAB(), SignedAPK, UnsignedAPK, Options::verbose, and zipalignPath().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uninstallApk()

bool uninstallApk ( const Options options)

Definition at line 2847 of file main.cpp.

References mustReadOutputAnyway, Options::packageName, qPrintable, runAdb(), shellQuote(), and Options::verbose.

Referenced by installApk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateAndroidFiles()

bool updateAndroidFiles ( Options options)

Definition at line 1777 of file main.cpp.

References updateAndroidManifest(), updateLibsXml(), and Options::verbose.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateAndroidManifest()

bool updateAndroidManifest ( Options options)

Definition at line 1689 of file main.cpp.

References Options::applicationArguments, Options::applicationBinary, QString::arg(), QImageReader::errorString(), QFile::exists(), Options::features, QFile::open(), Options::outputDirectory, Options::packageName, Options::permissions, qPrintable, QStringLiteral, QIODeviceBase::ReadOnly, QString::trimmed(), updateFile(), updateStringsXml(), Options::usesOpenGL, Options::verbose, Options::versionCode, and Options::versionName.

Referenced by updateAndroidFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFile()

bool updateFile ( const QString fileName,
const QHash< QString, QString > &  replacements 
)

Definition at line 1503 of file main.cpp.

References QFileDevice::close(), QHash< Key, T >::constBegin(), QHash< Key, T >::constEnd(), contents, fileName, forever, it, QFile::open(), qPrintable, QIODevice::readAll(), QIODeviceBase::ReadOnly, QSet< T >::size(), QIODevice::write(), and QIODeviceBase::WriteOnly.

Referenced by FileInfoThread::FileInfoThread(), deploy(), deployWebEngineCore(), deployWebProcess(), updateAndroidManifest(), updateLibrary(), updateLibsXml(), and updateStringsXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLibsXml()

bool updateLibsXml ( Options options)

Definition at line 1547 of file main.cpp.

References Options::archExtraLibs, Options::architectures, QString::arg(), QString::asprintf(), Options::bundledFiles, QString::chop(), QHash< Key, T >::constBegin(), QHash< Key, T >::constEnd(), QString::endsWith(), QFile::exists(), QFileInfo::fileName(), fileName, Options::initClasses, isDeployment(), QHash< Key, T >::isEmpty(), it, Options::localLibs, QString::mid(), Options::outputDirectory, qPrintable, QStringLiteral, Options::qtDependencies, QString::startsWith(), Options::stdCppName, Options::systemLibsPath, QString::trimmed(), Options::Unbundled, updateFile(), Options::usesOpenGL, and Options::verbose.

Referenced by updateAndroidFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateStringsXml()

bool updateStringsXml ( const Options options)

Definition at line 1660 of file main.cpp.

References append(), Options::applicationBinary, QFile::exists(), file, fileName, QFile::open(), Options::outputDirectory, qPrintable, QStringLiteral, QString::toLatin1(), updateFile(), Options::verbose, QIODevice::write(), and QIODeviceBase::WriteOnly.

Referenced by updateAndroidManifest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeDependencyFile()

bool writeDependencyFile ( const Options options)

Definition at line 3217 of file main.cpp.

References QFileInfo::absolutePath(), Options::apkPath, Options::buildDirectory, Options::copyDependenciesOnly, dependenciesForDepfile, Options::depFilePath, escapeAndEncodeDependencyPath(), file, QFile::open(), QDir::relativeFilePath(), Options::verbose, QIODevice::write(), and QIODeviceBase::WriteOnly.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ zipalignPath()

static QString zipalignPath ( const Options options,
bool *  ok 
)
static

Definition at line 2977 of file main.cpp.

References execSuffixAppended(), QFile::exists(), ok, qPrintable, Options::sdkBuildToolsVersion, and Options::sdkPath.

Referenced by signPackage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ dependenciesForDepfile

QStringList dependenciesForDepfile
static

Definition at line 45 of file main.cpp.

Referenced by copyFileIfNewer(), readInputFile(), and writeDependencyFile().

◆ elfArchitectures

const QHash<QByteArray, QByteArray> elfArchitectures
static
Initial value:
= {
{"aarch64", "arm64-v8a"},
{"arm", "armeabi-v7a"},
{"i386", "x86"},
{"x86_64", "x86_64"}
}

Definition at line 243 of file main.cpp.

Referenced by fileArchitecture(), and getQtLibsFromElf().

◆ mustReadOutputAnyway

const bool mustReadOutputAnyway = true
static

Definition at line 43 of file main.cpp.

Referenced by installApk(), and uninstallApk().