Merge remote-tracking branch 'origin/4.12'

Conflicts:
	src/plugins/android/androidconfigurations.cpp
	src/plugins/qtsupport/qtoptionspage.cpp

Change-Id: I91ee3e771ab630ac3a54be53ac4be6d3c1c46950
This commit is contained in:
Eike Ziller
2020-04-20 08:40:54 +02:00
12 changed files with 108 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -47,10 +47,16 @@
build that is delivered with separate debug information. It is best suited build that is delivered with separate debug information. It is best suited
for analyzing applications. for analyzing applications.
\section1 Managing Build Configurations
You specify build settings in the \uicontrol Projects mode. You specify build settings in the \uicontrol Projects mode.
To add a new build configuration, click \uicontrol Add and select the type of To add a new build configuration, click \uicontrol Add and select the type of
configuration you would like to add. You can add as many build configuration you would like to add. You can add as many build
configurations as you need. configurations as you need. You can also select \uicontrol Clone to
add a build configuration that is based on the currently selected one.
Select \uicontrol Rename to give the currently selected build configuration
a new name.
To delete the build configuration currently selected, click \uicontrol Remove. To delete the build configuration currently selected, click \uicontrol Remove.

View File

@@ -155,7 +155,8 @@ bool AndroidBuildApkStep::init()
return false; return false;
const QVersionNumber sdkToolsVersion = AndroidConfigurations::currentConfig().sdkToolsVersion(); const QVersionNumber sdkToolsVersion = AndroidConfigurations::currentConfig().sdkToolsVersion();
if (sdkToolsVersion >= gradleScriptRevokedSdkVersion) { if (sdkToolsVersion >= gradleScriptRevokedSdkVersion
|| AndroidConfigurations::currentConfig().isCmdlineSdkToolsInstalled()) {
if (!version->sourcePath().pathAppended("src/3rdparty/gradle").exists()) { if (!version->sourcePath().pathAppended("src/3rdparty/gradle").exists()) {
emit addOutput(tr("The installed SDK tools version (%1) does not include Gradle " emit addOutput(tr("The installed SDK tools version (%1) does not include Gradle "
"scripts. The minimum Qt version required for Gradle build to work " "scripts. The minimum Qt version required for Gradle build to work "

View File

@@ -428,6 +428,15 @@ QString AndroidConfig::apiLevelNameFor(const SdkPlatform *platform)
QString("android-%1").arg(platform->apiLevel()) : ""; QString("android-%1").arg(platform->apiLevel()) : "";
} }
bool AndroidConfig::isCmdlineSdkToolsInstalled() const
{
QString toolPath("cmdline-tools/latest/bin/sdkmanager");
if (HostOsInfo::isWindowsHost())
toolPath += ANDROID_BAT_SUFFIX;
return m_sdkLocation.pathAppended(toolPath).exists();
}
FilePath AndroidConfig::adbToolPath() const FilePath AndroidConfig::adbToolPath() const
{ {
return m_sdkLocation / "platform-tools/adb" QTC_HOST_EXE_SUFFIX; return m_sdkLocation / "platform-tools/adb" QTC_HOST_EXE_SUFFIX;
@@ -449,25 +458,43 @@ FilePath AndroidConfig::androidToolPath() const
FilePath AndroidConfig::emulatorToolPath() const FilePath AndroidConfig::emulatorToolPath() const
{ {
QString relativePath = "emulator/emulator"; QString relativePath = "emulator/emulator";
if (sdkToolsVersion() < QVersionNumber(25, 3, 0)) if (sdkToolsVersion() < QVersionNumber(25, 3, 0) && !isCmdlineSdkToolsInstalled())
relativePath = "tools/emulator"; relativePath = "tools/emulator";
return m_sdkLocation / (relativePath + QTC_HOST_EXE_SUFFIX); return m_sdkLocation / (relativePath + QTC_HOST_EXE_SUFFIX);
} }
FilePath AndroidConfig::sdkManagerToolPath() const FilePath AndroidConfig::sdkManagerToolPath() const
{ {
QString toolPath = "tools/bin/sdkmanager"; QStringList sdkmanagerPaths = {"cmdline-tools/latest/bin/sdkmanager",
if (HostOsInfo::isWindowsHost()) "tools/bin/sdkmanager"};
toolPath += ANDROID_BAT_SUFFIX;
return m_sdkLocation / toolPath; for (QString &toolPath : sdkmanagerPaths) {
if (HostOsInfo::isWindowsHost())
toolPath += ANDROID_BAT_SUFFIX;
const FilePath sdkmanagerPath = m_sdkLocation / toolPath;
if (sdkmanagerPath.exists())
return sdkmanagerPath;
}
return FilePath();
} }
FilePath AndroidConfig::avdManagerToolPath() const FilePath AndroidConfig::avdManagerToolPath() const
{ {
QString toolPath = "tools/bin/avdmanager"; QStringList sdkmanagerPaths = {"cmdline-tools/latest/bin/avdmanager",
if (HostOsInfo::isWindowsHost()) "tools/bin/avdmanager"};
toolPath += ANDROID_BAT_SUFFIX;
return m_sdkLocation / toolPath; for (QString &toolPath : sdkmanagerPaths) {
if (HostOsInfo::isWindowsHost())
toolPath += ANDROID_BAT_SUFFIX;
const FilePath sdkmanagerPath = m_sdkLocation / toolPath;
if (sdkmanagerPath.exists())
return sdkmanagerPath;
}
return FilePath();
} }
FilePath AndroidConfig::aaptToolPath() const FilePath AndroidConfig::aaptToolPath() const
@@ -812,7 +839,7 @@ QStringList AndroidConfig::getAbis(const FilePath &adbToolPath, const QString &d
bool AndroidConfig::useNativeUiTools() const bool AndroidConfig::useNativeUiTools() const
{ {
const QVersionNumber version = sdkToolsVersion(); const QVersionNumber version = sdkToolsVersion();
return !version.isNull() && version <= QVersionNumber(25, 3 ,0); return !version.isNull() && version <= QVersionNumber(25, 3, 0) && !isCmdlineSdkToolsInstalled();
} }
bool AndroidConfig::isValidNdk(const QString &ndkLocation) const bool AndroidConfig::isValidNdk(const QString &ndkLocation) const
@@ -849,7 +876,11 @@ QVersionNumber AndroidConfig::sdkToolsVersion() const
{ {
QVersionNumber version; QVersionNumber version;
if (m_sdkLocation.exists()) { if (m_sdkLocation.exists()) {
const FilePath sdkToolsPropertiesPath = m_sdkLocation / "tools/source.properties"; FilePath sdkToolsPropertiesPath;
if (isCmdlineSdkToolsInstalled())
sdkToolsPropertiesPath = m_sdkLocation / "cmdline-tools/latest/source.properties";
else
sdkToolsPropertiesPath = m_sdkLocation / "tools/source.properties";
QSettings settings(sdkToolsPropertiesPath.toString(), QSettings::IniFormat); QSettings settings(sdkToolsPropertiesPath.toString(), QSettings::IniFormat);
auto versionStr = settings.value(sdkToolsVersionKey).toString(); auto versionStr = settings.value(sdkToolsVersionKey).toString();
version = QVersionNumber::fromString(versionStr); version = QVersionNumber::fromString(versionStr);
@@ -867,7 +898,6 @@ QVersionNumber AndroidConfig::buildToolsVersion() const
return maxVersion; return maxVersion;
} }
QStringList AndroidConfig::sdkManagerToolArgs() const QStringList AndroidConfig::sdkManagerToolArgs() const
{ {
return m_sdkManagerToolArgs; return m_sdkManagerToolArgs;

View File

@@ -185,6 +185,7 @@ public:
bool isConnected(const QString &serialNumber) const; bool isConnected(const QString &serialNumber) const;
bool useNativeUiTools() const; bool useNativeUiTools() const;
bool isCmdlineSdkToolsInstalled() const;
bool sdkFullyConfigured() const { return m_sdkFullyConfigured; } bool sdkFullyConfigured() const { return m_sdkFullyConfigured; }
void setSdkFullyConfigured(bool allEssentialsInstalled) { m_sdkFullyConfigured = allEssentialsInstalled; } void setSdkFullyConfigured(bool allEssentialsInstalled) { m_sdkFullyConfigured = allEssentialsInstalled; }

View File

@@ -1,4 +1,4 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
@@ -277,6 +277,7 @@ public:
EmulatorToolsMarker = 0x400, EmulatorToolsMarker = 0x400,
NdkMarker = 0x800, NdkMarker = 0x800,
ExtrasMarker = 0x1000, ExtrasMarker = 0x1000,
CmdlineSdkToolsMarker = 0x2000,
SectionMarkers = InstalledPackagesMarker | AvailablePackagesMarkers | AvailableUpdatesMarker SectionMarkers = InstalledPackagesMarker | AvailablePackagesMarkers | AvailableUpdatesMarker
}; };
@@ -313,6 +314,7 @@ const std::map<SdkManagerOutputParser::MarkerTag, const char *> markerTags {
{SdkManagerOutputParser::MarkerTag::SystemImageMarker, "system-images"}, {SdkManagerOutputParser::MarkerTag::SystemImageMarker, "system-images"},
{SdkManagerOutputParser::MarkerTag::BuildToolsMarker, "build-tools"}, {SdkManagerOutputParser::MarkerTag::BuildToolsMarker, "build-tools"},
{SdkManagerOutputParser::MarkerTag::SdkToolsMarker, "tools"}, {SdkManagerOutputParser::MarkerTag::SdkToolsMarker, "tools"},
{SdkManagerOutputParser::MarkerTag::CmdlineSdkToolsMarker, "cmdline-tools"},
{SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"}, {SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"},
{SdkManagerOutputParser::MarkerTag::EmulatorToolsMarker, "emulator"}, {SdkManagerOutputParser::MarkerTag::EmulatorToolsMarker, "emulator"},
{SdkManagerOutputParser::MarkerTag::NdkMarker, "ndk"}, {SdkManagerOutputParser::MarkerTag::NdkMarker, "ndk"},
@@ -597,6 +599,10 @@ void SdkManagerOutputParser::parsePackageData(MarkerTag packageMarker, const QSt
createPackage(&SdkManagerOutputParser::parseSdkToolsPackage); createPackage(&SdkManagerOutputParser::parseSdkToolsPackage);
break; break;
case MarkerTag::CmdlineSdkToolsMarker:
createPackage(&SdkManagerOutputParser::parseSdkToolsPackage);
break;
case MarkerTag::PlatformToolsMarker: case MarkerTag::PlatformToolsMarker:
createPackage(&SdkManagerOutputParser::parsePlatformToolsPackage); createPackage(&SdkManagerOutputParser::parsePlatformToolsPackage);
break; break;
@@ -882,7 +888,7 @@ void AndroidSdkManagerPrivate::reloadSdkPackages()
return; return;
} }
if (m_config.sdkToolsVersion() < sdkManagerIntroVersion) { if (m_config.sdkToolsVersion() < sdkManagerIntroVersion && !m_config.isCmdlineSdkToolsInstalled()) {
// Old Sdk tools. // Old Sdk tools.
m_packageListingSuccessful = true; m_packageListingSuccessful = true;
AndroidToolManager toolManager(m_config); AndroidToolManager toolManager(m_config);

View File

@@ -59,6 +59,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QList> #include <QList>
#include <QLoggingCategory>
#include <QMessageBox> #include <QMessageBox>
#include <QModelIndex> #include <QModelIndex>
#include <QSettings> #include <QSettings>
@@ -69,6 +70,10 @@
#include <memory> #include <memory>
namespace {
static Q_LOGGING_CATEGORY(androidsettingswidget, "qtc.android.androidsettingswidget", QtWarningMsg);
}
namespace Android { namespace Android {
namespace Internal { namespace Internal {
@@ -739,6 +744,10 @@ void AndroidSettingsWidget::onSdkPathChanged()
{ {
auto sdkPath = Utils::FilePath::fromUserInput(m_ui->SDKLocationPathChooser->rawPath()); auto sdkPath = Utils::FilePath::fromUserInput(m_ui->SDKLocationPathChooser->rawPath());
m_androidConfig.setSdkLocation(sdkPath); m_androidConfig.setSdkLocation(sdkPath);
Utils::FilePath currentOpenSslPath = m_androidConfig.openSslLocation();
if (currentOpenSslPath.isEmpty() || !currentOpenSslPath.exists())
currentOpenSslPath = sdkPath.pathAppended("android_openssl");
m_ui->openSslPathChooser->setFileName(currentOpenSslPath);
// Package reload will trigger validateSdk. // Package reload will trigger validateSdk.
m_sdkManager->reloadPackages(); m_sdkManager->reloadPackages();
} }
@@ -820,8 +829,12 @@ void AndroidSettingsWidget::downloadOpenSslRepo(const bool silent)
const QString openSslRepo("https://github.com/KDAB/android_openssl.git"); const QString openSslRepo("https://github.com/KDAB/android_openssl.git");
Utils::QtcProcess *gitCloner = new Utils::QtcProcess(this); Utils::QtcProcess *gitCloner = new Utils::QtcProcess(this);
gitCloner->setCommand(Utils::CommandLine("git", {"clone", "--depth=1", openSslRepo, openSslPath.fileName()})); Utils::CommandLine gitCloneCommand("git",
gitCloner->setWorkingDirectory(openSslPath.parentDir().toString()); {"clone", "--depth=1", openSslRepo, openSslPath.toString()});
gitCloner->setCommand(gitCloneCommand);
qCDebug(androidsettingswidget) << "Cloning OpenSSL repo: " <<
gitCloneCommand.toUserOutput();
QDir openSslDir(openSslPath.toString()); QDir openSslDir(openSslPath.toString());
if (openSslDir.exists()) { if (openSslDir.exists()) {

View File

@@ -944,6 +944,9 @@ bool ModelNode::hasNodeListProperty(const PropertyName &name) const
static bool recursiveAncestor(const ModelNode &possibleAncestor, const ModelNode &node) static bool recursiveAncestor(const ModelNode &possibleAncestor, const ModelNode &node)
{ {
if (!node.isValid())
return false;
if (node.hasParentProperty()) { if (node.hasParentProperty()) {
if (node.parentProperty().parentModelNode() == possibleAncestor) if (node.parentProperty().parentModelNode() == possibleAncestor)
return true; return true;

View File

@@ -327,17 +327,23 @@ NodeListProperty QmlVisualNode::findSceneNodeProperty(AbstractView *view, qint32
bool QmlVisualNode::isFlowTransition(const ModelNode &node) bool QmlVisualNode::isFlowTransition(const ModelNode &node)
{ {
return node.metaInfo().isValid() && node.metaInfo().isSubclassOf("FlowView.FlowTransition"); return node.isValid()
&& node.metaInfo().isValid()
&& node.metaInfo().isSubclassOf("FlowView.FlowTransition");
} }
bool QmlVisualNode::isFlowDecision(const ModelNode &node) bool QmlVisualNode::isFlowDecision(const ModelNode &node)
{ {
return node.metaInfo().isValid() && node.metaInfo().isSubclassOf("FlowView.FlowDecision"); return node.isValid()
&& node.metaInfo().isValid()
&& node.metaInfo().isSubclassOf("FlowView.FlowDecision");
} }
bool QmlVisualNode::isFlowWildcard(const ModelNode &node) bool QmlVisualNode::isFlowWildcard(const ModelNode &node)
{ {
return node.metaInfo().isValid() && node.metaInfo().isSubclassOf("FlowView.FlowWildcard"); return node.isValid()
&& node.metaInfo().isValid()
&& node.metaInfo().isSubclassOf("FlowView.FlowWildcard");
} }
bool QmlVisualNode::isFlowTransition() const bool QmlVisualNode::isFlowTransition() const

View File

@@ -796,6 +796,12 @@ static QString settingsFile(const QString &baseDir)
+ Core::Constants::IDE_CASED_ID + ".ini"; + Core::Constants::IDE_CASED_ID + ".ini";
} }
static QString qtVersionsFile(const QString &baseDir)
{
return baseDir + (baseDir.isEmpty() ? "" : "/") + Core::Constants::IDE_SETTINGSVARIANT_STR + '/'
+ Core::Constants::IDE_ID + '/' + "qtversion.xml";
}
static Utils::optional<QString> currentlyLinkedQtDir(bool *hasInstallSettings) static Utils::optional<QString> currentlyLinkedQtDir(bool *hasInstallSettings)
{ {
const QString installSettingsFilePath = settingsFile(Core::ICore::resourcePath()); const QString installSettingsFilePath = settingsFile(Core::ICore::resourcePath());
@@ -883,7 +889,18 @@ void QtOptionsPageWidget::apply()
const QStringList kSubdirsToCheck = {"", const QStringList kSubdirsToCheck = {"",
"Qt Creator.app/Contents/Resources", "Qt Creator.app/Contents/Resources",
"Contents/Resources", "Contents/Resources",
"Tools/QtCreator/share/qtcreator"}; "Tools/QtCreator/share/qtcreator",
"share/qtcreator"};
static QStringList settingsFilesToCheck()
{
return Utils::transform(kSubdirsToCheck, [](const QString &dir) { return settingsFile(dir); });
}
static QStringList qtversionFilesToCheck()
{
return Utils::transform(kSubdirsToCheck, [](const QString &dir) { return qtVersionsFile(dir); });
}
static Utils::optional<QString> settingsDirForQtDir(const QString &qtDir) static Utils::optional<QString> settingsDirForQtDir(const QString &qtDir)
{ {
@@ -891,7 +908,7 @@ static Utils::optional<QString> settingsDirForQtDir(const QString &qtDir)
return QString(qtDir + '/' + dir); return QString(qtDir + '/' + dir);
}); });
const QString validDir = Utils::findOrDefault(dirsToCheck, [](const QString &dir) { const QString validDir = Utils::findOrDefault(dirsToCheck, [](const QString &dir) {
return QFile::exists(settingsFile(dir)); return QFile::exists(settingsFile(dir)) || QFile::exists(qtVersionsFile(dir));
}); });
if (!validDir.isEmpty()) if (!validDir.isEmpty())
return validDir; return validDir;
@@ -903,15 +920,11 @@ static bool validateQtInstallDir(FancyLineEdit *input, QString *errorString)
const QString qtDir = input->text(); const QString qtDir = input->text();
if (!settingsDirForQtDir(qtDir)) { if (!settingsDirForQtDir(qtDir)) {
if (errorString) { if (errorString) {
const QStringList filesToCheck = Utils::transform(kSubdirsToCheck, const QStringList filesToCheck = settingsFilesToCheck() + qtversionFilesToCheck();
[](const QString &dir) {
return settingsFile(dir);
});
*errorString = "<html><body>" + QtOptionsPageWidget::tr( *errorString = "<html><body>" + QtOptionsPageWidget::tr(
"Qt installation information was not found in \"%1\". " "Qt installation information was not found in \"%1\". "
"Choose a directory that contains one of the files %2") "Choose a directory that contains one of the files %2")
.arg(qtDir, "<pre>" + filesToCheck.join('\n') + "</pre>") .arg(qtDir, "<pre>" + filesToCheck.join('\n') + "</pre>");
+ "</body></html>";
} }
return false; return false;
} }