Android: Make a couple of AndroidConfig's functions static

They do not access non-static members. This way, the functions can be
called (e.g. by auto tests) without having an AndroidConfig instance.

Change-Id: I2551bddc2f4745ee7486b490f1abf935204c7763
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2022-01-25 07:59:21 +01:00
parent a86979ddce
commit 14eb2ce0a5
2 changed files with 15 additions and 14 deletions

View File

@@ -514,7 +514,7 @@ FilePath AndroidConfig::avdManagerToolPath() const
return FilePath(); return FilePath();
} }
FilePath AndroidConfig::toolchainPathFromNdk(const FilePath &ndkLocation) const FilePath AndroidConfig::toolchainPathFromNdk(const FilePath &ndkLocation)
{ {
const FilePath tcPath = ndkLocation / "toolchains/"; const FilePath tcPath = ndkLocation / "toolchains/";
FilePath toolchainPath; FilePath toolchainPath;
@@ -553,7 +553,7 @@ FilePath AndroidConfig::toolchainPath(const QtVersion *qtVersion) const
return toolchainPathFromNdk(ndkLocation(qtVersion)); return toolchainPathFromNdk(ndkLocation(qtVersion));
} }
FilePath AndroidConfig::clangPathFromNdk(const FilePath &ndkLocation) const FilePath AndroidConfig::clangPathFromNdk(const FilePath &ndkLocation)
{ {
const FilePath path = toolchainPathFromNdk(ndkLocation); const FilePath path = toolchainPathFromNdk(ndkLocation);
if (path.isEmpty()) if (path.isEmpty())
@@ -566,7 +566,7 @@ FilePath AndroidConfig::gdbPath(const Abi &abi, const QtVersion *qtVersion) cons
return gdbPathFromNdk(abi, ndkLocation(qtVersion)); return gdbPathFromNdk(abi, ndkLocation(qtVersion));
} }
FilePath AndroidConfig::gdbPathFromNdk(const Abi &abi, const FilePath &ndkLocation) const FilePath AndroidConfig::gdbPathFromNdk(const Abi &abi, const FilePath &ndkLocation)
{ {
const FilePath path = ndkLocation.pathAppended( const FilePath path = ndkLocation.pathAppended(
QString("prebuilt/%1/bin/gdb%2").arg(toolchainHostFromNdk(ndkLocation), QString("prebuilt/%1/bin/gdb%2").arg(toolchainHostFromNdk(ndkLocation),
@@ -581,7 +581,7 @@ FilePath AndroidConfig::gdbPathFromNdk(const Abi &abi, const FilePath &ndkLocati
QString(QTC_HOST_EXE_SUFFIX))); QString(QTC_HOST_EXE_SUFFIX)));
} }
FilePath AndroidConfig::lldbPathFromNdk(const FilePath &ndkLocation) const FilePath AndroidConfig::lldbPathFromNdk(const FilePath &ndkLocation)
{ {
const FilePath path = ndkLocation.pathAppended( const FilePath path = ndkLocation.pathAppended(
QString("toolchains/llvm/prebuilt/%1/bin/lldb%2").arg(toolchainHostFromNdk(ndkLocation), QString("toolchains/llvm/prebuilt/%1/bin/lldb%2").arg(toolchainHostFromNdk(ndkLocation),
@@ -591,7 +591,7 @@ FilePath AndroidConfig::lldbPathFromNdk(const FilePath &ndkLocation) const
return {}; return {};
} }
FilePath AndroidConfig::makePathFromNdk(const FilePath &ndkLocation) const FilePath AndroidConfig::makePathFromNdk(const FilePath &ndkLocation)
{ {
return ndkLocation.pathAppended( return ndkLocation.pathAppended(
QString("prebuilt/%1/bin/make%2").arg(toolchainHostFromNdk(ndkLocation), QString("prebuilt/%1/bin/make%2").arg(toolchainHostFromNdk(ndkLocation),
@@ -956,7 +956,7 @@ QVersionNumber AndroidConfig::ndkVersion(const QtVersion *qtVersion) const
return ndkVersion(ndkLocation(qtVersion)); return ndkVersion(ndkLocation(qtVersion));
} }
QVersionNumber AndroidConfig::ndkVersion(const FilePath &ndkPath) const QVersionNumber AndroidConfig::ndkVersion(const FilePath &ndkPath)
{ {
QVersionNumber version; QVersionNumber version;
if (!ndkPath.exists()) { if (!ndkPath.exists()) {
@@ -1086,7 +1086,7 @@ QString AndroidConfig::toolchainHost(const QtVersion *qtVersion) const
return toolchainHostFromNdk(ndkLocation(qtVersion)); return toolchainHostFromNdk(ndkLocation(qtVersion));
} }
QString AndroidConfig::toolchainHostFromNdk(const FilePath &ndkPath) const QString AndroidConfig::toolchainHostFromNdk(const FilePath &ndkPath)
{ {
// detect toolchain host // detect toolchain host
QString toolchainHost; QString toolchainHost;

View File

@@ -102,7 +102,7 @@ public:
Utils::FilePath ndkLocation(const QtSupport::QtVersion *qtVersion) const; Utils::FilePath ndkLocation(const QtSupport::QtVersion *qtVersion) const;
QVersionNumber ndkVersion(const QtSupport::QtVersion *qtVersion) const; QVersionNumber ndkVersion(const QtSupport::QtVersion *qtVersion) const;
QVersionNumber ndkVersion(const Utils::FilePath &ndkPath) const; static QVersionNumber ndkVersion(const Utils::FilePath &ndkPath);
QUrl sdkToolsUrl() const { return m_sdkToolsUrl; } QUrl sdkToolsUrl() const { return m_sdkToolsUrl; }
QByteArray getSdkToolsSha256() const { return m_sdkToolsSha256; } QByteArray getSdkToolsSha256() const { return m_sdkToolsSha256; }
@@ -120,7 +120,7 @@ public:
Utils::FilePath keystoreLocation() const; Utils::FilePath keystoreLocation() const;
QString toolchainHost(const QtSupport::QtVersion *qtVersion) const; QString toolchainHost(const QtSupport::QtVersion *qtVersion) const;
QString toolchainHostFromNdk(const Utils::FilePath &ndkPath) const; static QString toolchainHostFromNdk(const Utils::FilePath &ndkPath);
QStringList emulatorArgs() const; QStringList emulatorArgs() const;
void setEmulatorArgs(const QStringList &args); void setEmulatorArgs(const QStringList &args);
@@ -135,13 +135,14 @@ public:
Utils::FilePath avdManagerToolPath() const; Utils::FilePath avdManagerToolPath() const;
Utils::FilePath toolchainPath(const QtSupport::QtVersion *qtVersion) const; Utils::FilePath toolchainPath(const QtSupport::QtVersion *qtVersion) const;
Utils::FilePath toolchainPathFromNdk(const Utils::FilePath &ndkLocation) const; static Utils::FilePath toolchainPathFromNdk(const Utils::FilePath &ndkLocation);
Utils::FilePath clangPathFromNdk(const Utils::FilePath &ndkLocation) const; static Utils::FilePath clangPathFromNdk(const Utils::FilePath &ndkLocation);
Utils::FilePath gdbPath(const ProjectExplorer::Abi &abi, const QtSupport::QtVersion *qtVersion) const; Utils::FilePath gdbPath(const ProjectExplorer::Abi &abi, const QtSupport::QtVersion *qtVersion) const;
Utils::FilePath gdbPathFromNdk(const ProjectExplorer::Abi &abi, const Utils::FilePath &ndkLocation) const; static Utils::FilePath gdbPathFromNdk(const ProjectExplorer::Abi &abi,
Utils::FilePath lldbPathFromNdk(const Utils::FilePath &ndkLocation) const; const Utils::FilePath &ndkLocation);
Utils::FilePath makePathFromNdk(const Utils::FilePath &ndkLocation) const; static Utils::FilePath lldbPathFromNdk(const Utils::FilePath &ndkLocation);
static Utils::FilePath makePathFromNdk(const Utils::FilePath &ndkLocation);
Utils::FilePath keytoolPath() const; Utils::FilePath keytoolPath() const;