Android: keep up with sdk tools changing folder structure

The cmdline-tools package used to have the folder structure "tools/bin".
However, latest packages are using the structure "cmdline-tools/bin".
And since subsequent updates we are installing "cmdline-tools;latest"
package, it will be put in "cmdline-tools/latest" folder, so we cannot
extract to that path, or otherwise sdkmanager will complain that the
path is in use.

Currently we extract it and put it under the SDK path, then use it to
install the essential packages, then it won't be used at all. This patch
changes that by extracting the downloaded package into a temporary
location, and use sdkmanager from there directly.

Also, this patch updates the links to the cmdline-tools along the way.

Fixes: QTCREATORBUG-27174
Change-Id: I1f5d0e38f5a026631e8a3852821d85a69d543c32
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Assam Boudjelthia
2020-11-28 15:44:37 +02:00
parent 188544052c
commit 5454dda249
9 changed files with 116 additions and 56 deletions

View File

@@ -96,6 +96,7 @@ public:
Utils::FilePath sdkLocation() const;
void setSdkLocation(const Utils::FilePath &sdkLocation);
QVersionNumber sdkToolsVersion() const;
Utils::FilePath sdkToolsVersionPath() const;
QVersionNumber buildToolsVersion() const;
QStringList sdkManagerToolArgs() const;
void setSdkManagerToolArgs(const QStringList &args);
@@ -134,6 +135,8 @@ public:
Utils::FilePath sdkManagerToolPath() const;
Utils::FilePath avdManagerToolPath() const;
void setTemporarySdkToolsPath(const Utils::FilePath &path);
Utils::FilePath toolchainPath(const QtSupport::QtVersion *qtVersion) const;
static Utils::FilePath toolchainPathFromNdk(const Utils::FilePath &ndkLocation,
Utils::OsType hostOs = Utils::HostOsInfo::hostOs());
@@ -158,7 +161,7 @@ public:
QString getProductModel(const QString &device) const;
bool isConnected(const QString &serialNumber) const;
bool isCmdlineSdkToolsInstalled() const;
bool preCmdlineSdkToolsInstalled() const;
bool sdkFullyConfigured() const { return m_sdkFullyConfigured; }
void setSdkFullyConfigured(bool allEssentialsInstalled) { m_sdkFullyConfigured = allEssentialsInstalled; }
@@ -188,6 +191,7 @@ private:
QList<int> availableNdkPlatforms(const QtSupport::QtVersion *qtVersion) const;
Utils::FilePath m_sdkLocation;
Utils::FilePath m_temporarySdkToolsPath;
QStringList m_sdkManagerToolArgs;
Utils::FilePath m_openJDKLocation;
Utils::FilePath m_keystoreLocation;