Commit 6a4c47b1 authored by BogDan Vatra's avatar BogDan Vatra Committed by Daniel Teske
Browse files

AndroidDebugSupport: Split up into general and qmake specific part



Introudce AndroidQtSupport. The derived class will eventually move to
the qmakeprojectmanager plugin.

Change-Id: I3fdc98259644fe718eb15aa9bd11d92dc0cdb1af
Reviewed-by: default avatarBogDan Vatra <bogdan@kde.org>
parent 8481c91f
......@@ -6,6 +6,7 @@ else:ANDROID_EXPERIMENTAL_STR="false"
QT += xml network
HEADERS += \
androidqtsupport.h \
androidconstants.h \
androidconfigurations.h \
androidmanager.h \
......@@ -50,7 +51,9 @@ HEADERS += \
javaautocompleter.h \
javacompletionassistprovider.h \
javafilewizard.h \
avddialog.h
avddialog.h \
android_global.h \
qmakeandroidsupport.h
SOURCES += \
androidconfigurations.cpp \
......@@ -95,7 +98,8 @@ SOURCES += \
javaautocompleter.cpp \
javacompletionassistprovider.cpp \
javafilewizard.cpp \
avddialog.cpp
avddialog.cpp \
qmakeandroidsupport.cpp
FORMS += \
androidsettingswidget.ui \
......
......@@ -20,6 +20,7 @@ QtcPlugin {
pluginspecreplacements: ({"ANDROID_EXPERIMENTAL_STR": (enable ? "false": "true")})
files: [
"android_global.h",
"addnewavddialog.ui",
"android.qrc",
"androidanalyzesupport.cpp",
......@@ -71,6 +72,7 @@ QtcPlugin {
"androidplugin.h",
"androidpotentialkit.cpp",
"androidpotentialkit.h",
"androidqtsupport.h",
"androidqtversion.cpp",
"androidqtversion.h",
"androidqtversionfactory.cpp",
......@@ -114,5 +116,7 @@ QtcPlugin {
"javaindenter.h",
"javaparser.cpp",
"javaparser.h",
"qmakeandroidsupport.cpp",
"qmakeandroidsupport.h",
]
}
/**************************************************************************
**
** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef ANDROID_GLOBAL_H
#define ANDROID_GLOBAL_H
#include <qglobal.h>
#if defined(ANDROID_LIBRARY)
# define ANDROID_EXPORT Q_DECL_EXPORT
#else
# define ANDROID_EXPORT Q_DECL_IMPORT
#endif
#endif // ANDROID_GLOBAL_H
......@@ -32,6 +32,7 @@
#include "androidglobal.h"
#include "androidrunner.h"
#include "androidmanager.h"
#include "androidqtsupport.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerplugin.h>
......@@ -40,19 +41,18 @@
#include <debugger/debuggerrunner.h>
#include <debugger/debuggerstartparameters.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
#include <qmakeprojectmanager/qmakenodes.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <qtsupport/qtkitinformation.h>
#include <QDir>
#include <QDirIterator>
#include <QTcpServer>
using namespace Debugger;
using namespace ProjectExplorer;
using namespace QmakeProjectManager;
namespace Android {
namespace Internal {
......@@ -85,7 +85,6 @@ static QStringList qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *runConfig, QString *errorMessage)
{
Target *target = runConfig->target();
QmakeProject *project = static_cast<QmakeProject *>(target->project());
DebuggerStartParameters params;
params.startMode = AttachToRemoteServer;
......@@ -101,12 +100,9 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString();
if (ToolChain *tc = ToolChainKitInformation::toolChain(kit))
params.toolChainAbi = tc->targetAbi();
params.executable = project->rootQmakeProjectNode()->buildDir() + QLatin1String("/app_process");
params.executable = target->activeBuildConfiguration()->buildDirectory().toString() + QLatin1String("/app_process");
params.remoteChannel = runConfig->remoteChannel();
params.solibSearchPath.clear();
QList<QmakeProFileNode *> nodes = project->allProFiles();
foreach (QmakeProFileNode *node, nodes)
params.solibSearchPath.append(node->targetInformation().buildDir);
params.solibSearchPath = AndroidManager::androidQtSupport(target)->soLibSearchPath(target);
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
params.solibSearchPath.append(qtSoPaths(version));
}
......@@ -118,9 +114,9 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.qmlServerAddress = server.serverAddress().toString();
params.remoteSetupNeeded = true;
//TODO: Not sure if these are the right paths.
params.projectSourceDirectory = project->projectDirectory().toString();
params.projectSourceFiles = project->files(QmakeProject::ExcludeGeneratedFiles);
params.projectBuildDirectory = project->rootQmakeProjectNode()->buildDir();
params.projectSourceDirectory = target->project()->projectDirectory().toString();
params.projectSourceFiles = target->project()->files(Project::ExcludeGeneratedFiles);
params.projectBuildDirectory = target->activeBuildConfiguration()->buildDirectory().toString();
}
DebuggerRunControl * const debuggerRunControl
......
......@@ -34,10 +34,14 @@
#include "androidglobal.h"
#include "androidtoolchain.h"
#include "androiddeployqtstep.h"
#include "androidqtsupport.h"
#include <coreplugin/documentmanager.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
......@@ -674,5 +678,15 @@ bool AndroidManager::checkForQt51Files(Utils::FileName fileName)
return dstVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble() < 5.2;
}
AndroidQtSupport *AndroidManager::androidQtSupport(ProjectExplorer::Target *target)
{
QList<AndroidQtSupport *> providerList = ExtensionSystem::PluginManager::getObjects<AndroidQtSupport>();
foreach (AndroidQtSupport *provider, providerList) {
if (provider->canHandle(target))
return provider;
}
return 0;
}
} // namespace Internal
} // namespace Android
......@@ -40,6 +40,7 @@
namespace ProjectExplorer { class Target; }
namespace Android {
class AndroidQtSupport;
namespace Internal {
class AndroidManager : public QObject
......@@ -106,6 +107,8 @@ public:
static bool checkKeystorePassword(const QString &keystorePath, const QString &keystorePasswd);
static bool checkCertificatePassword(const QString &keystorePath, const QString &keystorePasswd, const QString &alias, const QString &certificatePasswd);
static bool checkForQt51Files(Utils::FileName fileName);
static AndroidQtSupport *androidQtSupport(ProjectExplorer::Target *target);
private:
static void raiseError(const QString &reason);
static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName);
......
......@@ -47,6 +47,7 @@
#include "javaeditorfactory.h"
#include "javacompletionassistprovider.h"
#include "javafilewizard.h"
#include "qmakeandroidsupport.h"
#ifdef HAVE_QBS
# include "androidqbspropertyprovider.h"
#endif
......@@ -85,6 +86,7 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
addAutoReleasedObject(new Internal::JavaEditorFactory);
addAutoReleasedObject(new Internal::JavaCompletionAssistProvider);
addAutoReleasedObject(new Internal::JavaFileWizard);
addAutoReleasedObject(new Internal::QmakeAndroidSupport);
ProjectExplorer::KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation);
// AndroidManifest.xml editor
......
/**************************************************************************
**
** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef ANDROIDSUPPORT_H
#define ANDROIDSUPPORT_H
#include <QObject>
#include <QList>
#include <projectexplorer/project.h>
#include <utils/fileutils.h>
#include "android_global.h"
namespace ProjectExplorer {
class Target;
class DeployConfiguration;
class ProcessParameters;
}
namespace Android {
class ANDROID_EXPORT AndroidQtSupport : public QObject
{
Q_OBJECT
public:
enum BuildType {
DebugBuild,
ReleaseBuildUnsigned,
ReleaseBuildSigned
};
public:
virtual bool canHandle(const ProjectExplorer::Target *target) const = 0;
virtual QStringList soLibSearchPath(const ProjectExplorer::Target *target) const = 0;
};
} // namespace QtSupport
#endif // ANDROIDSUPPORT_H
/**************************************************************************
**
** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "qmakeandroidsupport.h"
#include "androidconstants.h"
#include "androidpackageinstallationstep.h"
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtkitinformation.h>
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
#include <qmakeprojectmanager/qmakenodes.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakestep.h>
using namespace QmakeProjectManager; // The class will eventually be moved there anyway
namespace Android {
namespace Internal {
bool QmakeAndroidSupport::canHandle(const ProjectExplorer::Target *target) const
{
return qobject_cast<QmakeProject*>(target->project());
}
QStringList QmakeAndroidSupport::soLibSearchPath(const ProjectExplorer::Target *target) const
{
QStringList res;
QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration*>(target->activeBuildConfiguration());
QmakeProject *project = qobject_cast<QmakeProject*>(target->project());
Q_ASSERT(project);
if (!project)
return res;
foreach (QmakeProFileNode *node, project->allProFiles()) {
res << node->buildDir(bc);
}
return res;
}
} // namespace Internal
} // namespace Android
/**************************************************************************
**
** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QMAKEANDROIDSUPPORT_H
#define QMAKEANDROIDSUPPORT_H
#include "androidqtsupport.h"
namespace Android {
namespace Internal {
class QmakeAndroidSupport : public Android::AndroidQtSupport
{
Q_OBJECT
public:
bool canHandle(const ProjectExplorer::Target *target) const;
QStringList soLibSearchPath(const ProjectExplorer::Target *target) const;
};
} // namespace Internal
} // namespace Android
#endif // QMAKEANDROIDSUPPORT_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment