Android: fix qml debugger not starting on Qt 5.14+

Task-number: QTCREATORBUG-24155
Change-Id: Iddc5f7cb31a3512762d1e72b42108e5ed61bd9af
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Assam Boudjelthia
2020-07-03 19:57:35 +03:00
parent 9182d4eda7
commit 697a7ad6db

View File

@@ -38,14 +38,22 @@
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/hostosinfo.h>
#include <utils/qtcprocess.h>
#include <QDir>
#include <QLoggingCategory>
using namespace ProjectExplorer;
using namespace Utils;
namespace {
static Q_LOGGING_CATEGORY(packageInstallationStepLog, "qtc.android.packageinstallationstep", QtWarningMsg)
}
namespace Android {
namespace Internal {
@@ -153,6 +161,26 @@ void AndroidPackageInstallationStep::doRun()
}
}
AbstractProcessStep::doRun();
// NOTE: This is a workaround for QTCREATORBUG-24155
// Needed for Qt 5.15.0 and Qt 5.14.x versions
if (buildType() == BuildConfiguration::BuildType::Debug) {
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target()->kit());
if (version && version->qtVersion() >= QtSupport::QtVersionNumber{5, 14}
&& version->qtVersion() <= QtSupport::QtVersionNumber{5, 15, 0}) {
const QString assetsDebugDir = nativeAndroidBuildPath().append(
"/assets/--Added-by-androiddeployqt--/");
QDir dir;
if (!dir.exists(assetsDebugDir))
dir.mkpath(assetsDebugDir);
QFile file(assetsDebugDir + "debugger.command");
if (file.open(QIODevice::WriteOnly))
qCDebug(packageInstallationStepLog, "Successful added %s to the package.", qPrintable(file.fileName()));
else
qCDebug(packageInstallationStepLog, "Cound't add %s to the package. The QML debugger might not work properly.", qPrintable(file.fileName()));
}
}
}
BuildStepConfigWidget *AndroidPackageInstallationStep::createConfigWidget()