forked from qt-creator/qt-creator
Android: Remove support old cmdline tools
Link: https://developer.android.com/studio/releases/sdk-tools Change-Id: I9ea7c83af604bfc4b5d5e81b037034b7e148e99a Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -487,20 +487,7 @@ bool AndroidBuildApkStep::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
const QVersionNumber sdkToolsVersion = AndroidConfigurations::currentConfig().sdkToolsVersion();
|
||||
if (sdkToolsVersion >= QVersionNumber(25, 3, 0)
|
||||
&& AndroidConfigurations::currentConfig().preCmdlineSdkToolsInstalled()) {
|
||||
if (!version->sourcePath().pathAppended("src/3rdparty/gradle").exists()) {
|
||||
const QString error
|
||||
= Tr::tr("The installed SDK tools version (%1) does not include Gradle "
|
||||
"scripts. The minimum Qt version required for Gradle build to work "
|
||||
"is %2")
|
||||
.arg(sdkToolsVersion.toString())
|
||||
.arg("5.9.0/5.6.3");
|
||||
reportWarningOrError(error, Task::Error);
|
||||
return false;
|
||||
}
|
||||
} else if (version->qtVersion() < QVersionNumber(5, 4, 0)) {
|
||||
if (version->qtVersion() < QVersionNumber(5, 4, 0)) {
|
||||
const QString error = Tr::tr("The minimum Qt version required for Gradle build to work is %1. "
|
||||
"It is recommended to install the latest Qt version.")
|
||||
.arg("5.4.0");
|
||||
|
||||
@@ -451,21 +451,9 @@ QString AndroidConfig::apiLevelNameFor(const SdkPlatform *platform)
|
||||
QString("android-%1").arg(platform->apiLevel()) : "";
|
||||
}
|
||||
|
||||
// This is checking for the SDK tools [*] that were deprecated in favor of
|
||||
// the command-line tools.
|
||||
// See https://developer.android.com/studio/releases/sdk-tools
|
||||
bool AndroidConfig::preCmdlineSdkToolsInstalled() const
|
||||
{
|
||||
QString toolPath("tools/bin/sdkmanager");
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
toolPath += ANDROID_BAT_SUFFIX;
|
||||
|
||||
return m_sdkLocation.pathAppended(toolPath).exists();
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::adbToolPath() const
|
||||
{
|
||||
return m_sdkLocation / "platform-tools/adb" QTC_HOST_EXE_SUFFIX;
|
||||
return m_sdkLocation.pathAppended("platform-tools/adb").withExecutableSuffix();
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::emulatorToolPath() const
|
||||
@@ -475,52 +463,31 @@ FilePath AndroidConfig::emulatorToolPath() const
|
||||
if (emulatorFile.exists())
|
||||
return emulatorFile;
|
||||
|
||||
return m_sdkLocation.pathAppended("tools/emulator").withExecutableSuffix();
|
||||
return FilePath();
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::sdkManagerToolPath() const
|
||||
{
|
||||
const QStringList sdkmanagerPaths = {
|
||||
QString(Constants::cmdlineToolsName).append("/latest/bin/sdkmanager"),
|
||||
"tools/bin/sdkmanager"};
|
||||
|
||||
for (const QString &toolPath : sdkmanagerPaths) {
|
||||
QString toolPathWithSuffix = toolPath;
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
toolPathWithSuffix += ANDROID_BAT_SUFFIX;
|
||||
const FilePath sdkmanagerPath = m_sdkLocation / toolPathWithSuffix;
|
||||
const FilePath sdkmanagerPath = m_sdkLocation.pathAppended(Constants::cmdlineToolsName)
|
||||
.pathAppended("latest/bin/sdkmanager" ANDROID_BAT_SUFFIX);
|
||||
if (sdkmanagerPath.exists())
|
||||
return sdkmanagerPath;
|
||||
}
|
||||
|
||||
// If it's a first time install use the path of Constants::cmdlineToolsName temporary download
|
||||
const FilePath tmpSdkPath = m_temporarySdkToolsPath;
|
||||
if (!tmpSdkPath.isEmpty()) {
|
||||
QString suffix = "bin/sdkmanager";
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
suffix += ANDROID_BAT_SUFFIX;
|
||||
const FilePath tmpsdkManagerPath = tmpSdkPath.pathAppended(suffix);
|
||||
if (tmpsdkManagerPath.exists())
|
||||
return tmpsdkManagerPath;
|
||||
}
|
||||
const FilePath sdkmanagerTmpPath = m_temporarySdkToolsPath.pathAppended(
|
||||
"/bin/sdkmanager" ANDROID_BAT_SUFFIX);
|
||||
if (sdkmanagerTmpPath.exists())
|
||||
return sdkmanagerTmpPath;
|
||||
|
||||
return FilePath();
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::avdManagerToolPath() const
|
||||
{
|
||||
const QStringList sdkmanagerPaths = {
|
||||
QString(Constants::cmdlineToolsName).append("/latest/bin/avdmanager"),
|
||||
"tools/bin/avdmanager"};
|
||||
|
||||
for (const QString &toolPath : sdkmanagerPaths) {
|
||||
QString toolPathWithSuffix = toolPath;
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
toolPathWithSuffix += ANDROID_BAT_SUFFIX;
|
||||
const FilePath sdkmanagerPath = m_sdkLocation / toolPathWithSuffix;
|
||||
const FilePath sdkmanagerPath = m_sdkLocation.pathAppended(Constants::cmdlineToolsName)
|
||||
.pathAppended("/latest/bin/avdmanager" ANDROID_BAT_SUFFIX);
|
||||
if (sdkmanagerPath.exists())
|
||||
return sdkmanagerPath;
|
||||
}
|
||||
|
||||
return FilePath();
|
||||
}
|
||||
@@ -532,23 +499,15 @@ void AndroidConfig::setTemporarySdkToolsPath(const Utils::FilePath &path)
|
||||
|
||||
FilePath AndroidConfig::sdkToolsVersionPath() const
|
||||
{
|
||||
const QStringList sdkVersionPaths = {
|
||||
QString(Constants::cmdlineToolsName).append("/latest/source.properties"),
|
||||
"tools/source.properties"};
|
||||
|
||||
for (const QString &versionPath : sdkVersionPaths) {
|
||||
const FilePath sdkVersionPath = m_sdkLocation / versionPath;
|
||||
if (sdkVersionPath.exists())
|
||||
return sdkVersionPath;
|
||||
}
|
||||
const FilePath sdkVersionPaths = m_sdkLocation.pathAppended(Constants::cmdlineToolsName)
|
||||
.pathAppended("/latest/source.properties");
|
||||
if (sdkVersionPaths.exists())
|
||||
return sdkVersionPaths;
|
||||
|
||||
// If it's a first time install use the path of Constants::cmdlineToolsName temporary download
|
||||
const FilePath tmpSdkPath = m_temporarySdkToolsPath;
|
||||
if (!tmpSdkPath.isEmpty()) {
|
||||
const FilePath sdkVersionPath = tmpSdkPath.pathAppended("source.properties");
|
||||
if (sdkVersionPath.exists())
|
||||
return sdkVersionPath;
|
||||
}
|
||||
const FilePath tmpSdkPath = m_temporarySdkToolsPath.pathAppended("source.properties");
|
||||
if (tmpSdkPath.exists())
|
||||
return tmpSdkPath;
|
||||
|
||||
return FilePath();
|
||||
}
|
||||
|
||||
@@ -134,8 +134,6 @@ public:
|
||||
QString getProductModel(const QString &device) const;
|
||||
bool isConnected(const QString &serialNumber) const;
|
||||
|
||||
bool preCmdlineSdkToolsInstalled() const;
|
||||
|
||||
bool sdkFullyConfigured() const { return m_sdkFullyConfigured; }
|
||||
void setSdkFullyConfigured(bool allEssentialsInstalled) { m_sdkFullyConfigured = allEssentialsInstalled; }
|
||||
|
||||
|
||||
@@ -8,13 +8,11 @@
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#define ANDROID_BAT_SUFFIX ".bat"
|
||||
#else
|
||||
#define ANDROID_BAT_SUFFIX ""
|
||||
#endif
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
namespace Constants {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <utils/infolabel.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
@@ -289,8 +290,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
||||
|
||||
if (m_copyGradle) {
|
||||
FilePath gradlePath = version->prefix() / "src/3rdparty/gradle";
|
||||
if (!gradlePath.exists())
|
||||
gradlePath = AndroidConfigurations::currentConfig().sdkLocation() / "tools/templates/gradle/wrapper";
|
||||
QTC_ASSERT(gradlePath.exists(), return);
|
||||
FileUtils::copyRecursively(gradlePath, m_directory, nullptr, copy);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user