forked from qt-creator/qt-creator
Profile introduction
Introduce Profiles to store sets of values that describe a system/device. These profiles are held by a target, getting rid of much of the information stored in the Build-/Run-/DeployConfigurations, greatly simplifying those. This is a squash of the wip/profile branch which has been on gerrit for a while, rebased to current master. Change-Id: I25956c8dd4d1962b2134bfaa8a8076ae3909460f Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -41,6 +41,39 @@
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
FadingWidget::FadingWidget(QWidget *parent) :
|
||||
FadingPanel(parent),
|
||||
m_opacityEffect(new QGraphicsOpacityEffect)
|
||||
{
|
||||
m_opacityEffect->setOpacity(0);
|
||||
setGraphicsEffect(m_opacityEffect);
|
||||
|
||||
// Workaround for issue with QGraphicsEffect. GraphicsEffect
|
||||
// currently clears with Window color. Remove if flickering
|
||||
// no longer occurs on fade-in
|
||||
QPalette pal;
|
||||
pal.setBrush(QPalette::All, QPalette::Window, Qt::transparent);
|
||||
setPalette(pal);
|
||||
}
|
||||
|
||||
void FadingWidget::setOpacity(qreal value)
|
||||
{
|
||||
m_opacityEffect->setOpacity(value);
|
||||
}
|
||||
|
||||
void FadingWidget::fadeTo(qreal value)
|
||||
{
|
||||
QPropertyAnimation *animation = new QPropertyAnimation(m_opacityEffect, "opacity");
|
||||
animation->setDuration(200);
|
||||
animation->setEndValue(value);
|
||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
qreal FadingWidget::opacity()
|
||||
{
|
||||
return m_opacityEffect->opacity();
|
||||
}
|
||||
|
||||
DetailsButton::DetailsButton(QWidget *parent) : QAbstractButton(parent), m_fader(0)
|
||||
{
|
||||
setCheckable(true);
|
||||
|
@@ -38,11 +38,15 @@
|
||||
#include <QAbstractButton>
|
||||
#include <QPixmap>
|
||||
|
||||
#include <QGraphicsOpacityEffect>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QGraphicsOpacityEffect)
|
||||
|
||||
namespace Utils {
|
||||
class QTCREATOR_UTILS_EXPORT FadingPanel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FadingPanel(QWidget *parent = 0)
|
||||
: QWidget(parent)
|
||||
@@ -51,6 +55,18 @@ public:
|
||||
virtual void setOpacity(qreal value) = 0;
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT FadingWidget : public FadingPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FadingWidget(QWidget *parent = 0);
|
||||
void fadeTo(qreal value);
|
||||
qreal opacity();
|
||||
void setOpacity(qreal value);
|
||||
protected:
|
||||
QGraphicsOpacityEffect *m_opacityEffect;
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT DetailsButton : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -340,9 +340,9 @@ PersistentSettingsWriter::PersistentSettingsWriter()
|
||||
static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
|
||||
const QVariant &variant, const QString &key = QString())
|
||||
{
|
||||
switch (variant.type()) {
|
||||
case QVariant::StringList:
|
||||
case QVariant::List:
|
||||
switch (static_cast<int>(variant.type())) {
|
||||
case static_cast<int>(QVariant::StringList):
|
||||
case static_cast<int>(QVariant::List):
|
||||
w.writeStartElement(ctx.valueListElement);
|
||||
w.writeAttribute(ctx.typeAttribute, QLatin1String(QVariant::typeToName(QVariant::List)));
|
||||
if (!key.isEmpty())
|
||||
@@ -351,7 +351,7 @@ static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
|
||||
writeVariantValue(w, ctx, var);
|
||||
w.writeEndElement();
|
||||
break;
|
||||
case QVariant::Map: {
|
||||
case static_cast<int>(QVariant::Map): {
|
||||
w.writeStartElement(ctx.valueMapElement);
|
||||
w.writeAttribute(ctx.typeAttribute, QLatin1String(QVariant::typeToName(QVariant::Map)));
|
||||
if (!key.isEmpty())
|
||||
@@ -363,6 +363,9 @@ static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
|
||||
w.writeEndElement();
|
||||
}
|
||||
break;
|
||||
case static_cast<int>(QMetaType::QObjectStar): // ignore QObjects!
|
||||
case static_cast<int>(QMetaType::VoidStar): // ignore void pointers!
|
||||
break;
|
||||
default:
|
||||
w.writeStartElement(ctx.valueElement);
|
||||
w.writeAttribute(ctx.typeAttribute, QLatin1String(variant.typeName()));
|
||||
|
@@ -12,6 +12,7 @@ QT += xml network
|
||||
HEADERS += \
|
||||
androidconstants.h \
|
||||
androidconfigurations.h \
|
||||
androidmanager.h \
|
||||
androidrunconfiguration.h \
|
||||
androidruncontrol.h \
|
||||
androidrunfactories.h \
|
||||
@@ -32,14 +33,13 @@ HEADERS += \
|
||||
androidqtversionfactory.h \
|
||||
androidqtversion.h \
|
||||
androiddeployconfiguration.h \
|
||||
androidtarget.h \
|
||||
androidtargetfactory.h \
|
||||
androidcreatekeystorecertificate.h \
|
||||
javaparser.h \
|
||||
androidplugin.h
|
||||
|
||||
SOURCES += \
|
||||
androidconfigurations.cpp \
|
||||
androidmanager.cpp \
|
||||
androidrunconfiguration.cpp \
|
||||
androidruncontrol.cpp \
|
||||
androidrunfactories.cpp \
|
||||
@@ -59,8 +59,6 @@ SOURCES += \
|
||||
androidqtversionfactory.cpp \
|
||||
androidqtversion.cpp \
|
||||
androiddeployconfiguration.cpp \
|
||||
androidtarget.cpp \
|
||||
androidtargetfactory.cpp \
|
||||
androidcreatekeystorecertificate.cpp \
|
||||
javaparser.cpp \
|
||||
androidplugin.cpp
|
||||
|
@@ -42,6 +42,8 @@ QtcPlugin {
|
||||
"androiddeploystepwidget.h",
|
||||
"androiddeploystepwidget.ui",
|
||||
"androidglobal.h",
|
||||
"androidmanager.h",
|
||||
"androidmanager.cpp",
|
||||
"androidpackagecreationfactory.cpp",
|
||||
"androidpackagecreationfactory.h",
|
||||
"androidpackagecreationstep.cpp",
|
||||
@@ -73,10 +75,6 @@ QtcPlugin {
|
||||
"androidsettingswidget.cpp",
|
||||
"androidsettingswidget.h",
|
||||
"androidsettingswidget.ui",
|
||||
"androidtarget.cpp",
|
||||
"androidtargetfactory.cpp",
|
||||
"androidtargetfactory.h",
|
||||
"androidtarget.h",
|
||||
"androidtoolchain.cpp",
|
||||
"androidtoolchain.h",
|
||||
"javaparser.cpp",
|
||||
|
@@ -124,16 +124,16 @@ QLatin1String AndroidConfigurations::toolsPrefix(ProjectExplorer::Abi::Architect
|
||||
AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
{
|
||||
// user settings
|
||||
armGdbLocation = settings.value(ArmGdbLocationKey).toString();
|
||||
armGdbserverLocation = settings.value(ArmGdbserverLocationKey).toString();
|
||||
x86GdbLocation = settings.value(X86GdbLocationKey).toString();
|
||||
x86GdbserverLocation = settings.value(X86GdbserverLocationKey).toString();
|
||||
armGdbLocation = Utils::FileName::fromString(settings.value(ArmGdbLocationKey).toString());
|
||||
armGdbserverLocation = Utils::FileName::fromString(settings.value(ArmGdbserverLocationKey).toString());
|
||||
x86GdbLocation = Utils::FileName::fromString(settings.value(X86GdbLocationKey).toString());
|
||||
x86GdbserverLocation = Utils::FileName::fromString(settings.value(X86GdbserverLocationKey).toString());
|
||||
partitionSize = settings.value(PartitionSizeKey, 1024).toInt();
|
||||
sdkLocation = settings.value(SDKLocationKey).toString();
|
||||
ndkLocation = settings.value(NDKLocationKey).toString();
|
||||
antLocation = settings.value(AntLocationKey).toString();
|
||||
openJDKLocation = settings.value(OpenJDKLocationKey).toString();
|
||||
keystoreLocation = settings.value(KeystoreLocationKey).toString();
|
||||
sdkLocation = Utils::FileName::fromString(settings.value(SDKLocationKey).toString());
|
||||
ndkLocation = Utils::FileName::fromString(settings.value(NDKLocationKey).toString());
|
||||
antLocation = Utils::FileName::fromString(settings.value(AntLocationKey).toString());
|
||||
openJDKLocation = Utils::FileName::fromString(settings.value(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = Utils::FileName::fromString(settings.value(KeystoreLocationKey).toString());
|
||||
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
const QString &value = settings.value(NDKToolchainVersionKey).toString();
|
||||
@@ -147,11 +147,11 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
if (reader.load(settingsFileName())
|
||||
&& settings.value(changeTimeStamp).toInt() != QFileInfo(settingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
|
||||
// persisten settings
|
||||
sdkLocation = reader.restoreValue(SDKLocationKey).toString();
|
||||
ndkLocation = reader.restoreValue(NDKLocationKey).toString();
|
||||
antLocation = reader.restoreValue(AntLocationKey).toString();
|
||||
openJDKLocation = reader.restoreValue(OpenJDKLocationKey).toString();
|
||||
keystoreLocation = reader.restoreValue(KeystoreLocationKey).toString();
|
||||
sdkLocation = Utils::FileName::fromString(reader.restoreValue(SDKLocationKey).toString());
|
||||
ndkLocation = Utils::FileName::fromString(reader.restoreValue(NDKLocationKey).toString());
|
||||
antLocation = Utils::FileName::fromString(reader.restoreValue(AntLocationKey).toString());
|
||||
openJDKLocation = Utils::FileName::fromString(reader.restoreValue(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = Utils::FileName::fromString(reader.restoreValue(KeystoreLocationKey).toString());
|
||||
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
const QString &value = reader.restoreValue(NDKToolchainVersionKey).toString();
|
||||
@@ -160,17 +160,17 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
else
|
||||
ndkToolchainVersion = value.mid(versionRegExp.indexIn(value));
|
||||
|
||||
if (!armGdbLocation.length())
|
||||
armGdbLocation = reader.restoreValue(ArmGdbLocationKey).toString();
|
||||
if (armGdbLocation.isEmpty())
|
||||
armGdbLocation = Utils::FileName::fromString(reader.restoreValue(ArmGdbLocationKey).toString());
|
||||
|
||||
if (!armGdbserverLocation.length())
|
||||
armGdbserverLocation = reader.restoreValue(ArmGdbserverLocationKey).toString();
|
||||
if (armGdbserverLocation.isEmpty())
|
||||
armGdbserverLocation = Utils::FileName::fromString(reader.restoreValue(ArmGdbserverLocationKey).toString());
|
||||
|
||||
if (!x86GdbLocation.length())
|
||||
x86GdbLocation = reader.restoreValue(X86GdbLocationKey).toString();
|
||||
if (x86GdbLocation.isEmpty())
|
||||
x86GdbLocation = Utils::FileName::fromString(reader.restoreValue(X86GdbLocationKey).toString());
|
||||
|
||||
if (!x86GdbserverLocation.length())
|
||||
x86GdbserverLocation = reader.restoreValue(X86GdbserverLocationKey).toString();
|
||||
if (x86GdbserverLocation.isEmpty())
|
||||
x86GdbserverLocation = Utils::FileName::fromString(reader.restoreValue(X86GdbserverLocationKey).toString());
|
||||
// persistent settings
|
||||
}
|
||||
|
||||
@@ -188,16 +188,16 @@ void AndroidConfig::save(QSettings &settings) const
|
||||
settings.setValue(changeTimeStamp, fileInfo.lastModified().toMSecsSinceEpoch() / 1000);
|
||||
|
||||
// user settings
|
||||
settings.setValue(SDKLocationKey, sdkLocation);
|
||||
settings.setValue(NDKLocationKey, ndkLocation);
|
||||
settings.setValue(SDKLocationKey, sdkLocation.toString());
|
||||
settings.setValue(NDKLocationKey, ndkLocation.toString());
|
||||
settings.setValue(NDKToolchainVersionKey, ndkToolchainVersion);
|
||||
settings.setValue(AntLocationKey, antLocation);
|
||||
settings.setValue(OpenJDKLocationKey, openJDKLocation);
|
||||
settings.setValue(KeystoreLocationKey, keystoreLocation);
|
||||
settings.setValue(ArmGdbLocationKey, armGdbLocation);
|
||||
settings.setValue(ArmGdbserverLocationKey, armGdbserverLocation);
|
||||
settings.setValue(X86GdbLocationKey, x86GdbLocation);
|
||||
settings.setValue(X86GdbserverLocationKey, x86GdbserverLocation);
|
||||
settings.setValue(AntLocationKey, antLocation.toString());
|
||||
settings.setValue(OpenJDKLocationKey, openJDKLocation.toString());
|
||||
settings.setValue(KeystoreLocationKey, keystoreLocation.toString());
|
||||
settings.setValue(ArmGdbLocationKey, armGdbLocation.toString());
|
||||
settings.setValue(ArmGdbserverLocationKey, armGdbserverLocation.toString());
|
||||
settings.setValue(X86GdbLocationKey, x86GdbLocation.toString());
|
||||
settings.setValue(X86GdbserverLocationKey, x86GdbserverLocation.toString());
|
||||
settings.setValue(PartitionSizeKey, partitionSize);
|
||||
// user settings
|
||||
|
||||
@@ -214,7 +214,7 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
|
||||
void AndroidConfigurations::updateAvailablePlatforms()
|
||||
{
|
||||
m_availablePlatforms.clear();
|
||||
QDirIterator it(m_config.ndkLocation + QLatin1String("/platforms"), QStringList() << QLatin1String("android-*"), QDir::Dirs);
|
||||
QDirIterator it(m_config.ndkLocation.appendPath(QLatin1String("platforms")).toString(), QStringList() << QLatin1String("android-*"), QDir::Dirs);
|
||||
while (it.hasNext()) {
|
||||
const QString &fileName = it.next();
|
||||
m_availablePlatforms.push_back(fileName.mid(fileName.lastIndexOf(QLatin1Char('-')) + 1).toInt());
|
||||
@@ -226,7 +226,7 @@ QStringList AndroidConfigurations::sdkTargets(int minApiLevel) const
|
||||
{
|
||||
QStringList targets;
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
|
||||
proc.start(androidToolPath().toString(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
proc.terminate();
|
||||
return targets;
|
||||
@@ -248,7 +248,8 @@ QStringList AndroidConfigurations::ndkToolchainVersions() const
|
||||
{
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
QStringList result;
|
||||
QDirIterator it(m_config.ndkLocation + QLatin1String("/toolchains"),
|
||||
Utils::FileName path = m_config.ndkLocation;
|
||||
QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
|
||||
QStringList() << QLatin1String("*"), QDir::Dirs);
|
||||
while (it.hasNext()) {
|
||||
const QString &fileName = it.next();
|
||||
@@ -262,66 +263,71 @@ QStringList AndroidConfigurations::ndkToolchainVersions() const
|
||||
return result;
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::adbToolPath() const
|
||||
Utils::FileName AndroidConfigurations::adbToolPath() const
|
||||
{
|
||||
return m_config.sdkLocation + QLatin1String("/platform-tools/adb" ANDROID_EXE_SUFFIX);
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("platform-tools/adb"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::androidToolPath() const
|
||||
Utils::FileName AndroidConfigurations::androidToolPath() const
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
// I want to switch from using android.bat to using an executable. All it really does is call
|
||||
// Java and I've made some progress on it. So if android.exe exists, return that instead.
|
||||
QFileInfo fi(m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_EXE_SUFFIX));
|
||||
if (fi.exists())
|
||||
return m_config.sdkLocation + QString("/tools/android" ANDROID_EXE_SUFFIX);
|
||||
else
|
||||
return m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_BAT_SUFFIX);
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
path.appendPath(QLatin1String("tools/android"ANDROID_EXE_SUFFIX));
|
||||
if (path.toFileInfo().exists())
|
||||
return path;
|
||||
path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/android"ANDROID_BAT_SUFFIX));
|
||||
#else
|
||||
return m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_EXE_SUFFIX);
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/android"ANDROID_EXE_SUFFIX));
|
||||
#endif
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::antToolPath() const
|
||||
Utils::FileName AndroidConfigurations::antToolPath() const
|
||||
{
|
||||
if (m_config.antLocation.length())
|
||||
if (!m_config.antLocation.isEmpty())
|
||||
return m_config.antLocation;
|
||||
else
|
||||
return QLatin1String("ant");
|
||||
return Utils::FileName::fromString(QLatin1String("ant"));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::emulatorToolPath() const
|
||||
Utils::FileName AndroidConfigurations::emulatorToolPath() const
|
||||
{
|
||||
return m_config.sdkLocation + QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX);
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/emulator"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::toolPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::toolPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
return m_config.ndkLocation + QString::fromLatin1("/toolchains/%1-%2/prebuilt/%3/bin/%4")
|
||||
Utils::FileName path = m_config.ndkLocation;
|
||||
return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/%3/bin/%4")
|
||||
.arg(toolchainPrefix(architecture))
|
||||
.arg(m_config.ndkToolchainVersion)
|
||||
.arg(ToolchainHost)
|
||||
.arg(toolsPrefix(architecture));
|
||||
.arg(toolsPrefix(architecture)));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::stripPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::stripPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture) + QLatin1String("-strip" ANDROID_EXE_SUFFIX);
|
||||
return toolPath(architecture).append(QLatin1String("-strip"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::readelfPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::readelfPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture) + QLatin1String("-readelf" ANDROID_EXE_SUFFIX);
|
||||
return toolPath(architecture).append(QLatin1String("-readelf"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::gccPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::gccPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture) + QLatin1String("-gcc" ANDROID_EXE_SUFFIX);
|
||||
return toolPath(architecture).append(QLatin1String("-gcc"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
QString gdbServerPath;
|
||||
Utils::FileName gdbServerPath;
|
||||
switch (architecture) {
|
||||
case ProjectExplorer::Abi::ArmArchitecture:
|
||||
gdbServerPath = m_config.armGdbserverLocation;
|
||||
@@ -330,20 +336,21 @@ QString AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture
|
||||
gdbServerPath = m_config.x86GdbserverLocation;
|
||||
break;
|
||||
default:
|
||||
gdbServerPath = Unknown;
|
||||
gdbServerPath = Utils::FileName::fromString(Unknown);
|
||||
break;
|
||||
}
|
||||
|
||||
if (gdbServerPath.length())
|
||||
if (!gdbServerPath.isEmpty())
|
||||
return gdbServerPath;
|
||||
return m_config.ndkLocation + QString::fromLatin1("/toolchains/%1-%2/prebuilt/gdbserver")
|
||||
Utils::FileName path = m_config.ndkLocation;
|
||||
return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
|
||||
.arg(toolchainPrefix(architecture))
|
||||
.arg(m_config.ndkToolchainVersion);
|
||||
.arg(m_config.ndkToolchainVersion));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
QString gdbPath;
|
||||
Utils::FileName gdbPath;
|
||||
switch (architecture) {
|
||||
case ProjectExplorer::Abi::ArmArchitecture:
|
||||
gdbPath = m_config.armGdbLocation;
|
||||
@@ -352,45 +359,47 @@ QString AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture archit
|
||||
gdbPath = m_config.x86GdbLocation;
|
||||
break;
|
||||
default:
|
||||
gdbPath = Unknown;
|
||||
gdbPath = Utils::FileName::fromString(Unknown);
|
||||
break;
|
||||
}
|
||||
if (!gdbPath.isEmpty())
|
||||
return gdbPath;
|
||||
return toolPath(architecture) + QLatin1String("-gdb" ANDROID_EXE_SUFFIX);
|
||||
return toolPath(architecture).append(QLatin1String("-gdb"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::openJDKPath() const
|
||||
Utils::FileName AndroidConfigurations::openJDKPath() const
|
||||
{
|
||||
return m_config.openJDKLocation;
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::openJDKBinPath() const
|
||||
Utils::FileName AndroidConfigurations::openJDKBinPath() const
|
||||
{
|
||||
if (m_config.openJDKLocation.length())
|
||||
return m_config.openJDKLocation + QLatin1String("/bin/");
|
||||
return QString();
|
||||
Utils::FileName path = m_config.openJDKLocation;
|
||||
if (!path.isEmpty())
|
||||
return path.appendPath(QLatin1String("bin"));
|
||||
return path;
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::keytoolPath() const
|
||||
Utils::FileName AndroidConfigurations::keytoolPath() const
|
||||
{
|
||||
return openJDKBinPath() + keytoolName;
|
||||
return openJDKBinPath().appendPath(keytoolName);
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::jarsignerPath() const
|
||||
Utils::FileName AndroidConfigurations::jarsignerPath() const
|
||||
{
|
||||
return openJDKBinPath() + jarsignerName;
|
||||
return openJDKBinPath().appendPath(jarsignerName);
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::getDeployDeviceSerialNumber(int *apiLevel) const
|
||||
{
|
||||
QVector<AndroidDevice> devices = connectedDevices();
|
||||
|
||||
foreach (AndroidDevice device, devices)
|
||||
foreach (AndroidDevice device, devices) {
|
||||
if (device.sdk >= *apiLevel) {
|
||||
*apiLevel = device.sdk;
|
||||
return device.serialNumber;
|
||||
}
|
||||
}
|
||||
return startAVD(apiLevel);
|
||||
}
|
||||
|
||||
@@ -398,7 +407,7 @@ QVector<AndroidDevice> AndroidConfigurations::connectedDevices(int apiLevel) con
|
||||
{
|
||||
QVector<AndroidDevice> devices;
|
||||
QProcess adbProc;
|
||||
adbProc.start(adbToolPath(), QStringList() << QLatin1String("devices"));
|
||||
adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
|
||||
if (!adbProc.waitForFinished(-1)) {
|
||||
adbProc.terminate();
|
||||
return devices;
|
||||
@@ -443,7 +452,7 @@ bool AndroidConfigurations::createAVD(int minApiLevel) const
|
||||
bool AndroidConfigurations::createAVD(const QString &target, const QString &name, int sdcardSize ) const
|
||||
{
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath(),
|
||||
proc.start(androidToolPath().toString(),
|
||||
QStringList() << QLatin1String("create") << QLatin1String("avd")
|
||||
<< QLatin1String("-a") << QLatin1String("-t") << target
|
||||
<< QLatin1String("-n") << name
|
||||
@@ -461,7 +470,7 @@ bool AndroidConfigurations::createAVD(const QString &target, const QString &name
|
||||
bool AndroidConfigurations::removeAVD(const QString &name) const
|
||||
{
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath(),
|
||||
proc.start(androidToolPath().toString(),
|
||||
QStringList() << QLatin1String("delete") << QLatin1String("avd")
|
||||
<< QLatin1String("-n") << name);
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
@@ -475,7 +484,7 @@ QVector<AndroidDevice> AndroidConfigurations::androidVirtualDevices() const
|
||||
{
|
||||
QVector<AndroidDevice> devices;
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath(),
|
||||
proc.start(androidToolPath().toString(),
|
||||
QStringList() << QLatin1String("list") << QLatin1String("avd")); // list available AVDs
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
proc.terminate();
|
||||
@@ -540,7 +549,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
return avdName;
|
||||
|
||||
// start the emulator
|
||||
m_avdProcess->start(emulatorToolPath(),
|
||||
m_avdProcess->start(emulatorToolPath().toString(),
|
||||
QStringList() << QLatin1String("-partition-size") << QString::number(config().partitionSize)
|
||||
<< QLatin1String("-avd") << avdName);
|
||||
if (!m_avdProcess->waitForStarted(-1)) {
|
||||
@@ -550,7 +559,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
|
||||
// wait until the emulator is online
|
||||
QProcess proc;
|
||||
proc.start(adbToolPath(), QStringList() << QLatin1String("-e") << QLatin1String("wait-for-device"));
|
||||
proc.start(adbToolPath().toString(), QStringList() << QLatin1String("-e") << QLatin1String("wait-for-device"));
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
proc.terminate();
|
||||
return QString();
|
||||
@@ -558,7 +567,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
sleep(5);// wait for pm to start
|
||||
|
||||
// workaround for stupid adb bug
|
||||
proc.start(adbToolPath(), QStringList() << QLatin1String("devices"));
|
||||
proc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
proc.terminate();
|
||||
return QString();
|
||||
@@ -577,7 +586,7 @@ int AndroidConfigurations::getSDKVersion(const QString &device) const
|
||||
{
|
||||
|
||||
QProcess adbProc;
|
||||
adbProc.start(adbToolPath(),
|
||||
adbProc.start(adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << device
|
||||
<< QLatin1String("shell") << QLatin1String("getprop")
|
||||
<< QLatin1String("ro.build.version.sdk"));
|
||||
|
@@ -67,16 +67,16 @@ public:
|
||||
AndroidConfig(const QSettings &settings);
|
||||
void save(QSettings &settings) const;
|
||||
|
||||
QString sdkLocation;
|
||||
QString ndkLocation;
|
||||
Utils::FileName sdkLocation;
|
||||
Utils::FileName ndkLocation;
|
||||
QString ndkToolchainVersion;
|
||||
QString antLocation;
|
||||
QString armGdbLocation;
|
||||
QString armGdbserverLocation;
|
||||
QString x86GdbLocation;
|
||||
QString x86GdbserverLocation;
|
||||
QString openJDKLocation;
|
||||
QString keystoreLocation;
|
||||
Utils::FileName antLocation;
|
||||
Utils::FileName armGdbLocation;
|
||||
Utils::FileName armGdbserverLocation;
|
||||
Utils::FileName x86GdbLocation;
|
||||
Utils::FileName x86GdbserverLocation;
|
||||
Utils::FileName openJDKLocation;
|
||||
Utils::FileName keystoreLocation;
|
||||
unsigned partitionSize;
|
||||
};
|
||||
|
||||
@@ -97,18 +97,18 @@ public:
|
||||
void setConfig(const AndroidConfig &config);
|
||||
QStringList sdkTargets(int minApiLevel = 0) const;
|
||||
QStringList ndkToolchainVersions() const;
|
||||
QString adbToolPath() const;
|
||||
QString androidToolPath() const;
|
||||
QString antToolPath() const;
|
||||
QString emulatorToolPath() const;
|
||||
QString gccPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
QString gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
QString gdbPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
QString openJDKPath() const;
|
||||
QString keytoolPath() const;
|
||||
QString jarsignerPath() const;
|
||||
QString stripPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
QString readelfPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName adbToolPath() const;
|
||||
Utils::FileName androidToolPath() const;
|
||||
Utils::FileName antToolPath() const;
|
||||
Utils::FileName emulatorToolPath() const;
|
||||
Utils::FileName gccPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName gdbPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName openJDKPath() const;
|
||||
Utils::FileName keytoolPath() const;
|
||||
Utils::FileName jarsignerPath() const;
|
||||
Utils::FileName stripPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName readelfPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
QString getDeployDeviceSerialNumber(int *apiLevel) const;
|
||||
bool createAVD(const QString &target, const QString &name, int sdcardSize) const;
|
||||
bool removeAVD(const QString &name) const;
|
||||
@@ -127,8 +127,8 @@ public slots:
|
||||
bool createAVD(int minApiLevel = 0) const;
|
||||
|
||||
private:
|
||||
QString toolPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
QString openJDKBinPath() const;
|
||||
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName openJDKBinPath() const;
|
||||
|
||||
AndroidConfigurations(QObject *parent);
|
||||
void load();
|
||||
|
@@ -56,18 +56,8 @@ enum AndroidQemuStatus {
|
||||
#define ANDROID_BAT_SUFFIX ""
|
||||
#endif
|
||||
|
||||
static const char ANDROID_RC_ID[] = ANDROID_PREFIX;
|
||||
static const QLatin1String ANDROID_RC_ID_PREFIX(ANDROID_PREFIX ".");
|
||||
|
||||
static const QLatin1String AndroidArgumentsKey(ANDROID_PREFIX ".Arguments");
|
||||
static const QLatin1String AndroidSimulatorPathKey(ANDROID_PREFIX ".Simulator");
|
||||
static const QLatin1String AndroidDeviceIdKey(ANDROID_PREFIX ".DeviceId");
|
||||
static const QLatin1String AndroidProFileKey(ANDROID_PREFIX ".ProFile");
|
||||
static const QLatin1String AndroidExportedLocalDirsKey(ANDROID_PREFIX ".ExportedLocalDirs");
|
||||
static const QLatin1String AndroidBaseEnvironmentBaseKey(ANDROID_PREFIX ".BaseEnvironmentBase");
|
||||
static const QLatin1String AndroidUserEnvironmentChangesKey(ANDROID_PREFIX ".UserEnvironmentChanges");
|
||||
static const QLatin1String AndroidUseRemoteGdbKey(ANDROID_PREFIX ".UseRemoteGdb");
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
namespace Constants {
|
||||
@@ -77,8 +67,6 @@ const char ANDROID_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Android", "Androi
|
||||
const char ANDROID_SETTINGS_CATEGORY_ICON[] = ":/android/images/QtAndroid.png";
|
||||
const char ANDROID_TOOLCHAIN_ID[] = "Qt4ProjectManager.ToolChain.Android";
|
||||
const char ANDROIDQT[] = "Qt4ProjectManager.QtVersion.Android";
|
||||
const char ANDROID_PLATFORM[] = "Android";
|
||||
const char ANDROID_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Android");
|
||||
|
||||
}
|
||||
} // namespace Android
|
||||
|
@@ -56,7 +56,7 @@ AndroidCreateKeystoreCertificate::~AndroidCreateKeystoreCertificate()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString AndroidCreateKeystoreCertificate::keystoreFilePath()
|
||||
Utils::FileName AndroidCreateKeystoreCertificate::keystoreFilePath()
|
||||
{
|
||||
return m_keystoreFilePath;
|
||||
}
|
||||
@@ -155,10 +155,10 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
|
||||
if (!ui->countryLineEdit->text().length())
|
||||
ui->countryLineEdit->setFocus();
|
||||
|
||||
m_keystoreFilePath = QFileDialog::getSaveFileName(this, tr("Keystore file name"),
|
||||
m_keystoreFilePath = Utils::FileName::fromString(QFileDialog::getSaveFileName(this, tr("Keystore file name"),
|
||||
QDir::homePath() + QLatin1String("/android_release.keystore"),
|
||||
tr("Keystore files (*.keystore *.jks)"));
|
||||
if (!m_keystoreFilePath.length())
|
||||
tr("Keystore files (*.keystore *.jks)")));
|
||||
if (m_keystoreFilePath.isEmpty())
|
||||
return;
|
||||
QString distinguishedNames(QString::fromLatin1("CN=%1, O=%2, L=%3, C=%4")
|
||||
.arg(ui->commonNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
|
||||
@@ -174,7 +174,7 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
|
||||
|
||||
QStringList params;
|
||||
params << QLatin1String("-genkey") << QLatin1String("-keyalg") << QLatin1String("RSA")
|
||||
<< QLatin1String("-keystore") << m_keystoreFilePath
|
||||
<< QLatin1String("-keystore") << m_keystoreFilePath.toString()
|
||||
<< QLatin1String("-storepass") << ui->keystorePassLineEdit->text()
|
||||
<< QLatin1String("-alias") << ui->aliasNameLineEdit->text()
|
||||
<< QLatin1String("-keysize") << ui->keySizeSpinBox->text()
|
||||
@@ -183,7 +183,7 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
|
||||
<< QLatin1String("-dname") << distinguishedNames;
|
||||
|
||||
QProcess genKeyCertProc;
|
||||
genKeyCertProc.start(AndroidConfigurations::instance().keytoolPath(), params );
|
||||
genKeyCertProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params );
|
||||
|
||||
if (!genKeyCertProc.waitForStarted() || !genKeyCertProc.waitForFinished())
|
||||
return;
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#ifndef ANDROIDCREATEKEYSTORECERTIFICATE_H
|
||||
#define ANDROIDCREATEKEYSTORECERTIFICATE_H
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -54,7 +56,7 @@ class AndroidCreateKeystoreCertificate : public QDialog
|
||||
public:
|
||||
explicit AndroidCreateKeystoreCertificate(QWidget *parent = 0);
|
||||
~AndroidCreateKeystoreCertificate();
|
||||
QString keystoreFilePath();
|
||||
Utils::FileName keystoreFilePath();
|
||||
QString keystorePassword();
|
||||
QString certificateAlias();
|
||||
QString certificatePassword();
|
||||
@@ -68,7 +70,7 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::AndroidCreateKeystoreCertificate *ui;
|
||||
QString m_keystoreFilePath;
|
||||
Utils::FileName m_keystoreFilePath;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -35,17 +35,18 @@
|
||||
#include "androiddeploystep.h"
|
||||
#include "androidglobal.h"
|
||||
#include "androidrunner.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <debugger/debuggerplugin.h>
|
||||
#include <debugger/debuggerrunner.h>
|
||||
#include <debugger/debuggerengine.h>
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||
#include <qt4projectmanager/qt4target.h>
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
#include <qt4projectmanager/qt4nodes.h>
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
@@ -62,6 +63,8 @@ static const char * const qMakeVariables[] = {
|
||||
"QT_INSTALL_IMPORTS"
|
||||
};
|
||||
|
||||
static Qt4Project *project(AndroidRunConfiguration *rc)
|
||||
{ return static_cast<Qt4Project *>(rc->target()->project()); }
|
||||
|
||||
RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *runConfig)
|
||||
{
|
||||
@@ -69,19 +72,20 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
|
||||
params.toolChainAbi = runConfig->abi();
|
||||
params.dumperLibrary = runConfig->dumperLib();
|
||||
params.startMode = AttachToRemoteServer;
|
||||
params.executable = runConfig->androidTarget()->qt4Project()->rootQt4ProjectNode()->buildDir() + QLatin1String("/app_process");
|
||||
params.debuggerCommand = runConfig->gdbCmd();
|
||||
params.executable = project(runConfig)->rootQt4ProjectNode()->buildDir() + QLatin1String("/app_process");
|
||||
params.debuggerCommand = runConfig->gdbCmd().toString();
|
||||
params.remoteChannel = runConfig->remoteChannel();
|
||||
params.displayName = runConfig->androidTarget()->packageName();
|
||||
params.displayName = AndroidManager::packageName(runConfig->target());
|
||||
|
||||
params.solibSearchPath.clear();
|
||||
|
||||
QList<Qt4ProFileNode *> nodes = runConfig->androidTarget()->qt4Project()->allProFiles();
|
||||
QList<Qt4ProFileNode *> nodes = project(runConfig)->allProFiles();
|
||||
foreach (Qt4ProFileNode *node, nodes)
|
||||
if (node->projectType() == ApplicationTemplate)
|
||||
params.solibSearchPath.append(node->targetInformation().buildDir);
|
||||
|
||||
params.solibSearchPath.append(qtSoPaths(runConfig->activeQt4BuildConfiguration()->qtVersion()));
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(runConfig->target()->profile());
|
||||
params.solibSearchPath.append(qtSoPaths(version));
|
||||
|
||||
params.useServerStartScript = true;
|
||||
params.remoteSetupNeeded = true;
|
||||
@@ -148,6 +152,9 @@ void AndroidDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
|
||||
|
||||
QStringList AndroidDebugSupport::qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
|
||||
{
|
||||
if (!qtVersion)
|
||||
return QStringList();
|
||||
|
||||
QSet<QString> paths;
|
||||
for (uint i = 0; i < sizeof qMakeVariables / sizeof qMakeVariables[0]; ++i) {
|
||||
if (!qtVersion->versionInfo().contains(QLatin1String(qMakeVariables[i])))
|
||||
|
@@ -34,13 +34,14 @@
|
||||
#include "androidpackageinstallationstep.h"
|
||||
#include "androidpackagecreationstep.h"
|
||||
#include "androiddeployconfiguration.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
using namespace Android::Internal;
|
||||
|
||||
@@ -64,15 +65,11 @@ AndroidDeployConfiguration::AndroidDeployConfiguration(ProjectExplorer::Target *
|
||||
|
||||
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory(QObject *parent) :
|
||||
ProjectExplorer::DeployConfigurationFactory(parent)
|
||||
{ }
|
||||
{ setObjectName(QLatin1String("AndroidDeployConfigurationFactory"));}
|
||||
|
||||
bool AndroidDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
{
|
||||
AndroidTarget *t = qobject_cast<AndroidTarget *>(parent);
|
||||
if (!t || t->id() != Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
|
||||
|| !id.toString().startsWith(QLatin1String(ANDROID_DEPLOYCONFIGURATION_ID)))
|
||||
return false;
|
||||
return true;
|
||||
return availableCreationIds(parent).contains(id);
|
||||
}
|
||||
|
||||
ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
|
||||
@@ -96,8 +93,7 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::restore
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
AndroidTarget *t = static_cast<AndroidTarget *>(parent);
|
||||
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(t);
|
||||
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent);
|
||||
if (dc->fromMap(map))
|
||||
return dc;
|
||||
|
||||
@@ -107,7 +103,7 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::restore
|
||||
|
||||
bool AndroidDeployConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source) const
|
||||
{
|
||||
if (!qobject_cast<AndroidTarget *>(parent))
|
||||
if (!AndroidManager::supportsAndroid(parent))
|
||||
return false;
|
||||
return source->id() == Core::Id(ANDROID_DEPLOYCONFIGURATION_ID);
|
||||
}
|
||||
@@ -116,24 +112,24 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::clone(P
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
AndroidTarget *t = static_cast<AndroidTarget *>(parent);
|
||||
return new AndroidDeployConfiguration(t, source);
|
||||
return new AndroidDeployConfiguration(parent, source);
|
||||
}
|
||||
|
||||
QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
{
|
||||
AndroidTarget *target = qobject_cast<AndroidTarget *>(parent);
|
||||
if (!target ||
|
||||
target->id() != Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
|
||||
if (!AndroidManager::supportsAndroid(parent))
|
||||
return QList<Core::Id>();
|
||||
|
||||
QList<Core::Id> result;
|
||||
foreach (const QString &id, target->qt4Project()->applicationProFilePathes(QLatin1String(ANDROID_DC_PREFIX)))
|
||||
Qt4ProjectManager::Qt4Project *project = static_cast<Qt4ProjectManager::Qt4Project *>(parent->project());
|
||||
foreach (const QString &id, project->applicationProFilePathes(QLatin1String(ANDROID_DC_PREFIX)))
|
||||
result << Core::Id(id.toUtf8().constData());
|
||||
return result;
|
||||
}
|
||||
|
||||
QString AndroidDeployConfigurationFactory::displayNameForId(const Core::Id/*id*/) const
|
||||
QString AndroidDeployConfigurationFactory::displayNameForId(const Core::Id id) const
|
||||
{
|
||||
if (id.toString().startsWith(ANDROID_DC_PREFIX))
|
||||
return tr("Deploy on Android");
|
||||
return QString();
|
||||
}
|
||||
|
@@ -72,7 +72,6 @@ public:
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
|
||||
// used to translate the ids to names to display to the user
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -37,16 +37,16 @@
|
||||
#include "androidglobal.h"
|
||||
#include "androidpackagecreationstep.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
#include <qt4projectmanager/qt4target.h>
|
||||
#include <qt4projectmanager/qt4nodes.h>
|
||||
|
||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
@@ -85,14 +85,8 @@ void AndroidDeployStep::ctor()
|
||||
|
||||
bool AndroidDeployStep::init()
|
||||
{
|
||||
AndroidTarget *androidTarget = qobject_cast<AndroidTarget *>(target());
|
||||
if (!androidTarget) {
|
||||
raiseError(tr("Cannot deploy: current target is not android."));
|
||||
return false;
|
||||
}
|
||||
const Qt4BuildConfiguration *const bc = androidTarget->activeQt4BuildConfiguration();
|
||||
m_packageName = androidTarget->packageName();
|
||||
const QString targetSDK = androidTarget->targetSDK();
|
||||
m_packageName = AndroidManager::packageName(target());
|
||||
const QString targetSDK = AndroidManager::targetSDK(target());
|
||||
|
||||
writeOutput(tr("Please wait, searching for a suitable device for target:%1.").arg(targetSDK));
|
||||
m_deviceAPILevel = targetSDK.mid(targetSDK.indexOf(QLatin1Char('-')) + 1).toInt();
|
||||
@@ -103,14 +97,15 @@ bool AndroidDeployStep::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bc->qtVersion())
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
|
||||
if (!version)
|
||||
return false;
|
||||
m_qtVersionSourcePath = bc->qtVersion()->sourcePath().toString();
|
||||
m_qtVersionQMakeBuildConfig = bc->qtVersion()->defaultBuildConfig();
|
||||
m_androidDirPath = androidTarget->androidDirPath();
|
||||
m_apkPathDebug = androidTarget->apkPath(AndroidTarget::DebugBuild);
|
||||
m_apkPathRelease = androidTarget->apkPath(AndroidTarget::ReleaseBuildSigned);
|
||||
m_buildDirectory = androidTarget->qt4Project()->rootQt4ProjectNode()->buildDir();
|
||||
m_qtVersionSourcePath = version->sourcePath().toString();
|
||||
m_qtVersionQMakeBuildConfig = version->defaultBuildConfig();
|
||||
m_androidDirPath = AndroidManager::dirPath(target());
|
||||
m_apkPathDebug = AndroidManager::apkPath(target(), AndroidManager::DebugBuild).toString();
|
||||
m_apkPathRelease = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildSigned).toString();
|
||||
m_buildDirectory = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()->buildDir();
|
||||
m_runQASIPackagePath = m_QASIPackagePath;
|
||||
m_runDeployAction = m_deployAction;
|
||||
return true;
|
||||
@@ -205,12 +200,9 @@ int AndroidDeployStep::deviceAPILevel()
|
||||
return m_deviceAPILevel;
|
||||
}
|
||||
|
||||
QString AndroidDeployStep::localLibsRulesFilePath()
|
||||
Utils::FileName AndroidDeployStep::localLibsRulesFilePath()
|
||||
{
|
||||
AndroidTarget *androidTarget = qobject_cast<AndroidTarget *>(target());
|
||||
if (!androidTarget)
|
||||
return QString();
|
||||
return androidTarget->localLibsRulesFilePath();
|
||||
return AndroidManager::localLibsRulesFilePath(target());
|
||||
}
|
||||
|
||||
void AndroidDeployStep::copyLibs(const QString &srcPath, const QString &destPath, QStringList &copiedLibs, const QStringList &filter)
|
||||
@@ -241,7 +233,7 @@ bool AndroidDeployStep::deployPackage()
|
||||
|
||||
if (m_runDeployAction == DeployLocal) {
|
||||
writeOutput(tr("Clean old qt libs"));
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("shell") << QLatin1String("rm") << QLatin1String("-r") << QLatin1String("/data/local/qt"));
|
||||
|
||||
@@ -258,7 +250,7 @@ bool AndroidDeployStep::deployPackage()
|
||||
copyLibs(m_qtVersionSourcePath + QLatin1String("/jar"),
|
||||
tempPath + QLatin1String("/jar"), stripFiles);
|
||||
AndroidPackageCreationStep::stripAndroidLibs(stripFiles, target()->activeRunConfiguration()->abi().architecture());
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("push") << tempPath << QLatin1String("/data/local/qt"));
|
||||
AndroidPackageCreationStep::removeDirectory(tempPath);
|
||||
@@ -266,7 +258,7 @@ bool AndroidDeployStep::deployPackage()
|
||||
}
|
||||
|
||||
if (m_runDeployAction == InstallQASI) {
|
||||
if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
|
||||
if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("install") << QLatin1String("-r ") << m_runQASIPackagePath)) {
|
||||
raiseError(tr("Qt Android smart installer instalation failed"));
|
||||
@@ -276,10 +268,10 @@ bool AndroidDeployStep::deployPackage()
|
||||
}
|
||||
emit resetDelopyAction();
|
||||
}
|
||||
deployProc->setWorkingDirectory(m_androidDirPath);
|
||||
deployProc->setWorkingDirectory(m_androidDirPath.toString());
|
||||
|
||||
writeOutput(tr("Installing package onto %1.").arg(m_deviceSerialNumber));
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("uninstall") << m_packageName);
|
||||
QString package = m_apkPathDebug;
|
||||
|
||||
@@ -287,7 +279,7 @@ bool AndroidDeployStep::deployPackage()
|
||||
&& QFile::exists(m_apkPathRelease))
|
||||
package = m_apkPathRelease;
|
||||
|
||||
if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
|
||||
if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("install") << package)) {
|
||||
raiseError(tr("Package instalation failed"));
|
||||
disconnect(deployProc, 0, this, 0);
|
||||
@@ -296,11 +288,11 @@ bool AndroidDeployStep::deployPackage()
|
||||
}
|
||||
|
||||
writeOutput(tr("Pulling files necessary for debugging"));
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("pull") << QLatin1String("/system/bin/app_process")
|
||||
<< QString::fromLatin1("%1/app_process").arg(m_buildDirectory));
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("pull")
|
||||
<< QLatin1String("/system/lib/libc.so")
|
||||
<< QString::fromLatin1("%1/libc.so").arg(m_buildDirectory));
|
||||
|
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
QString deviceSerialNumber();
|
||||
int deviceAPILevel();
|
||||
QString localLibsRulesFilePath();
|
||||
Utils::FileName localLibsRulesFilePath();
|
||||
|
||||
AndroidDeployAction deployAction();
|
||||
bool useLocalQtLibs();
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
QString m_packageName;
|
||||
QString m_qtVersionSourcePath;
|
||||
QtSupport::BaseQtVersion::QmakeBuildConfigs m_qtVersionQMakeBuildConfig;
|
||||
QString m_androidDirPath;
|
||||
Utils::FileName m_androidDirPath;
|
||||
QString m_apkPathDebug;
|
||||
QString m_apkPathRelease;
|
||||
QString m_buildDirectory;
|
||||
|
@@ -33,11 +33,13 @@
|
||||
#include "androiddeploystepfactory.h"
|
||||
|
||||
#include "androiddeploystep.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -53,27 +55,25 @@ AndroidDeployStepFactory::AndroidDeployStepFactory(QObject *parent)
|
||||
|
||||
QList<Core::Id> AndroidDeployStepFactory::availableCreationIds(BuildStepList *parent) const
|
||||
{
|
||||
if (parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
&& parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
|
||||
&& !parent->contains(AndroidDeployStep::Id))
|
||||
return QList<Core::Id>() << AndroidDeployStep::Id;
|
||||
if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
|
||||
return QList<Core::Id>();
|
||||
if (!AndroidManager::supportsAndroid(parent->target()))
|
||||
return QList<Core::Id>();
|
||||
if (parent->contains(AndroidDeployStep::Id))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << AndroidDeployStep::Id;
|
||||
}
|
||||
|
||||
QString AndroidDeployStepFactory::displayNameForId(const Core::Id id) const
|
||||
{
|
||||
if (id == AndroidDeployStep::Id)
|
||||
return QCoreApplication::translate("Qt4ProjectManager::Internal::AndroidDeployStepFactory",
|
||||
"Deploy to Android device/emulator");
|
||||
return tr("Deploy to Android device/emulator");
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool AndroidDeployStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
|
||||
{
|
||||
return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
&& id == Core::Id(AndroidDeployStep::Id)
|
||||
&& parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
|
||||
&& !parent->contains(AndroidDeployStep::Id);
|
||||
return availableCreationIds(parent).contains(id);
|
||||
}
|
||||
|
||||
BuildStep *AndroidDeployStepFactory::create(BuildStepList *parent, const Core::Id id)
|
||||
|
@@ -110,7 +110,7 @@ void AndroidDeployStepWidget::useLocalQtLibsStateChanged(int state)
|
||||
|
||||
void AndroidDeployStepWidget::editRulesFile()
|
||||
{
|
||||
Core::ICore::instance()->openFiles(QStringList() << m_step->localLibsRulesFilePath(), Core::ICore::SwitchMode);
|
||||
Core::ICore::instance()->openFiles(QStringList() << m_step->localLibsRulesFilePath().toString(), Core::ICore::SwitchMode);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
File diff suppressed because it is too large
Load Diff
177
src/plugins/android/androidmanager.h
Normal file
177
src/plugins/android/androidmanager.h
Normal file
@@ -0,0 +1,177 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ANDROIDMANAGER_H
|
||||
#define ANDROIDMANAGER_H
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QDomDocument>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
namespace ProjectExplorer { class Target; }
|
||||
|
||||
namespace Android {
|
||||
class AndroidPlugin;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class AndroidManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum BuildType
|
||||
{
|
||||
DebugBuild,
|
||||
ReleaseBuildUnsigned,
|
||||
ReleaseBuildSigned
|
||||
};
|
||||
|
||||
static AndroidManager *instance();
|
||||
|
||||
~AndroidManager();
|
||||
|
||||
static bool supportsAndroid(ProjectExplorer::Target *target);
|
||||
|
||||
static QString packageName(ProjectExplorer::Target *target);
|
||||
static bool setPackageName(ProjectExplorer::Target *target, const QString &name);
|
||||
|
||||
static QString applicationName(ProjectExplorer::Target *target);
|
||||
static bool setApplicationName(ProjectExplorer::Target *target, const QString &name);
|
||||
|
||||
static QStringList permissions(ProjectExplorer::Target *target);
|
||||
static bool setPermissions(ProjectExplorer::Target *target, const QStringList &permissions);
|
||||
|
||||
static QString intentName(ProjectExplorer::Target *target);
|
||||
static QString activityName(ProjectExplorer::Target *target);
|
||||
|
||||
static int versionCode(ProjectExplorer::Target *target);
|
||||
static bool setVersionCode(ProjectExplorer::Target *target, int version);
|
||||
static QString versionName(ProjectExplorer::Target *target);
|
||||
static bool setVersionName(ProjectExplorer::Target *target, const QString &version);
|
||||
|
||||
static QIcon highDpiIcon(ProjectExplorer::Target *target);
|
||||
static bool setHighDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath);
|
||||
static QIcon mediumDpiIcon(ProjectExplorer::Target *target);
|
||||
static bool setMediumDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath);
|
||||
static QIcon lowDpiIcon(ProjectExplorer::Target *target);
|
||||
static bool setLowDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath);
|
||||
|
||||
static QStringList availableTargetApplications(ProjectExplorer::Target *target);
|
||||
static QString targetApplication(ProjectExplorer::Target *target);
|
||||
static bool setTargetApplication(ProjectExplorer::Target *target, const QString &name);
|
||||
static QString targetApplicationPath(ProjectExplorer::Target *target);
|
||||
|
||||
static QString targetSDK(ProjectExplorer::Target *target);
|
||||
static bool setTargetSDK(ProjectExplorer::Target *target, const QString &sdk);
|
||||
|
||||
static Utils::FileName dirPath(ProjectExplorer::Target *target);
|
||||
static Utils::FileName manifestPath(ProjectExplorer::Target *target);
|
||||
static Utils::FileName libsPath(ProjectExplorer::Target *target);
|
||||
static Utils::FileName stringsPath(ProjectExplorer::Target *target);
|
||||
static Utils::FileName defaultPropertiesPath(ProjectExplorer::Target *target);
|
||||
static Utils::FileName srcPath(ProjectExplorer::Target *target);
|
||||
static Utils::FileName apkPath(ProjectExplorer::Target *target, BuildType buildType);
|
||||
|
||||
static bool createAndroidTemplatesIfNecessary(ProjectExplorer::Target *target);
|
||||
static void updateTarget(ProjectExplorer::Target *target, const QString &targetSDK,
|
||||
const QString &name = QString());
|
||||
|
||||
static Utils::FileName localLibsRulesFilePath(ProjectExplorer::Target *target);
|
||||
static QString loadLocalLibs(ProjectExplorer::Target *target, int apiLevel);
|
||||
static QString loadLocalJars(ProjectExplorer::Target *target, int apiLevel);
|
||||
|
||||
static QStringList availableQtLibs(ProjectExplorer::Target *target);
|
||||
static QStringList qtLibs(ProjectExplorer::Target *target);
|
||||
static bool setQtLibs(ProjectExplorer::Target *target, const QStringList &libs);
|
||||
|
||||
static QStringList availablePrebundledLibs(ProjectExplorer::Target *target);
|
||||
static QStringList prebundledLibs(ProjectExplorer::Target *target);
|
||||
static bool setPrebundledLibs(ProjectExplorer::Target *target, const QStringList &libs);
|
||||
|
||||
private:
|
||||
explicit AndroidManager(QObject *parent = 0);
|
||||
|
||||
static void raiseError(const QString &reason);
|
||||
static bool openXmlFile(ProjectExplorer::Target *target, QDomDocument &doc,
|
||||
const Utils::FileName &fileName, bool createAndroidTemplates = false);
|
||||
static bool saveXmlFile(ProjectExplorer::Target *target, QDomDocument &doc, const Utils::FileName &fileName);
|
||||
static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
|
||||
static bool saveManifest(ProjectExplorer::Target *target, QDomDocument &doc);
|
||||
static bool openLibsXml(ProjectExplorer::Target *target, QDomDocument &doc);
|
||||
static bool saveLibsXml(ProjectExplorer::Target *target, QDomDocument &doc);
|
||||
static QStringList libsXml(ProjectExplorer::Target *target, const QString &tag);
|
||||
static bool setLibsXml(ProjectExplorer::Target *target, const QStringList &libs, const QString &tag);
|
||||
|
||||
enum ItemType
|
||||
{
|
||||
Lib,
|
||||
Jar
|
||||
};
|
||||
static QString loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType item);
|
||||
|
||||
class Library
|
||||
{
|
||||
public:
|
||||
Library()
|
||||
{ level = -1; }
|
||||
int level;
|
||||
QStringList dependencies;
|
||||
QString name;
|
||||
};
|
||||
typedef QMap<QString, Library> LibrariesMap;
|
||||
|
||||
enum IconType
|
||||
{
|
||||
HighDPI,
|
||||
MediumDPI,
|
||||
LowDPI
|
||||
};
|
||||
static QString iconPath(ProjectExplorer::Target *target, IconType type);
|
||||
static QIcon icon(ProjectExplorer::Target *target, IconType type);
|
||||
static bool setIcon(ProjectExplorer::Target *target, IconType type, const QString &iconFileName);
|
||||
|
||||
static QStringList dependencies(const Utils::FileName &readelfPath, const QString &lib);
|
||||
static int setLibraryLevel(const QString &library, LibrariesMap &mapLibs);
|
||||
static bool qtLibrariesLessThan(const Library &a, const Library &b);
|
||||
|
||||
static AndroidManager *m_instance;
|
||||
|
||||
friend class Android::AndroidPlugin;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
#endif // ANDROIDMANAGER_H
|
@@ -33,11 +33,14 @@
|
||||
#include "androidpackagecreationfactory.h"
|
||||
|
||||
#include "androidpackagecreationstep.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -54,11 +57,13 @@ AndroidPackageCreationFactory::AndroidPackageCreationFactory(QObject *parent)
|
||||
|
||||
QList<Core::Id> AndroidPackageCreationFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
|
||||
{
|
||||
if (parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
&& parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
|
||||
&& !parent->contains(AndroidPackageCreationStep::CreatePackageId))
|
||||
return QList<Core::Id>() << AndroidPackageCreationStep::CreatePackageId;
|
||||
if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
|
||||
return QList<Core::Id>();
|
||||
if (!AndroidManager::supportsAndroid(parent->target()))
|
||||
return QList<Core::Id>();
|
||||
if (parent->contains(AndroidPackageCreationStep::CreatePackageId))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << AndroidPackageCreationStep::CreatePackageId;
|
||||
}
|
||||
|
||||
QString AndroidPackageCreationFactory::displayNameForId(const Core::Id id) const
|
||||
@@ -71,10 +76,7 @@ QString AndroidPackageCreationFactory::displayNameForId(const Core::Id id) const
|
||||
|
||||
bool AndroidPackageCreationFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
|
||||
{
|
||||
return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
&& id == Core::Id(AndroidPackageCreationStep::CreatePackageId)
|
||||
&& parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
|
||||
&& !parent->contains(AndroidPackageCreationStep::CreatePackageId);
|
||||
return availableCreationIds(parent).contains(id);
|
||||
}
|
||||
|
||||
BuildStep *AndroidPackageCreationFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
|
||||
|
@@ -36,15 +36,15 @@
|
||||
#include "androiddeploystep.h"
|
||||
#include "androidglobal.h"
|
||||
#include "androidpackagecreationwidget.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
#include <qt4projectmanager/qt4nodes.h>
|
||||
#include <qt4projectmanager/qt4target.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/fileutils.h>
|
||||
@@ -142,35 +142,35 @@ void AndroidPackageCreationStep::ctor()
|
||||
|
||||
bool AndroidPackageCreationStep::init()
|
||||
{
|
||||
AndroidTarget *target = androidTarget();
|
||||
const Qt4BuildConfiguration *bc = target->activeQt4BuildConfiguration();
|
||||
if (!target) {
|
||||
raiseError(tr("Cannot create android package: current target is not android."));
|
||||
const Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
|
||||
if (!bc) {
|
||||
raiseError(tr("Cannot create android package: current build configuration is not Qt4."));
|
||||
return false;
|
||||
}
|
||||
m_outputParser.setProjectFileList(target->qt4Project()->files(Project::AllFiles));
|
||||
Qt4Project *project = static_cast<Qt4Project *>(target()->project());
|
||||
m_outputParser.setProjectFileList(project->files(Project::AllFiles));
|
||||
|
||||
// Copying
|
||||
m_androidDir = target->androidDirPath();
|
||||
QString androidLibPath;
|
||||
if (target->qt4Project()->rootQt4ProjectNode()->variableValue(Qt4ProjectManager::ConfigVar).contains(QLatin1String("x86")))
|
||||
androidLibPath = m_androidDir + QLatin1String("/libs/x86");
|
||||
else if (target->qt4Project()->rootQt4ProjectNode()
|
||||
m_androidDir = AndroidManager::dirPath(target());
|
||||
Utils::FileName androidLibPath;
|
||||
if (project->rootQt4ProjectNode()->variableValue(Qt4ProjectManager::ConfigVar).contains(QLatin1String("x86")))
|
||||
androidLibPath = m_androidDir.appendPath(QLatin1String("libs/x86"));
|
||||
else if (project->rootQt4ProjectNode()
|
||||
->variableValue(Qt4ProjectManager::ConfigVar).contains(QLatin1String("armeabi-v7a")))
|
||||
androidLibPath = m_androidDir + QLatin1String("/libs/armeabi-v7a");
|
||||
androidLibPath = m_androidDir.appendPath(QLatin1String("libs/armeabi-v7a"));
|
||||
else
|
||||
androidLibPath = m_androidDir + QLatin1String("/libs/armeabi");
|
||||
m_gdbServerDestination = androidLibPath + QLatin1String("/gdbserver");
|
||||
m_gdbServerSource = AndroidConfigurations::instance().gdbServerPath(target->activeRunConfiguration()->abi().architecture());
|
||||
androidLibPath = m_androidDir.appendPath(QLatin1String("libs/armeabi"));
|
||||
m_gdbServerDestination = androidLibPath.appendPath(QLatin1String("gdbserver"));
|
||||
m_gdbServerSource = AndroidConfigurations::instance().gdbServerPath(target()->activeRunConfiguration()->abi().architecture());
|
||||
m_debugBuild = bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
|
||||
|
||||
if (!target->createAndroidTemplatesIfNecessary())
|
||||
if (!AndroidManager::createAndroidTemplatesIfNecessary(target()))
|
||||
return false;
|
||||
|
||||
target->updateProject(target->targetSDK(), target->applicationName());
|
||||
AndroidManager::updateTarget(target(), AndroidManager::targetSDK(target()), AndroidManager::applicationName(target()));
|
||||
m_antToolPath = AndroidConfigurations::instance().antToolPath();
|
||||
m_apkPathUnsigned = target->apkPath(AndroidTarget::ReleaseBuildUnsigned);
|
||||
m_apkPathSigned = target->apkPath(AndroidTarget::ReleaseBuildSigned);
|
||||
m_apkPathUnsigned = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildUnsigned);
|
||||
m_apkPathSigned = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildSigned);
|
||||
m_keystorePathForRun = m_keystorePath;
|
||||
m_certificatePasswdForRun = m_certificatePasswd;
|
||||
m_jarSigner = AndroidConfigurations::instance().jarsignerPath();
|
||||
@@ -188,15 +188,10 @@ BuildStepConfigWidget *AndroidPackageCreationStep::createConfigWidget()
|
||||
return new AndroidPackageCreationWidget(this);
|
||||
}
|
||||
|
||||
AndroidTarget *AndroidPackageCreationStep::androidTarget() const
|
||||
{
|
||||
return qobject_cast<AndroidTarget *>(target());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationStep::checkRequiredLibraries()
|
||||
{
|
||||
QProcess readelfProc;
|
||||
QString appPath = androidTarget()->targetApplicationPath();
|
||||
QString appPath = AndroidManager::targetApplicationPath(target());
|
||||
if (!QFile::exists(appPath)) {
|
||||
raiseError(tr("Cannot find read elf information"),
|
||||
tr("Cannot find '%1'.\n"
|
||||
@@ -204,7 +199,7 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
|
||||
"built successfully and is selected in Application tab ('Run option') ").arg(appPath));
|
||||
return;
|
||||
}
|
||||
readelfProc.start(AndroidConfigurations::instance().readelfPath(androidTarget()->activeRunConfiguration()->abi().architecture()),
|
||||
readelfProc.start(AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture()).toString(),
|
||||
QStringList() << QLatin1String("-d") << QLatin1String("-W") << appPath);
|
||||
if (!readelfProc.waitForFinished(-1)) {
|
||||
readelfProc.terminate();
|
||||
@@ -218,44 +213,44 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
|
||||
libs << QString::fromLatin1(line.mid(pos, line.length() - pos - 1));
|
||||
}
|
||||
}
|
||||
QStringList checkedLibs = androidTarget()->qtLibs();
|
||||
QStringList checkedLibs = AndroidManager::qtLibs(target());
|
||||
QStringList requiredLibraries;
|
||||
foreach (const QString &qtLib, androidTarget()->availableQtLibs()) {
|
||||
foreach (const QString &qtLib, AndroidManager::availableQtLibs(target())) {
|
||||
if (libs.contains(QLatin1String("lib") + qtLib + QLatin1String(".so")) || checkedLibs.contains(qtLib))
|
||||
requiredLibraries << qtLib;
|
||||
}
|
||||
androidTarget()->setQtLibs(requiredLibraries);
|
||||
AndroidManager::setQtLibs(target(), requiredLibraries);
|
||||
|
||||
checkedLibs = androidTarget()->prebundledLibs();
|
||||
checkedLibs = AndroidManager::prebundledLibs(target());
|
||||
requiredLibraries.clear();
|
||||
foreach (const QString &qtLib, androidTarget()->availableQtLibs()) {
|
||||
foreach (const QString &qtLib, AndroidManager::availableQtLibs(target())) {
|
||||
if (libs.contains(qtLib) || checkedLibs.contains(qtLib))
|
||||
requiredLibraries << qtLib;
|
||||
}
|
||||
androidTarget()->setPrebundledLibs(requiredLibraries);
|
||||
AndroidManager::setPrebundledLibs(target(), requiredLibraries);
|
||||
emit updateRequiredLibrariesModels();
|
||||
}
|
||||
|
||||
void AndroidPackageCreationStep::initCheckRequiredLibrariesForRun()
|
||||
{
|
||||
m_appPath = androidTarget()->targetApplicationPath();
|
||||
m_readElf = AndroidConfigurations::instance().readelfPath(androidTarget()->activeRunConfiguration()->abi().architecture());
|
||||
m_qtLibs = androidTarget()->qtLibs();
|
||||
m_availableQtLibs = androidTarget()->availableQtLibs();
|
||||
m_prebundledLibs = androidTarget()->prebundledLibs();
|
||||
m_appPath = Utils::FileName::fromString(AndroidManager::targetApplicationPath(target()));
|
||||
m_readElf = AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture());
|
||||
m_qtLibs = AndroidManager::qtLibs(target());
|
||||
m_availableQtLibs = AndroidManager::availableQtLibs(target());
|
||||
m_prebundledLibs = AndroidManager::prebundledLibs(target());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationStep::checkRequiredLibrariesForRun()
|
||||
{
|
||||
QProcess readelfProc;
|
||||
if (!QFile::exists(m_appPath)) {
|
||||
raiseError(tr("Cannot find read elf information"),
|
||||
if (!m_appPath.toFileInfo().exists()) {
|
||||
raiseError(tr("Can't find read elf information"),
|
||||
tr("Can't find '%1'.\n"
|
||||
"Please make sure your application is "
|
||||
"built successfully and is selected in Application tab ('Run option') ").arg(m_appPath));
|
||||
"built successfully and is selected in Application tab ('Run option') ").arg(m_appPath.toUserOutput()));
|
||||
return;
|
||||
}
|
||||
readelfProc.start(m_readElf, QStringList() << QLatin1String("-d") << QLatin1String("-W") << m_appPath);
|
||||
readelfProc.start(m_readElf.toString(), QStringList() << QLatin1String("-d") << QLatin1String("-W") << m_appPath.toUserOutput());
|
||||
if (!readelfProc.waitForFinished(-1)) {
|
||||
readelfProc.terminate();
|
||||
return;
|
||||
@@ -290,20 +285,20 @@ void AndroidPackageCreationStep::checkRequiredLibrariesForRun()
|
||||
|
||||
void AndroidPackageCreationStep::setQtLibs(const QStringList &qtLibs)
|
||||
{
|
||||
androidTarget()->setQtLibs(qtLibs);
|
||||
AndroidManager::setQtLibs(target(), qtLibs);
|
||||
}
|
||||
|
||||
void AndroidPackageCreationStep::setPrebundledLibs(const QStringList &prebundledLibs)
|
||||
{
|
||||
androidTarget()->setPrebundledLibs(prebundledLibs);
|
||||
AndroidManager::setPrebundledLibs(target(), prebundledLibs);
|
||||
}
|
||||
|
||||
QString AndroidPackageCreationStep::keystorePath()
|
||||
Utils::FileName AndroidPackageCreationStep::keystorePath()
|
||||
{
|
||||
return m_keystorePath;
|
||||
}
|
||||
|
||||
void AndroidPackageCreationStep::setKeystorePath(const QString &path)
|
||||
void AndroidPackageCreationStep::setKeystorePath(const Utils::FileName &path)
|
||||
{
|
||||
m_keystorePath = path;
|
||||
m_certificatePasswd.clear();
|
||||
@@ -336,13 +331,13 @@ QAbstractItemModel *AndroidPackageCreationStep::keystoreCertificates()
|
||||
QProcess keytoolProc;
|
||||
while (!rawCerts.length() || !m_keystorePasswd.length()) {
|
||||
QStringList params;
|
||||
params << QLatin1String("-list") << QLatin1String("-v") << QLatin1String("-keystore") << m_keystorePathForRun << QLatin1String("-storepass");
|
||||
params << QLatin1String("-list") << QLatin1String("-v") << QLatin1String("-keystore") << m_keystorePathForRun.toUserOutput() << QLatin1String("-storepass");
|
||||
if (!m_keystorePasswd.length())
|
||||
keystorePassword();
|
||||
if (!m_keystorePasswd.length())
|
||||
return 0;
|
||||
params << m_keystorePasswd;
|
||||
keytoolProc.start(AndroidConfigurations::instance().keytoolPath(), params);
|
||||
keytoolProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params);
|
||||
if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
|
||||
QMessageBox::critical(0, tr("Error"),
|
||||
tr("Failed to run keytool"));
|
||||
@@ -363,14 +358,14 @@ bool AndroidPackageCreationStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!BuildStep::fromMap(map))
|
||||
return false;
|
||||
m_keystorePath = map.value(KeystoreLocationKey).toString();
|
||||
m_keystorePath = Utils::FileName::fromString(map.value(KeystoreLocationKey).toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap AndroidPackageCreationStep::toMap() const
|
||||
{
|
||||
QVariantMap map(BuildStep::toMap());
|
||||
map.insert(KeystoreLocationKey, m_keystorePath);
|
||||
map.insert(KeystoreLocationKey, m_keystorePath.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -382,12 +377,12 @@ bool AndroidPackageCreationStep::createPackage()
|
||||
|
||||
QStringList build;
|
||||
build << QLatin1String("clean");
|
||||
QFile::remove(m_gdbServerDestination);
|
||||
QFile::remove(m_gdbServerDestination.toString());
|
||||
if (m_debugBuild || !m_certificateAlias.length()) {
|
||||
build << QLatin1String("debug");
|
||||
if (!QFile::copy(m_gdbServerSource, m_gdbServerDestination)) {
|
||||
raiseError(tr("Cannot copy gdbserver from '%1' to '%2'").arg(m_gdbServerSource)
|
||||
.arg(m_gdbServerDestination));
|
||||
if (!QFile::copy(m_gdbServerSource.toString(), m_gdbServerDestination.toString())) {
|
||||
raiseError(tr("Can't copy gdbserver from '%1' to '%2'").arg(m_gdbServerSource.toUserOutput())
|
||||
.arg(m_gdbServerDestination.toUserOutput()));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -403,9 +398,9 @@ bool AndroidPackageCreationStep::createPackage()
|
||||
connect(buildProc, SIGNAL(readyReadStandardError()), this,
|
||||
SLOT(handleBuildStdErrOutput()));
|
||||
|
||||
buildProc->setWorkingDirectory(m_androidDir);
|
||||
buildProc->setWorkingDirectory(m_androidDir.toString());
|
||||
|
||||
if (!runCommand(buildProc, m_antToolPath, build)) {
|
||||
if (!runCommand(buildProc, m_antToolPath.toString(), build)) {
|
||||
disconnect(buildProc, 0, this, 0);
|
||||
buildProc->deleteLater();
|
||||
return false;
|
||||
@@ -425,11 +420,11 @@ bool AndroidPackageCreationStep::createPackage()
|
||||
|
||||
QByteArray keyPass = m_certificatePasswdForRun.toUtf8();
|
||||
build.clear();
|
||||
build << QLatin1String("-verbose") << QLatin1String("-keystore") << m_keystorePathForRun
|
||||
build << QLatin1String("-verbose") << QLatin1String("-keystore") << m_keystorePathForRun.toUserOutput()
|
||||
<< QLatin1String("-storepass") << m_keystorePasswd
|
||||
<< m_apkPathUnsigned
|
||||
<< m_apkPathUnsigned.toUserOutput()
|
||||
<< m_certificateAlias;
|
||||
buildProc->start(m_jarSigner, build); //TODO
|
||||
buildProc->start(m_jarSigner.toString(), build); //TODO
|
||||
if (!buildProc->waitForStarted()) {
|
||||
disconnect(buildProc, 0, this, 0);
|
||||
buildProc->deleteLater();
|
||||
@@ -446,9 +441,9 @@ bool AndroidPackageCreationStep::createPackage()
|
||||
emit addOutput(tr("Failed, try again"), ErrorMessageOutput);
|
||||
m_certificatePasswdForRun.clear();
|
||||
}
|
||||
if (QFile::rename(m_apkPathUnsigned, m_apkPathSigned)) {
|
||||
if (QFile::rename(m_apkPathUnsigned.toString(), m_apkPathSigned.toString())) {
|
||||
emit addOutput(tr("Release signed package created to %1")
|
||||
.arg(m_apkPathSigned)
|
||||
.arg(m_apkPathSigned.toUserOutput())
|
||||
, MessageOutput);
|
||||
|
||||
if (m_openPackageLocation)
|
||||
@@ -465,7 +460,8 @@ void AndroidPackageCreationStep::stripAndroidLibs(const QStringList & files, Abi
|
||||
{
|
||||
QProcess stripProcess;
|
||||
foreach (const QString &file, files) {
|
||||
stripProcess.start(AndroidConfigurations::instance().stripPath(architecture), QStringList()<<QLatin1String("--strip-unneeded") << file);
|
||||
stripProcess.start(AndroidConfigurations::instance().stripPath(architecture).toString(),
|
||||
QStringList()<<QLatin1String("--strip-unneeded") << file);
|
||||
stripProcess.waitForStarted();
|
||||
if (!stripProcess.waitForFinished())
|
||||
stripProcess.terminate();
|
||||
@@ -573,7 +569,7 @@ void AndroidPackageCreationStep::certificatePassword()
|
||||
|
||||
void AndroidPackageCreationStep::showInGraphicalShell()
|
||||
{
|
||||
Core::FileUtils::showInGraphicalShell(Core::ICore::instance()->mainWindow(), m_apkPathSigned);
|
||||
Core::FileUtils::showInGraphicalShell(Core::ICore::instance()->mainWindow(), m_apkPathSigned.toString());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationStep::raiseError(const QString &shortMsg,
|
||||
|
@@ -50,7 +50,6 @@ class Qt4BuildConfiguration;
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
class AndroidTarget;
|
||||
|
||||
class AndroidPackageCreationStep : public ProjectExplorer::BuildStep
|
||||
{
|
||||
@@ -66,14 +65,12 @@ public:
|
||||
|
||||
static const QLatin1String DefaultVersionNumber;
|
||||
|
||||
AndroidTarget *androidTarget() const;
|
||||
|
||||
void checkRequiredLibraries();
|
||||
void initCheckRequiredLibrariesForRun();
|
||||
void checkRequiredLibrariesForRun();
|
||||
|
||||
QString keystorePath();
|
||||
void setKeystorePath(const QString &path);
|
||||
Utils::FileName keystorePath();
|
||||
void setKeystorePath(const Utils::FileName &path);
|
||||
void setKeystorePassword(const QString &pwd);
|
||||
void setCertificateAlias(const QString &alias);
|
||||
void setCertificatePassword(const QString &pwd);
|
||||
@@ -110,7 +107,7 @@ private:
|
||||
static const Core::Id CreatePackageId;
|
||||
|
||||
private:
|
||||
QString m_keystorePath;
|
||||
Utils::FileName m_keystorePath;
|
||||
QString m_keystorePasswd;
|
||||
QString m_certificateAlias;
|
||||
QString m_certificatePasswd;
|
||||
@@ -118,19 +115,19 @@ private:
|
||||
JavaParser m_outputParser;
|
||||
|
||||
// members to pass data from init() to run()
|
||||
QString m_androidDir;
|
||||
QString m_gdbServerSource;
|
||||
QString m_gdbServerDestination;
|
||||
Utils::FileName m_androidDir;
|
||||
Utils::FileName m_gdbServerSource;
|
||||
Utils::FileName m_gdbServerDestination;
|
||||
bool m_debugBuild;
|
||||
QString m_antToolPath;
|
||||
QString m_apkPathUnsigned;
|
||||
QString m_apkPathSigned;
|
||||
QString m_keystorePathForRun;
|
||||
Utils::FileName m_antToolPath;
|
||||
Utils::FileName m_apkPathUnsigned;
|
||||
Utils::FileName m_apkPathSigned;
|
||||
Utils::FileName m_keystorePathForRun;
|
||||
QString m_certificatePasswdForRun;
|
||||
QString m_jarSigner;
|
||||
Utils::FileName m_jarSigner;
|
||||
// more for checkLibraries
|
||||
QString m_appPath;
|
||||
QString m_readElf;
|
||||
Utils::FileName m_appPath;
|
||||
Utils::FileName m_readElf;
|
||||
QStringList m_qtLibs;
|
||||
QStringList m_availableQtLibs;
|
||||
QStringList m_prebundledLibs;
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include "androidpackagecreationstep.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidcreatekeystorecertificate.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
#include "ui_androidpackagecreationwidget.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace Android {
|
||||
@@ -203,7 +204,8 @@ int PermissionsModel::rowCount(const QModelIndex &parent) const
|
||||
AndroidPackageCreationWidget::AndroidPackageCreationWidget(AndroidPackageCreationStep *step)
|
||||
: ProjectExplorer::BuildStepConfigWidget(),
|
||||
m_step(step),
|
||||
m_ui(new Ui::AndroidPackageCreationWidget)
|
||||
m_ui(new Ui::AndroidPackageCreationWidget),
|
||||
m_fileSystemWatcher(new QFileSystemWatcher(this))
|
||||
{
|
||||
m_qtLibsModel = new CheckModel(this);
|
||||
m_prebundledLibs = new CheckModel(this);
|
||||
@@ -219,10 +221,16 @@ AndroidPackageCreationWidget::AndroidPackageCreationWidget(AndroidPackageCreatio
|
||||
void AndroidPackageCreationWidget::initGui()
|
||||
{
|
||||
updateAndroidProjectInfo();
|
||||
AndroidTarget *target = m_step->androidTarget();
|
||||
connect(target,
|
||||
SIGNAL(androidDirContentsChanged()),
|
||||
this, SLOT(updateAndroidProjectInfo()));
|
||||
ProjectExplorer::Target *target = m_step->target();
|
||||
|
||||
m_fileSystemWatcher->addPath(AndroidManager::dirPath(target).toString());
|
||||
m_fileSystemWatcher->addPath(AndroidManager::manifestPath(target).toString());
|
||||
m_fileSystemWatcher->addPath(AndroidManager::srcPath(target).toString());
|
||||
connect(m_fileSystemWatcher, SIGNAL(directoryChanged(QString)),
|
||||
this, SIGNAL(updateAndroidProjectInfo()));
|
||||
connect(m_fileSystemWatcher, SIGNAL(fileChanged(QString)), this,
|
||||
SIGNAL(updateAndroidProjectInfo()));
|
||||
|
||||
m_ui->packageNameLineEdit->setValidator(new QRegExpValidator(QRegExp(packageNameRegExp), this));
|
||||
connect(m_ui->packageNameLineEdit, SIGNAL(editingFinished()), SLOT(setPackageName()));
|
||||
connect(m_ui->appNameLineEdit, SIGNAL(editingFinished()), SLOT(setApplicationName()));
|
||||
@@ -251,49 +259,50 @@ void AndroidPackageCreationWidget::initGui()
|
||||
m_ui->qtLibsListView->setModel(m_qtLibsModel);
|
||||
m_ui->prebundledLibsListView->setModel(m_prebundledLibs);
|
||||
m_ui->permissionsListView->setModel(m_permissionsModel);
|
||||
m_ui->KeystoreLocationLineEdit->setText(m_step->keystorePath());
|
||||
m_ui->KeystoreLocationLineEdit->setText(m_step->keystorePath().toUserOutput());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::updateAndroidProjectInfo()
|
||||
{
|
||||
AndroidTarget *target = m_step->androidTarget();
|
||||
ProjectExplorer::Target *target = m_step->target();
|
||||
const QString packageName = AndroidManager::packageName(target);
|
||||
m_ui->targetSDKComboBox->clear();
|
||||
QStringList targets = AndroidConfigurations::instance().sdkTargets();
|
||||
m_ui->targetSDKComboBox->addItems(targets);
|
||||
m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(target->targetSDK()));
|
||||
m_ui->packageNameLineEdit->setText(target->packageName());
|
||||
m_ui->appNameLineEdit->setText(target->applicationName());
|
||||
m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(AndroidManager::targetSDK(target)));
|
||||
m_ui->packageNameLineEdit->setText(packageName);
|
||||
m_ui->appNameLineEdit->setText(AndroidManager::applicationName(target));
|
||||
if (!m_ui->appNameLineEdit->text().length()) {
|
||||
QString applicationName = target->project()->displayName();
|
||||
target->setPackageName(target->packageName() + QLatin1Char('.') + applicationName);
|
||||
m_ui->packageNameLineEdit->setText(target->packageName());
|
||||
if (applicationName.length())
|
||||
AndroidManager::setPackageName(target, packageName + QLatin1Char('.') + applicationName);
|
||||
m_ui->packageNameLineEdit->setText(packageName);
|
||||
if (!applicationName.isEmpty())
|
||||
applicationName[0] = applicationName[0].toUpper();
|
||||
m_ui->appNameLineEdit->setText(applicationName);
|
||||
target->setApplicationName(applicationName);
|
||||
AndroidManager::setApplicationName(target, applicationName);
|
||||
}
|
||||
m_ui->versionCode->setValue(target->versionCode());
|
||||
m_ui->versionNameLinedit->setText(target->versionName());
|
||||
m_ui->versionCode->setValue(AndroidManager::versionCode(target));
|
||||
m_ui->versionNameLinedit->setText(AndroidManager::versionName(target));
|
||||
|
||||
m_qtLibsModel->setAvailableItems(target->availableQtLibs());
|
||||
m_qtLibsModel->setCheckedItems(target->qtLibs());
|
||||
m_prebundledLibs->setAvailableItems(target->availablePrebundledLibs());
|
||||
m_prebundledLibs->setCheckedItems(target->prebundledLibs());
|
||||
m_qtLibsModel->setAvailableItems(AndroidManager::availableQtLibs(target));
|
||||
m_qtLibsModel->setCheckedItems(AndroidManager::qtLibs(target));
|
||||
m_prebundledLibs->setAvailableItems(AndroidManager::availablePrebundledLibs(target));
|
||||
m_prebundledLibs->setCheckedItems(AndroidManager::prebundledLibs(target));
|
||||
|
||||
m_permissionsModel->setPermissions(target->permissions());
|
||||
m_permissionsModel->setPermissions(AndroidManager::permissions(target));
|
||||
m_ui->removePermissionButton->setEnabled(m_permissionsModel->permissions().size());
|
||||
|
||||
targets = target->availableTargetApplications();
|
||||
targets = AndroidManager::availableTargetApplications(target);
|
||||
m_ui->targetComboBox->clear();
|
||||
m_ui->targetComboBox->addItems(targets);
|
||||
m_ui->targetComboBox->setCurrentIndex(targets.indexOf(target->targetApplication()));
|
||||
m_ui->targetComboBox->setCurrentIndex(targets.indexOf(AndroidManager::targetApplication(target)));
|
||||
if (m_ui->targetComboBox->currentIndex() == -1 && targets.count()) {
|
||||
m_ui->targetComboBox->setCurrentIndex(0);
|
||||
target->setTargetApplication(m_ui->targetComboBox->currentText());
|
||||
AndroidManager::setTargetApplication(target, m_ui->targetComboBox->currentText());
|
||||
}
|
||||
m_ui->hIconButton->setIcon(target->highDpiIcon());
|
||||
m_ui->mIconButton->setIcon(target->mediumDpiIcon());
|
||||
m_ui->lIconButton->setIcon(target->lowDpiIcon());
|
||||
m_ui->hIconButton->setIcon(AndroidManager::highDpiIcon(target));
|
||||
m_ui->mIconButton->setIcon(AndroidManager::mediumDpiIcon(target));
|
||||
m_ui->lIconButton->setIcon(AndroidManager::lowDpiIcon(target));
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setPackageName()
|
||||
@@ -308,26 +317,27 @@ void AndroidPackageCreationWidget::setPackageName()
|
||||
m_ui->packageNameLineEdit->setFocus();
|
||||
return;
|
||||
}
|
||||
m_step->androidTarget()->setPackageName(packageName);
|
||||
AndroidManager::setPackageName(m_step->target(), packageName);
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setApplicationName()
|
||||
{
|
||||
m_step->androidTarget()->setApplicationName(m_ui->appNameLineEdit->text());
|
||||
AndroidManager::setApplicationName(m_step->target(), m_ui->appNameLineEdit->text());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setTargetSDK(const QString &target)
|
||||
void AndroidPackageCreationWidget::setTargetSDK(const QString &sdk)
|
||||
{
|
||||
m_step->androidTarget()->setTargetSDK(target);
|
||||
Qt4BuildConfiguration *bc = m_step->androidTarget()->activeQt4BuildConfiguration();
|
||||
ProjectExplorer::BuildManager *bm = ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager();
|
||||
AndroidManager::setTargetSDK(m_step->target(), sdk);
|
||||
Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(m_step->target()->activeBuildConfiguration());
|
||||
if (!bc)
|
||||
return;
|
||||
QMakeStep *qs = bc->qmakeStep();
|
||||
|
||||
if (!qs)
|
||||
return;
|
||||
|
||||
qs->setForced(true);
|
||||
|
||||
ProjectExplorer::BuildManager *bm = ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager();
|
||||
bm->buildList(bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)),
|
||||
ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)));
|
||||
bm->appendStep(qs, ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)));
|
||||
@@ -341,27 +351,27 @@ void AndroidPackageCreationWidget::setTargetSDK(const QString &target)
|
||||
|
||||
void AndroidPackageCreationWidget::setVersionCode()
|
||||
{
|
||||
m_step->androidTarget()->setVersionCode(m_ui->versionCode->value());
|
||||
AndroidManager::setVersionCode(m_step->target(), m_ui->versionCode->value());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setVersionName()
|
||||
{
|
||||
m_step->androidTarget()->setVersionName(m_ui->versionNameLinedit->text());
|
||||
AndroidManager::setVersionName(m_step->target(), m_ui->versionNameLinedit->text());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setTarget(const QString &target)
|
||||
{
|
||||
m_step->androidTarget()->setTargetApplication(target);
|
||||
AndroidManager::setTargetApplication(m_step->target(), target);
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setQtLibs(QModelIndex, QModelIndex)
|
||||
{
|
||||
m_step->androidTarget()->setQtLibs(m_qtLibsModel->checkedItems());
|
||||
AndroidManager::setQtLibs(m_step->target(), m_qtLibsModel->checkedItems());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setPrebundledLibs(QModelIndex, QModelIndex)
|
||||
{
|
||||
m_step->androidTarget()->setPrebundledLibs(m_prebundledLibs->checkedItems());
|
||||
AndroidManager::setPrebundledLibs(m_step->target(), m_prebundledLibs->checkedItems());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::prebundledLibSelected(const QModelIndex &index)
|
||||
@@ -395,8 +405,8 @@ void AndroidPackageCreationWidget::setHDPIIcon()
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Choose High DPI Icon"), QDir::homePath(), tr("png images (*.png)"));
|
||||
if (!file.length())
|
||||
return;
|
||||
m_step->androidTarget()->setHighDpiIcon(file);
|
||||
m_ui->hIconButton->setIcon(m_step->androidTarget()->highDpiIcon());
|
||||
AndroidManager::setHighDpiIcon(m_step->target(), file);
|
||||
m_ui->hIconButton->setIcon(AndroidManager::highDpiIcon(m_step->target()));
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setMDPIIcon()
|
||||
@@ -404,8 +414,8 @@ void AndroidPackageCreationWidget::setMDPIIcon()
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Choose Medium DPI Icon"), QDir::homePath(), tr("png images (*.png)"));
|
||||
if (!file.length())
|
||||
return;
|
||||
m_step->androidTarget()->setMediumDpiIcon(file);
|
||||
m_ui->mIconButton->setIcon(m_step->androidTarget()->mediumDpiIcon());
|
||||
AndroidManager::setMediumDpiIcon(m_step->target(), file);
|
||||
m_ui->mIconButton->setIcon(AndroidManager::mediumDpiIcon(m_step->target()));
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::setLDPIIcon()
|
||||
@@ -413,8 +423,8 @@ void AndroidPackageCreationWidget::setLDPIIcon()
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Choose Low DPI Icon"), QDir::homePath(), tr("png images (*.png)"));
|
||||
if (!file.length())
|
||||
return;
|
||||
m_step->androidTarget()->setLowDpiIcon(file);
|
||||
m_ui->lIconButton->setIcon(m_step->androidTarget()->lowDpiIcon());
|
||||
AndroidManager::setLowDpiIcon(m_step->target(), file);
|
||||
m_ui->lIconButton->setIcon(AndroidManager::lowDpiIcon(m_step->target()));
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::permissionActivated(QModelIndex index)
|
||||
@@ -451,21 +461,21 @@ void AndroidPackageCreationWidget::removePermission()
|
||||
void AndroidPackageCreationWidget::savePermissionsButton()
|
||||
{
|
||||
setEnabledSaveDiscardButtons(false);
|
||||
m_step->androidTarget()->setPermissions(m_permissionsModel->permissions());
|
||||
AndroidManager::setPermissions(m_step->target(), m_permissionsModel->permissions());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::discardPermissionsButton()
|
||||
{
|
||||
setEnabledSaveDiscardButtons(false);
|
||||
m_permissionsModel->setPermissions(m_step->androidTarget()->permissions());
|
||||
m_permissionsModel->setPermissions(AndroidManager::permissions(m_step->target()));
|
||||
m_ui->permissionsComboBox->setCurrentIndex(-1);
|
||||
m_ui->removePermissionButton->setEnabled(m_permissionsModel->permissions().size());
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::updateRequiredLibrariesModels()
|
||||
{
|
||||
m_qtLibsModel->setCheckedItems(m_step->androidTarget()->qtLibs());
|
||||
m_prebundledLibs->setCheckedItems(m_step->androidTarget()->prebundledLibs());
|
||||
m_qtLibsModel->setCheckedItems(AndroidManager::qtLibs(m_step->target()));
|
||||
m_prebundledLibs->setCheckedItems(AndroidManager::prebundledLibs(m_step->target()));
|
||||
}
|
||||
|
||||
void AndroidPackageCreationWidget::readElfInfo()
|
||||
@@ -502,7 +512,7 @@ void AndroidPackageCreationWidget::on_signPackageCheckBox_toggled(bool checked)
|
||||
{
|
||||
if (!checked)
|
||||
return;
|
||||
if (m_step->keystorePath().length())
|
||||
if (!m_step->keystorePath().isEmpty())
|
||||
setCertificates();
|
||||
}
|
||||
|
||||
@@ -511,7 +521,7 @@ void AndroidPackageCreationWidget::on_KeystoreCreatePushButton_clicked()
|
||||
AndroidCreateKeystoreCertificate d;
|
||||
if (d.exec() != QDialog::Accepted)
|
||||
return;
|
||||
m_ui->KeystoreLocationLineEdit->setText(d.keystoreFilePath());
|
||||
m_ui->KeystoreLocationLineEdit->setText(d.keystoreFilePath().toUserOutput());
|
||||
m_step->setKeystorePath(d.keystoreFilePath());
|
||||
m_step->setKeystorePassword(d.keystorePassword());
|
||||
m_step->setCertificateAlias(d.certificateAlias());
|
||||
@@ -521,13 +531,13 @@ void AndroidPackageCreationWidget::on_KeystoreCreatePushButton_clicked()
|
||||
|
||||
void AndroidPackageCreationWidget::on_KeystoreLocationPushButton_clicked()
|
||||
{
|
||||
QString keystorePath = m_step->keystorePath();
|
||||
if (!keystorePath.length())
|
||||
keystorePath = QDir::homePath();
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select Keystore File"), keystorePath, tr("Keystore files (*.keystore *.jks)"));
|
||||
if (!file.length())
|
||||
Utils::FileName keystorePath = m_step->keystorePath();
|
||||
if (keystorePath.isEmpty())
|
||||
keystorePath = Utils::FileName::fromString(QDir::homePath());
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select keystore file"), keystorePath.toString(), tr("Keystore files (*.keystore *.jks)")));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->KeystoreLocationLineEdit->setText(file);
|
||||
m_ui->KeystoreLocationLineEdit->setText(file.toUserOutput());
|
||||
m_step->setKeystorePath(file);
|
||||
m_ui->signPackageCheckBox->setChecked(false);
|
||||
}
|
||||
@@ -551,6 +561,3 @@ void AndroidPackageCreationWidget::on_openPackageLocationCheckBox_toggled(bool c
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
|
||||
|
||||
|
@@ -38,6 +38,8 @@
|
||||
#include <QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QFileSystemWatcher;
|
||||
|
||||
namespace Ui { class AndroidPackageCreationWidget; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -106,7 +108,7 @@ private slots:
|
||||
|
||||
void setPackageName();
|
||||
void setApplicationName();
|
||||
void setTargetSDK(const QString &target);
|
||||
void setTargetSDK(const QString &sdk);
|
||||
void setVersionCode();
|
||||
void setVersionName();
|
||||
void setTarget(const QString &target);
|
||||
@@ -142,6 +144,7 @@ private:
|
||||
CheckModel *m_qtLibsModel;
|
||||
CheckModel *m_prebundledLibs;
|
||||
PermissionsModel *m_permissionsModel;
|
||||
QFileSystemWatcher *m_fileSystemWatcher;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -33,11 +33,13 @@
|
||||
#include "androidpackageinstallationfactory.h"
|
||||
|
||||
#include "androidpackageinstallationstep.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -53,11 +55,13 @@ AndroidPackageInstallationFactory::AndroidPackageInstallationFactory(QObject *pa
|
||||
|
||||
QList<Core::Id> AndroidPackageInstallationFactory::availableCreationIds(BuildStepList *parent) const
|
||||
{
|
||||
if (parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
&& parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
|
||||
&& !parent->contains(Core::Id(AndroidPackageInstallationStep::Id)))
|
||||
return QList<Core::Id>() << Core::Id(AndroidPackageInstallationStep::Id);
|
||||
if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
|
||||
return QList<Core::Id>();
|
||||
if (!AndroidManager::supportsAndroid(parent->target()))
|
||||
return QList<Core::Id>();
|
||||
if (parent->contains(AndroidPackageInstallationStep::Id))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << AndroidPackageInstallationStep::Id;
|
||||
}
|
||||
|
||||
QString AndroidPackageInstallationFactory::displayNameForId(const Core::Id id) const
|
||||
@@ -70,10 +74,7 @@ QString AndroidPackageInstallationFactory::displayNameForId(const Core::Id id) c
|
||||
|
||||
bool AndroidPackageInstallationFactory::canCreate(BuildStepList *parent, const Core::Id id) const
|
||||
{
|
||||
return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
&& id == Core::Id(AndroidPackageInstallationStep::Id)
|
||||
&& parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
|
||||
&& !parent->contains(AndroidPackageInstallationStep::Id);
|
||||
return availableCreationIds(parent).contains(id);
|
||||
}
|
||||
|
||||
BuildStep *AndroidPackageInstallationFactory::create(BuildStepList *parent, const Core::Id id)
|
||||
|
@@ -31,7 +31,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "androidpackageinstallationstep.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
@@ -54,25 +54,13 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::
|
||||
}
|
||||
|
||||
AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bc, AndroidPackageInstallationStep *other): MakeStep(bc, other)
|
||||
{
|
||||
const QString name = stepDisplayName();
|
||||
setDefaultDisplayName(name);
|
||||
setDisplayName(name);
|
||||
}
|
||||
{ }
|
||||
|
||||
AndroidPackageInstallationStep::~AndroidPackageInstallationStep()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
bool AndroidPackageInstallationStep::init()
|
||||
{
|
||||
AndroidTarget *androidTarget = qobject_cast<AndroidTarget *>(target());
|
||||
if (!androidTarget) {
|
||||
emit addOutput(tr("Current target is not an Android target"), BuildStep::MessageOutput);
|
||||
return false;
|
||||
}
|
||||
|
||||
setUserArguments(QString::fromLatin1("INSTALL_ROOT=\"%1\" install").arg(QDir::toNativeSeparators(androidTarget->androidDirPath())));
|
||||
|
||||
setUserArguments(QString::fromLatin1("INSTALL_ROOT=\"%1\" install").arg(AndroidManager::dirPath(target()).toUserOutput()));
|
||||
return MakeStep::init();
|
||||
}
|
||||
|
@@ -36,51 +36,50 @@
|
||||
#include "androidconfigurations.h"
|
||||
#include "androiddeploystepfactory.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidpackagecreationfactory.h"
|
||||
#include "androidpackageinstallationfactory.h"
|
||||
#include "androidrunfactories.h"
|
||||
#include "androidsettingspage.h"
|
||||
#include "androidtoolchain.h"
|
||||
#include "androidqtversionfactory.h"
|
||||
#include "androidtargetfactory.h"
|
||||
#include "androiddeployconfiguration.h"
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
using namespace Android;
|
||||
using namespace Android::Internal;
|
||||
namespace Android {
|
||||
|
||||
AndroidPlugin::AndroidPlugin()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
AndroidPlugin::~AndroidPlugin()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
bool AndroidPlugin::initialize(const QStringList &arguments,
|
||||
QString *error_message)
|
||||
{
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(error_message)
|
||||
Q_UNUSED(arguments);
|
||||
Q_UNUSED(error_message);
|
||||
|
||||
AndroidConfigurations::instance(this);
|
||||
Internal::AndroidConfigurations::instance(this);
|
||||
|
||||
addAutoReleasedObject(new AndroidRunControlFactory);
|
||||
addAutoReleasedObject(new AndroidRunConfigurationFactory);
|
||||
addAutoReleasedObject(new AndroidPackageInstallationFactory);
|
||||
addAutoReleasedObject(new AndroidPackageCreationFactory);
|
||||
addAutoReleasedObject(new AndroidDeployStepFactory);
|
||||
addAutoReleasedObject(new AndroidSettingsPage);
|
||||
addAutoReleasedObject(new AndroidTargetFactory);
|
||||
addAutoReleasedObject(new AndroidQtVersionFactory);
|
||||
addAutoReleasedObject(new AndroidToolChainFactory);
|
||||
addAutoReleasedObject(new AndroidDeployConfigurationFactory);
|
||||
new Internal::AndroidManager(this);
|
||||
|
||||
addAutoReleasedObject(new Internal::AndroidRunControlFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidRunConfigurationFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidPackageInstallationFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidPackageCreationFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidDeployStepFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidSettingsPage);
|
||||
addAutoReleasedObject(new Internal::AndroidQtVersionFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidToolChainFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidDeployConfigurationFactory);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AndroidPlugin::extensionsInitialized()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
} // namespace Android
|
||||
|
||||
Q_EXPORT_PLUGIN(Android::AndroidPlugin)
|
||||
|
@@ -30,8 +30,8 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ANDROIDMANAGER_H
|
||||
#define ANDROIDMANAGER_H
|
||||
#ifndef ANDROIDPLUGIN_H
|
||||
#define ANDROIDPLUGIN_H
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *error_message);
|
||||
void extensionsInitialized();
|
||||
|
||||
};
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // ANDROIDMANAGER_H
|
||||
} // namespace Android
|
||||
|
||||
#endif // ANDROIDPLUGIN_H
|
||||
|
@@ -90,16 +90,6 @@ QList<ProjectExplorer::Abi> AndroidQtVersion::detectQtAbis() const
|
||||
32);
|
||||
}
|
||||
|
||||
bool AndroidQtVersion::supportsTargetId(const Core::Id id) const
|
||||
{
|
||||
return id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID);
|
||||
}
|
||||
|
||||
QSet<Core::Id> AndroidQtVersion::supportedTargetIds() const
|
||||
{
|
||||
return QSet<Core::Id>() << Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID);
|
||||
}
|
||||
|
||||
QString AndroidQtVersion::description() const
|
||||
{
|
||||
return QCoreApplication::translate("QtVersion", "Android", "Qt Version is meant for Android");
|
||||
@@ -114,10 +104,10 @@ Core::FeatureSet AndroidQtVersion::availableFeatures() const
|
||||
|
||||
QString AndroidQtVersion::platformName() const
|
||||
{
|
||||
return QLatin1String(Constants::ANDROID_PLATFORM);
|
||||
return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM);
|
||||
}
|
||||
|
||||
QString AndroidQtVersion::platformDisplayName() const
|
||||
{
|
||||
return QLatin1String(Constants::ANDROID_PLATFORM_TR);
|
||||
return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM_TR);
|
||||
}
|
||||
|
@@ -52,9 +52,6 @@ public:
|
||||
|
||||
QList<ProjectExplorer::Abi> detectQtAbis() const;
|
||||
|
||||
bool supportsTargetId(const Core::Id id) const;
|
||||
QSet<Core::Id> supportedTargetIds() const;
|
||||
|
||||
Core::FeatureSet availableFeatures() const;
|
||||
QString platformName() const;
|
||||
QString platformDisplayName() const;
|
||||
|
@@ -34,14 +34,19 @@
|
||||
#include "androiddeploystep.h"
|
||||
#include "androidglobal.h"
|
||||
#include "androidtoolchain.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <qtsupport/qtoutputformatter.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
|
||||
using namespace Qt4ProjectManager;
|
||||
|
||||
@@ -50,15 +55,14 @@ namespace Internal {
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
AndroidRunConfiguration::AndroidRunConfiguration(AndroidTarget *parent,
|
||||
const QString &proFilePath)
|
||||
: RunConfiguration(parent, Core::Id(ANDROID_RC_ID))
|
||||
, m_proFilePath(proFilePath)
|
||||
AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id, const QString &path)
|
||||
: RunConfiguration(parent, id)
|
||||
, m_proFilePath(path)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
AndroidRunConfiguration::AndroidRunConfiguration(AndroidTarget *parent,
|
||||
AndroidRunConfiguration::AndroidRunConfiguration(ProjectExplorer::Target *parent,
|
||||
AndroidRunConfiguration *source)
|
||||
: RunConfiguration(parent, source)
|
||||
, m_proFilePath(source->m_proFilePath)
|
||||
@@ -75,11 +79,6 @@ AndroidRunConfiguration::~AndroidRunConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
AndroidTarget *AndroidRunConfiguration::androidTarget() const
|
||||
{
|
||||
return static_cast<AndroidTarget *>(target());
|
||||
}
|
||||
|
||||
Qt4BuildConfiguration *AndroidRunConfiguration::activeQt4BuildConfiguration() const
|
||||
{
|
||||
return static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration());
|
||||
@@ -92,7 +91,7 @@ QWidget *AndroidRunConfiguration::createConfigurationWidget()
|
||||
|
||||
Utils::OutputFormatter *AndroidRunConfiguration::createOutputFormatter() const
|
||||
{
|
||||
return new QtSupport::QtOutputFormatter(androidTarget()->qt4Project());
|
||||
return new QtSupport::QtOutputFormatter(target()->project());
|
||||
}
|
||||
|
||||
QString AndroidRunConfiguration::defaultDisplayName()
|
||||
@@ -105,9 +104,12 @@ AndroidConfig AndroidRunConfiguration::config() const
|
||||
return AndroidConfigurations::instance().config();
|
||||
}
|
||||
|
||||
const QString AndroidRunConfiguration::gdbCmd() const
|
||||
const Utils::FileName AndroidRunConfiguration::gdbCmd() const
|
||||
{
|
||||
return AndroidConfigurations::instance().gdbPath(activeQt4BuildConfiguration()->toolChain()->targetAbi().architecture());
|
||||
ToolChain *tc = ToolChainProfileInformation::toolChain(target()->profile());
|
||||
if (!tc)
|
||||
return Utils::FileName();
|
||||
return AndroidConfigurations::instance().gdbPath(tc->targetAbi().architecture());
|
||||
}
|
||||
|
||||
AndroidDeployStep *AndroidRunConfiguration::deployStep() const
|
||||
@@ -127,8 +129,10 @@ const QString AndroidRunConfiguration::remoteChannel() const
|
||||
|
||||
const QString AndroidRunConfiguration::dumperLib() const
|
||||
{
|
||||
Qt4BuildConfiguration *qt4bc(activeQt4BuildConfiguration());
|
||||
return qt4bc->qtVersion()->gdbDebuggingHelperLibrary();
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
|
||||
if (!version)
|
||||
return QString();
|
||||
return version->gdbDebuggingHelperLibrary();
|
||||
}
|
||||
|
||||
QString AndroidRunConfiguration::proFilePath() const
|
||||
|
@@ -56,7 +56,6 @@ class AndroidDeviceConfigListModel;
|
||||
class AndroidDeployStep;
|
||||
class AndroidRunConfigurationFactory;
|
||||
class AndroidToolChain;
|
||||
class AndroidTarget;
|
||||
|
||||
class AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
@@ -71,12 +70,11 @@ public:
|
||||
|
||||
enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml };
|
||||
|
||||
AndroidRunConfiguration(AndroidTarget *parent, const QString &proFilePath);
|
||||
AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path);
|
||||
virtual ~AndroidRunConfiguration();
|
||||
|
||||
QWidget *createConfigurationWidget();
|
||||
Utils::OutputFormatter *createOutputFormatter() const;
|
||||
AndroidTarget *androidTarget() const;
|
||||
Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
|
||||
|
||||
AndroidDeployStep *deployStep() const;
|
||||
@@ -87,12 +85,12 @@ public:
|
||||
|
||||
DebuggingType debuggingType() const;
|
||||
|
||||
const QString gdbCmd() const;
|
||||
const Utils::FileName gdbCmd() const;
|
||||
const QString remoteChannel() const;
|
||||
const QString dumperLib() const;
|
||||
|
||||
protected:
|
||||
AndroidRunConfiguration(AndroidTarget *parent, AndroidRunConfiguration *source);
|
||||
AndroidRunConfiguration(ProjectExplorer::Target *parent, AndroidRunConfiguration *source);
|
||||
QString defaultDisplayName();
|
||||
|
||||
private:
|
||||
|
@@ -36,13 +36,17 @@
|
||||
#include "androiddebugsupport.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
#include "androidruncontrol.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <debugger/debuggerconstants.h>
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
#include <qt4projectmanager/qt4nodes.h>
|
||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
|
||||
namespace Android {
|
||||
@@ -55,7 +59,7 @@ namespace {
|
||||
|
||||
QString pathFromId(const Core::Id id)
|
||||
{
|
||||
QString pathStr = QString::fromUtf8(id.name());
|
||||
QString pathStr = id.toString();
|
||||
const QString prefix = QLatin1String(ANDROID_RC_ID_PREFIX);
|
||||
if (!pathStr.startsWith(prefix))
|
||||
return QString();
|
||||
@@ -65,34 +69,25 @@ QString pathFromId(const Core::Id id)
|
||||
} // namespace
|
||||
|
||||
AndroidRunConfigurationFactory::AndroidRunConfigurationFactory(QObject *parent)
|
||||
: IRunConfigurationFactory(parent)
|
||||
{
|
||||
}
|
||||
: QmakeRunConfigurationFactory(parent)
|
||||
{ setObjectName(QLatin1String("AndroidRunConfigurationFactory")); }
|
||||
|
||||
AndroidRunConfigurationFactory::~AndroidRunConfigurationFactory()
|
||||
{ }
|
||||
|
||||
bool AndroidRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
return availableCreationIds(parent).contains(id);
|
||||
}
|
||||
|
||||
bool AndroidRunConfigurationFactory::canCreate(Target *parent,
|
||||
const Core::Id/*id*/) const
|
||||
bool AndroidRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
AndroidTarget *target = qobject_cast<AndroidTarget *>(parent);
|
||||
if (!target
|
||||
|| target->id() != Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)) {
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AndroidRunConfigurationFactory::canRestore(Target *parent,
|
||||
const QVariantMap &map) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
Q_UNUSED(map)
|
||||
if (!qobject_cast<AndroidTarget *>(parent))
|
||||
return false;
|
||||
QString id = QString::fromUtf8(ProjectExplorer::idFromMap(map).name());
|
||||
return id.startsWith(QLatin1String(ANDROID_RC_ID));
|
||||
QString id = ProjectExplorer::idFromMap(map).toString();
|
||||
return id.startsWith(QLatin1String(ANDROID_RC_ID_PREFIX));
|
||||
}
|
||||
|
||||
bool AndroidRunConfigurationFactory::canClone(Target *parent,
|
||||
@@ -104,14 +99,12 @@ bool AndroidRunConfigurationFactory::canClone(Target *parent,
|
||||
QList<Core::Id> AndroidRunConfigurationFactory::availableCreationIds(Target *parent) const
|
||||
{
|
||||
QList<Core::Id> ids;
|
||||
if (AndroidTarget *t = qobject_cast<AndroidTarget *>(parent)) {
|
||||
if (t->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)) {
|
||||
QList<Qt4ProFileNode *> nodes = t->qt4Project()->allProFiles();
|
||||
if (!AndroidManager::supportsAndroid(parent))
|
||||
return ids;
|
||||
QList<Qt4ProFileNode *> nodes = static_cast<Qt4Project *>(parent->project())->allProFiles();
|
||||
foreach (Qt4ProFileNode *node, nodes)
|
||||
if (node->projectType() == ApplicationTemplate || node->projectType() == LibraryTemplate)
|
||||
ids << Core::Id(node->targetInformation().target);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
@@ -120,14 +113,11 @@ QString AndroidRunConfigurationFactory::displayNameForId(const Core::Id id) cons
|
||||
return QFileInfo(pathFromId(id)).completeBaseName();
|
||||
}
|
||||
|
||||
RunConfiguration *AndroidRunConfigurationFactory::create(Target *parent,
|
||||
const Core::Id id)
|
||||
RunConfiguration *AndroidRunConfigurationFactory::create(Target *parent, const Core::Id id)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
AndroidTarget *pqt4parent = static_cast<AndroidTarget *>(parent);
|
||||
return new AndroidRunConfiguration(pqt4parent, pathFromId(id));
|
||||
|
||||
return new AndroidRunConfiguration(parent, id, pathFromId(id));
|
||||
}
|
||||
|
||||
RunConfiguration *AndroidRunConfigurationFactory::restore(Target *parent,
|
||||
@@ -135,8 +125,8 @@ RunConfiguration *AndroidRunConfigurationFactory::restore(Target *parent,
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
AndroidTarget *target = static_cast<AndroidTarget *>(parent);
|
||||
AndroidRunConfiguration *rc = new AndroidRunConfiguration(target, QString());
|
||||
Core::Id id = ProjectExplorer::idFromMap(map);
|
||||
AndroidRunConfiguration *rc = new AndroidRunConfiguration(parent, id, pathFromId(id));
|
||||
if (rc->fromMap(map))
|
||||
return rc;
|
||||
|
||||
@@ -144,14 +134,30 @@ RunConfiguration *AndroidRunConfigurationFactory::restore(Target *parent,
|
||||
return 0;
|
||||
}
|
||||
|
||||
RunConfiguration *AndroidRunConfigurationFactory::clone(Target *parent,
|
||||
RunConfiguration *source)
|
||||
RunConfiguration *AndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
|
||||
AndroidRunConfiguration *old = static_cast<AndroidRunConfiguration *>(source);
|
||||
return new AndroidRunConfiguration(static_cast<AndroidTarget *>(parent), old);
|
||||
return new AndroidRunConfiguration(parent, old);
|
||||
}
|
||||
|
||||
bool AndroidRunConfigurationFactory::canHandle(Target *t) const
|
||||
{
|
||||
if (!t->project()->supportsProfile(t->profile()))
|
||||
return false;
|
||||
return AndroidManager::supportsAndroid(t);
|
||||
}
|
||||
|
||||
QList<RunConfiguration *> AndroidRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n)
|
||||
{
|
||||
QList<ProjectExplorer::RunConfiguration *> result;
|
||||
foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
|
||||
if (AndroidRunConfiguration *qt4c = qobject_cast<AndroidRunConfiguration *>(rc))
|
||||
if (qt4c->proFilePath() == n->path())
|
||||
result << rc;
|
||||
return result;
|
||||
}
|
||||
|
||||
// #pragma mark -- AndroidRunControlFactory
|
||||
|
@@ -34,24 +34,26 @@
|
||||
#define ANDROIDRUNFACTORIES_H
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <qt4projectmanager/qmakerunconfigurationfactory.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class RunConfiguration;
|
||||
class RunControl;
|
||||
class RunConfigWidget;
|
||||
class Target;
|
||||
}
|
||||
using ProjectExplorer::IRunConfigurationFactory;
|
||||
|
||||
using ProjectExplorer::IRunControlFactory;
|
||||
using ProjectExplorer::RunConfiguration;
|
||||
using ProjectExplorer::RunControl;
|
||||
using ProjectExplorer::RunConfigWidget;
|
||||
using ProjectExplorer::Target;
|
||||
|
||||
namespace ProjectExplorer { class Node; }
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidRunConfigurationFactory : public IRunConfigurationFactory
|
||||
class AndroidRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurationFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -70,6 +72,10 @@ public:
|
||||
|
||||
bool canClone(Target *parent, RunConfiguration *source) const;
|
||||
RunConfiguration *clone(Target *parent, RunConfiguration *source);
|
||||
|
||||
bool canHandle(ProjectExplorer::Target *t) const;
|
||||
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
|
||||
ProjectExplorer::Node *n);
|
||||
};
|
||||
|
||||
class AndroidRunControlFactory : public IRunControlFactory
|
||||
|
@@ -36,7 +36,9 @@
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidglobal.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <QTime>
|
||||
#include <QtConcurrentRun>
|
||||
@@ -49,13 +51,13 @@ AndroidRunner::AndroidRunner(QObject *parent,
|
||||
: QThread(parent)
|
||||
{
|
||||
m_remoteChannel = runConfig->remoteChannel();
|
||||
AndroidTarget * at = runConfig->androidTarget();
|
||||
AndroidDeployStep * ds = runConfig->deployStep();
|
||||
ProjectExplorer::Target *target = runConfig->target();
|
||||
AndroidDeployStep *ds = runConfig->deployStep();
|
||||
if ((m_useLocalQtLibs = ds->useLocalQtLibs())) {
|
||||
m_localLibs = at->loadLocalLibs(ds->deviceAPILevel());
|
||||
m_localJars = at->loadLocalJars(ds->deviceAPILevel());
|
||||
m_localLibs = AndroidManager::loadLocalLibs(target, ds->deviceAPILevel());
|
||||
m_localJars = AndroidManager::loadLocalJars(target, ds->deviceAPILevel());
|
||||
}
|
||||
m_intentName = at->intentName();
|
||||
m_intentName = AndroidManager::intentName(target);
|
||||
m_debugingMode = debugging;
|
||||
m_packageName = m_intentName.left(m_intentName.indexOf(QLatin1Char('/')));
|
||||
m_deviceSerialNumber = ds->deviceSerialNumber();
|
||||
@@ -74,7 +76,7 @@ AndroidRunner::~AndroidRunner()
|
||||
void AndroidRunner::checkPID()
|
||||
{
|
||||
QProcess psProc;
|
||||
psProc.start(AndroidConfigurations::instance().adbToolPath(),
|
||||
psProc.start(AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("shell") << QLatin1String("ps"));
|
||||
if (!psProc.waitForFinished(-1)) {
|
||||
@@ -148,7 +150,7 @@ void AndroidRunner::asyncStart()
|
||||
arguments << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("forward") << QString::fromLatin1("tcp%1").arg(m_remoteChannel)
|
||||
<< QString::fromLatin1("localfilesystem:/data/data/%1/debug-socket").arg(m_packageName);
|
||||
adbStarProc.start(AndroidConfigurations::instance().adbToolPath(), arguments);
|
||||
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
|
||||
if (!adbStarProc.waitForStarted()) {
|
||||
emit remoteProcessFinished(tr("Failed to forward debugging ports. Reason: $1").arg(adbStarProc.errorString()));
|
||||
return;
|
||||
@@ -176,7 +178,7 @@ void AndroidRunner::asyncStart()
|
||||
if (extraParams.length())
|
||||
arguments << extraParams.split(QLatin1Char(' '));
|
||||
|
||||
adbStarProc.start(AndroidConfigurations::instance().adbToolPath(), arguments);
|
||||
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
|
||||
if (!adbStarProc.waitForStarted()) {
|
||||
emit remoteProcessFinished(tr("Failed to start the activity. Reason: $1").arg(adbStarProc.errorString()));
|
||||
return;
|
||||
@@ -209,7 +211,7 @@ void AndroidRunner::asyncStart()
|
||||
void AndroidRunner::startLogcat()
|
||||
{
|
||||
m_checkPIDTimer.start(1000); // check if the application is alive every 1 seconds
|
||||
m_adbLogcatProcess.start(AndroidConfigurations::instance().adbToolPath(),
|
||||
m_adbLogcatProcess.start(AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("logcat"));
|
||||
emit remoteProcessStarted(5039);
|
||||
@@ -267,7 +269,7 @@ void AndroidRunner::adbKill(qint64 pid, const QString &device, int timeout, cons
|
||||
arguments << QLatin1String("kill") << QLatin1String("-9");
|
||||
arguments << QString::number(pid);
|
||||
|
||||
process.start(AndroidConfigurations::instance().adbToolPath(), arguments);
|
||||
process.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
|
||||
if (!process.waitForFinished(timeout))
|
||||
process.terminate();
|
||||
}
|
||||
|
@@ -149,19 +149,19 @@ void AndroidSettingsWidget::initGui()
|
||||
m_ui->setupUi(this);
|
||||
m_ui->toolchainVersionComboBox->clear();
|
||||
if (checkSDK(m_androidConfig.sdkLocation))
|
||||
m_ui->SDKLocationLineEdit->setText(m_androidConfig.sdkLocation);
|
||||
m_ui->SDKLocationLineEdit->setText(m_androidConfig.sdkLocation.toUserOutput());
|
||||
else
|
||||
m_androidConfig.sdkLocation.clear();
|
||||
if (checkNDK(m_androidConfig.ndkLocation))
|
||||
m_ui->NDKLocationLineEdit->setText(m_androidConfig.ndkLocation);
|
||||
m_ui->NDKLocationLineEdit->setText(m_androidConfig.ndkLocation.toUserOutput());
|
||||
else
|
||||
m_androidConfig.ndkLocation.clear();
|
||||
m_ui->AntLocationLineEdit->setText(m_androidConfig.antLocation);
|
||||
m_ui->GdbLocationLineEdit->setText(m_androidConfig.armGdbLocation);
|
||||
m_ui->GdbserverLocationLineEdit->setText(m_androidConfig.armGdbserverLocation);
|
||||
m_ui->GdbLocationLineEditx86->setText(m_androidConfig.x86GdbLocation);
|
||||
m_ui->GdbserverLocationLineEditx86->setText(m_androidConfig.x86GdbserverLocation);
|
||||
m_ui->OpenJDKLocationLineEdit->setText(m_androidConfig.openJDKLocation);
|
||||
m_ui->AntLocationLineEdit->setText(m_androidConfig.antLocation.toUserOutput());
|
||||
m_ui->GdbLocationLineEdit->setText(m_androidConfig.armGdbLocation.toUserOutput());
|
||||
m_ui->GdbserverLocationLineEdit->setText(m_androidConfig.armGdbserverLocation.toUserOutput());
|
||||
m_ui->GdbLocationLineEditx86->setText(m_androidConfig.x86GdbLocation.toUserOutput());
|
||||
m_ui->GdbserverLocationLineEditx86->setText(m_androidConfig.x86GdbserverLocation.toUserOutput());
|
||||
m_ui->OpenJDKLocationLineEdit->setText(m_androidConfig.openJDKLocation.toUserOutput());
|
||||
m_ui->DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize);
|
||||
m_ui->AVDTableView->setModel(&m_AVDModel);
|
||||
m_AVDModel.setAvdList(AndroidConfigurations::instance().androidVirtualDevices());
|
||||
@@ -181,33 +181,40 @@ void AndroidSettingsWidget::saveSettings(bool saveNow)
|
||||
}
|
||||
|
||||
|
||||
bool AndroidSettingsWidget::checkSDK(const QString &location)
|
||||
bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
|
||||
{
|
||||
if (!location.length())
|
||||
if (location.isEmpty())
|
||||
return false;
|
||||
if (!QFile::exists(location + QLatin1String("/platform-tools/adb" ANDROID_EXE_SUFFIX))
|
||||
|| (!QFile::exists(location + QLatin1String("/tools/android" ANDROID_EXE_SUFFIX))
|
||||
&& !QFile::exists(location + QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)))
|
||||
|| !QFile::exists(location + QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX))) {
|
||||
QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android SDK top folder").arg(location));
|
||||
Utils::FileName adb = location;
|
||||
Utils::FileName androidExe = location;
|
||||
Utils::FileName androidBat = location;
|
||||
Utils::FileName emulator = location;
|
||||
if (!adb.appendPath(QLatin1String("platform-tools/adb" ANDROID_EXE_SUFFIX)).toFileInfo().exists()
|
||||
|| (!androidExe.appendPath(QLatin1String("/tools/android" ANDROID_EXE_SUFFIX)).toFileInfo().exists()
|
||||
&& !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
|
||||
|| !emulator.appendPath(QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX)).toFileInfo().exists()) {
|
||||
QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android SDK top folder").arg(location.toUserOutput()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AndroidSettingsWidget::checkNDK(const QString &location)
|
||||
bool AndroidSettingsWidget::checkNDK(const Utils::FileName &location)
|
||||
{
|
||||
m_ui->toolchainVersionComboBox->setEnabled(false);
|
||||
m_ui->GdbLocationLineEdit->setEnabled(false);
|
||||
m_ui->GdbLocationPushButton->setEnabled(false);
|
||||
m_ui->GdbserverLocationLineEdit->setEnabled(false);
|
||||
m_ui->GdbserverLocationPushButton->setEnabled(false);
|
||||
if (!location.length())
|
||||
if (location.isEmpty())
|
||||
return false;
|
||||
if (!QFile::exists(location + QLatin1String("/platforms"))
|
||||
|| !QFile::exists(location + QLatin1String("/toolchains"))
|
||||
|| !QFile::exists(location + QLatin1String("/sources/cxx-stl"))) {
|
||||
QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android NDK top folder").arg(location));
|
||||
Utils::FileName platformPath = location;
|
||||
Utils::FileName toolChainPath = location;
|
||||
Utils::FileName sourcesPath = location;
|
||||
if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists()
|
||||
|| !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
|
||||
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
|
||||
QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android NDK top folder").arg(location.toUserOutput()));
|
||||
return false;
|
||||
}
|
||||
m_ui->toolchainVersionComboBox->setEnabled(true);
|
||||
@@ -222,7 +229,7 @@ bool AndroidSettingsWidget::checkNDK(const QString &location)
|
||||
|
||||
void AndroidSettingsWidget::sdkLocationEditingFinished()
|
||||
{
|
||||
QString location = m_ui->SDKLocationLineEdit->text();
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->SDKLocationLineEdit->text());
|
||||
if (!checkSDK(location)) {
|
||||
m_ui->AVDManagerFrame->setEnabled(false);
|
||||
return;
|
||||
@@ -235,8 +242,8 @@ void AndroidSettingsWidget::sdkLocationEditingFinished()
|
||||
|
||||
void AndroidSettingsWidget::ndkLocationEditingFinished()
|
||||
{
|
||||
QString location = m_ui->NDKLocationLineEdit->text();
|
||||
if (!checkNDK(location))
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->NDKLocationLineEdit->text());
|
||||
if (checkNDK(location))
|
||||
return;
|
||||
m_androidConfig.ndkLocation = location;
|
||||
saveSettings(true);
|
||||
@@ -264,67 +271,67 @@ void AndroidSettingsWidget::toolchainVersionIndexChanged(QString version)
|
||||
|
||||
void AndroidSettingsWidget::antLocationEditingFinished()
|
||||
{
|
||||
QString location = m_ui->AntLocationLineEdit->text();
|
||||
if (!location.length() || !QFile::exists(location))
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->AntLocationLineEdit->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.antLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::gdbLocationEditingFinished()
|
||||
{
|
||||
QString location = m_ui->GdbLocationLineEdit->text();
|
||||
if (!location.length() || !QFile::exists(location))
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbLocationLineEdit->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.armGdbLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::gdbserverLocationEditingFinished()
|
||||
{
|
||||
QString location = m_ui->GdbserverLocationLineEdit->text();
|
||||
if (!location.length() || !QFile::exists(location))
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbserverLocationLineEdit->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.armGdbserverLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::gdbLocationX86EditingFinished()
|
||||
{
|
||||
QString location = m_ui->GdbLocationLineEditx86->text();
|
||||
if (!location.length() || !QFile::exists(location))
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbLocationLineEditx86->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.x86GdbLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::gdbserverLocationX86EditingFinished()
|
||||
{
|
||||
QString location = m_ui->GdbserverLocationLineEditx86->text();
|
||||
if (!location.length() || !QFile::exists(location))
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbserverLocationLineEditx86->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.x86GdbserverLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::openJDKLocationEditingFinished()
|
||||
{
|
||||
QString location = m_ui->OpenJDKLocationLineEdit->text();
|
||||
if (!location.length() || !QFile::exists(location))
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->OpenJDKLocationLineEdit->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.openJDKLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseSDKLocation()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Android SDK Folder"));
|
||||
Utils::FileName dir = Utils::FileName::fromString(QFileDialog::getExistingDirectory(this, tr("Select Android SDK folder")));
|
||||
if (!checkSDK(dir))
|
||||
return;
|
||||
m_ui->SDKLocationLineEdit->setText(dir);
|
||||
m_ui->SDKLocationLineEdit->setText(dir.toUserOutput());
|
||||
sdkLocationEditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseNDKLocation()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Android NDK Folder"));
|
||||
Utils::FileName dir = Utils::FileName::fromString(QFileDialog::getExistingDirectory(this, tr("Select Android NDK folder")));
|
||||
if (!checkNDK(dir))
|
||||
return;
|
||||
m_ui->NDKLocationLineEdit->setText(dir);
|
||||
m_ui->NDKLocationLineEdit->setText(dir.toUserOutput());
|
||||
ndkLocationEditingFinished();
|
||||
}
|
||||
|
||||
@@ -350,55 +357,51 @@ void AndroidSettingsWidget::browseAntLocation()
|
||||
|
||||
void AndroidSettingsWidget::browseGdbLocation()
|
||||
{
|
||||
QString gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::ArmArchitecture);
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select gdb Executable"),gdbPath);
|
||||
if (!file.length())
|
||||
Utils::FileName gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::ArmArchitecture);
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdb executable"), gdbPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->GdbLocationLineEdit->setText(file);
|
||||
m_ui->GdbLocationLineEdit->setText(file.toUserOutput());
|
||||
gdbLocationEditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseGdbserverLocation()
|
||||
{
|
||||
QString gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::ArmArchitecture);
|
||||
const QString file =
|
||||
QFileDialog::getOpenFileName(this, tr("Select gdbserver Android Executable"),gdbserverPath);
|
||||
if (!file.length())
|
||||
Utils::FileName gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::ArmArchitecture);
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdbserver android executable"), gdbserverPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->GdbserverLocationLineEdit->setText(file);
|
||||
m_ui->GdbserverLocationLineEdit->setText(file.toUserOutput());
|
||||
gdbserverLocationEditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseGdbLocationX86()
|
||||
{
|
||||
QString gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::X86Architecture);
|
||||
const QString file =
|
||||
QFileDialog::getOpenFileName(this, tr("Select gdb Executable"),gdbPath);
|
||||
if (!file.length())
|
||||
Utils::FileName gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::X86Architecture);
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdb executable"), gdbPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->GdbLocationLineEditx86->setText(file);
|
||||
m_ui->GdbLocationLineEditx86->setText(file.toUserOutput());
|
||||
gdbLocationX86EditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseGdbserverLocationX86()
|
||||
{
|
||||
QString gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::X86Architecture);
|
||||
const QString file =
|
||||
QFileDialog::getOpenFileName(this, tr("Select gdbserver Android Executable"), gdbserverPath);
|
||||
if (!file.length())
|
||||
Utils::FileName gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::X86Architecture);
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdbserver android executable"), gdbserverPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->GdbserverLocationLineEditx86->setText(file);
|
||||
m_ui->GdbserverLocationLineEditx86->setText(file.toUserOutput());
|
||||
gdbserverLocationX86EditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseOpenJDKLocation()
|
||||
{
|
||||
QString openJDKPath = AndroidConfigurations::instance().openJDKPath();
|
||||
const QString file =
|
||||
QFileDialog::getOpenFileName(this, tr("Select OpenJDK Path"), openJDKPath);
|
||||
if (!file.length())
|
||||
Utils::FileName openJDKPath = AndroidConfigurations::instance().openJDKPath();
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select OpenJDK path"), openJDKPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->OpenJDKLocationLineEdit->setText(file);
|
||||
m_ui->OpenJDKLocationLineEdit->setText(file.toUserOutput());
|
||||
openJDKLocationEditingFinished();
|
||||
}
|
||||
|
||||
@@ -436,7 +439,8 @@ void AndroidSettingsWidget::manageAVD()
|
||||
QProcess *avdProcess = new QProcess();
|
||||
connect(this, SIGNAL(destroyed()), avdProcess, SLOT(deleteLater()));
|
||||
connect(avdProcess, SIGNAL(finished(int)), avdProcess, SLOT(deleteLater()));
|
||||
avdProcess->start(AndroidConfigurations::instance().androidToolPath(), QStringList() << QLatin1String("avd"));
|
||||
avdProcess->start(AndroidConfigurations::instance().androidToolPath().toString(),
|
||||
QStringList() << QLatin1String("avd"));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -72,6 +72,7 @@ class AndroidSettingsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
// Todo: This would be so much simpler if it just used Utils::PathChooser!!!
|
||||
AndroidSettingsWidget(QWidget *parent);
|
||||
~AndroidSettingsWidget();
|
||||
|
||||
@@ -105,8 +106,8 @@ private slots:
|
||||
|
||||
private:
|
||||
void initGui();
|
||||
bool checkSDK(const QString &location);
|
||||
bool checkNDK(const QString &location);
|
||||
bool checkSDK(const Utils::FileName &location);
|
||||
bool checkNDK(const Utils::FileName &location);
|
||||
void fillToolchainVersions();
|
||||
|
||||
Ui_AndroidSettingsWidget *m_ui;
|
||||
|
@@ -1,204 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef ANDROIDTEMPLATESCREATOR_H
|
||||
#define ANDROIDTEMPLATESCREATOR_H
|
||||
|
||||
#include "qt4projectmanager/qt4target.h"
|
||||
#include "qt4projectmanager/qt4buildconfiguration.h"
|
||||
|
||||
#include <QMap>
|
||||
#include <QIcon>
|
||||
#include <QDomDocument>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher);
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
class ProjectNode;
|
||||
class Target;
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
class Qt4Project;
|
||||
class Qt4Target;
|
||||
class Qt4ProFileNode;
|
||||
}
|
||||
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
class AndroidTargetFactory;
|
||||
|
||||
class AndroidTarget : public Qt4ProjectManager::Qt4BaseTarget
|
||||
{
|
||||
friend class AndroidTargetFactory;
|
||||
Q_OBJECT
|
||||
enum AndroidIconType
|
||||
{
|
||||
HighDPI,
|
||||
MediumDPI,
|
||||
LowDPI
|
||||
};
|
||||
|
||||
struct Library
|
||||
{
|
||||
Library()
|
||||
{
|
||||
level = -1;
|
||||
}
|
||||
int level;
|
||||
QStringList dependencies;
|
||||
QString name;
|
||||
};
|
||||
typedef QMap<QString, Library> LibrariesMap;
|
||||
public:
|
||||
enum BuildType
|
||||
{
|
||||
DebugBuild,
|
||||
ReleaseBuildUnsigned,
|
||||
ReleaseBuildSigned
|
||||
};
|
||||
|
||||
explicit AndroidTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id);
|
||||
virtual ~AndroidTarget();
|
||||
|
||||
Qt4ProjectManager::Qt4BuildConfigurationFactory *buildConfigurationFactory() const;
|
||||
|
||||
void createApplicationProFiles(bool reparse);
|
||||
|
||||
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
|
||||
|
||||
static QString defaultDisplayName();
|
||||
|
||||
|
||||
QString packageName() const;
|
||||
bool setPackageName(const QString &name) const;
|
||||
|
||||
QString intentName() const;
|
||||
QString activityName() const;
|
||||
|
||||
QString applicationName() const;
|
||||
bool setApplicationName(const QString &name) const;
|
||||
|
||||
QStringList availableTargetApplications() const;
|
||||
QString targetApplication() const;
|
||||
bool setTargetApplication(const QString &name) const;
|
||||
QString targetApplicationPath() const;
|
||||
|
||||
QString targetSDK() const;
|
||||
bool setTargetSDK(const QString &target) const;
|
||||
|
||||
int versionCode() const;
|
||||
bool setVersionCode(int version) const;
|
||||
|
||||
QString versionName() const;
|
||||
bool setVersionName(const QString &version) const;
|
||||
|
||||
QStringList permissions() const;
|
||||
bool setPermissions(const QStringList &permissions) const;
|
||||
|
||||
QStringList availableQtLibs() const;
|
||||
QStringList qtLibs() const;
|
||||
bool setQtLibs(const QStringList &qtLibs) const;
|
||||
|
||||
QStringList availablePrebundledLibs() const;
|
||||
QStringList prebundledLibs() const;
|
||||
bool setPrebundledLibs(const QStringList &qtLibs) const;
|
||||
|
||||
QIcon highDpiIcon() const;
|
||||
bool setHighDpiIcon(const QString &iconFilePath) const;
|
||||
|
||||
QIcon mediumDpiIcon() const;
|
||||
bool setMediumDpiIcon(const QString &iconFilePath) const;
|
||||
|
||||
QIcon lowDpiIcon() const;
|
||||
bool setLowDpiIcon(const QString &iconFilePath) const;
|
||||
|
||||
QString androidDirPath() const;
|
||||
QString androidManifestPath() const;
|
||||
QString androidLibsPath() const;
|
||||
QString androidStringsPath() const;
|
||||
QString androidDefaultPropertiesPath() const;
|
||||
QString androidSrcPath() const;
|
||||
QString apkPath(BuildType buildType) const;
|
||||
QString localLibsRulesFilePath() const;
|
||||
QString loadLocalLibs(int apiLevel) const;
|
||||
QString loadLocalJars(int apiLevel) const;
|
||||
|
||||
public slots:
|
||||
bool createAndroidTemplatesIfNecessary() const;
|
||||
void updateProject(const QString &targetSDK, const QString &name = QString()) const;
|
||||
|
||||
signals:
|
||||
void androidDirContentsChanged();
|
||||
|
||||
private slots:
|
||||
void handleTargetChanged(ProjectExplorer::Target *target);
|
||||
void handleTargetToBeRemoved(ProjectExplorer::Target *target);
|
||||
|
||||
private:
|
||||
enum ItemType
|
||||
{
|
||||
Lib,
|
||||
Jar
|
||||
};
|
||||
|
||||
QString loadLocal(int apiLevel, ItemType item) const;
|
||||
void raiseError(const QString &reason) const;
|
||||
bool openXmlFile(QDomDocument &doc, const QString &fileName, bool createAndroidTemplates = true) const;
|
||||
bool saveXmlFile(QDomDocument &doc, const QString &fileName) const;
|
||||
bool openAndroidManifest(QDomDocument &doc) const;
|
||||
bool saveAndroidManifest(QDomDocument &doc) const;
|
||||
bool openLibsXml(QDomDocument &doc) const;
|
||||
bool saveLibsXml(QDomDocument &doc) const;
|
||||
|
||||
QIcon androidIcon(AndroidIconType type) const;
|
||||
bool setAndroidIcon(AndroidIconType type, const QString &iconFileName) const;
|
||||
|
||||
QStringList libsXml(const QString &tag) const;
|
||||
bool setLibsXml(const QStringList &qtLibs, const QString &tag) const;
|
||||
|
||||
static bool qtLibrariesLessThan(const AndroidTarget::Library &a, const AndroidTarget::Library &b);
|
||||
QStringList getDependencies(const QString &readelfPath, const QString &lib) const;
|
||||
int setLibraryLevel(const QString &library, LibrariesMap &mapLibs) const;
|
||||
|
||||
|
||||
QFileSystemWatcher *const m_androidFilesWatcher;
|
||||
|
||||
Qt4ProjectManager::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
#endif // ANDROIDTEMPLATESCREATOR_H
|
@@ -1,185 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "androidtargetfactory.h"
|
||||
#include "qt4projectmanager/qt4project.h"
|
||||
#include "qt4projectmanager/qt4projectmanagerconstants.h"
|
||||
#include "androiddeploystep.h"
|
||||
#include "androidglobal.h"
|
||||
#include "androidpackagecreationstep.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androiddeployconfiguration.h"
|
||||
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <qt4projectmanager/buildconfigurationinfo.h>
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Android::Internal;
|
||||
using ProjectExplorer::idFromMap;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Qt4AndroidTargetFactory
|
||||
// -------------------------------------------------------------------------
|
||||
AndroidTargetFactory::AndroidTargetFactory(QObject *parent) :
|
||||
Qt4BaseTargetFactory(parent)
|
||||
{
|
||||
connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
|
||||
this, SIGNAL(canCreateTargetIdsChanged()));
|
||||
}
|
||||
|
||||
AndroidTargetFactory::~AndroidTargetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
bool AndroidTargetFactory::supportsTargetId(const Core::Id id) const
|
||||
{
|
||||
return id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID);
|
||||
}
|
||||
|
||||
QSet<QString> AndroidTargetFactory::targetFeatures(const Core::Id id) const
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
QSet<QString> features;
|
||||
features << QLatin1String(Qt4ProjectManager::Constants::MOBILE_TARGETFEATURE_ID);
|
||||
features << QLatin1String(Qt4ProjectManager::Constants::SHADOWBUILD_TARGETFEATURE_ID);
|
||||
return features;
|
||||
}
|
||||
|
||||
QList<Core::Id> AndroidTargetFactory::supportedTargetIds() const
|
||||
{
|
||||
return QList<Core::Id>() << Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID);
|
||||
}
|
||||
|
||||
QString AndroidTargetFactory::displayNameForId(const Core::Id id) const
|
||||
{
|
||||
if (id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
|
||||
return AndroidTarget::defaultDisplayName();
|
||||
return QString();
|
||||
}
|
||||
|
||||
QIcon AndroidTargetFactory::iconForId(const Core::Id id) const
|
||||
{
|
||||
Q_UNUSED(id)
|
||||
return QIcon(QLatin1String(Constants::ANDROID_SETTINGS_CATEGORY_ICON));
|
||||
}
|
||||
|
||||
bool AndroidTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
|
||||
{
|
||||
if (!qobject_cast<Qt4Project *>(parent))
|
||||
return false;
|
||||
if (!supportsTargetId(id))
|
||||
return false;
|
||||
return QtSupport::QtVersionManager::instance()->supportsTargetId(id);
|
||||
}
|
||||
|
||||
bool AndroidTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canCreate(parent, idFromMap(map));
|
||||
}
|
||||
|
||||
Qt4BaseTarget *AndroidTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
|
||||
const Core::Id id = idFromMap(map);
|
||||
AndroidTarget *target = 0;
|
||||
Qt4Project *qt4project = static_cast<Qt4Project *>(parent);
|
||||
if (id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
|
||||
target = new AndroidTarget(qt4project, id);
|
||||
if (target && target->fromMap(map))
|
||||
return target;
|
||||
delete target;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Qt4BaseTarget *AndroidTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
|
||||
QList<QtSupport::BaseQtVersion *> knownVersions = QtSupport::QtVersionManager::instance()->versionsForTargetId(id);
|
||||
if (knownVersions.isEmpty())
|
||||
return 0;
|
||||
|
||||
QtSupport::BaseQtVersion *qtVersion = knownVersions.first();
|
||||
bool buildAll = qtVersion->isValid() && (qtVersion->defaultBuildConfig() & QtSupport::BaseQtVersion::BuildAll);
|
||||
QtSupport::BaseQtVersion::QmakeBuildConfigs config = buildAll ? QtSupport::BaseQtVersion::BuildAll : QtSupport::BaseQtVersion::QmakeBuildConfig(0);
|
||||
|
||||
QList<Qt4ProjectManager::BuildConfigurationInfo> infos;
|
||||
infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion->uniqueId(), config, QString(), QString()));
|
||||
infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion->uniqueId(), config ^ QtSupport::BaseQtVersion::DebugBuild, QString(), QString()));
|
||||
|
||||
return create(parent, id, infos);
|
||||
}
|
||||
|
||||
Qt4BaseTarget *AndroidTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id,
|
||||
const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
|
||||
AndroidTarget *target = 0;
|
||||
if (id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
|
||||
target = new AndroidTarget(static_cast<Qt4Project *>(parent), id);
|
||||
Q_ASSERT(target);
|
||||
|
||||
foreach (const Qt4ProjectManager::BuildConfigurationInfo &info, infos) {
|
||||
QString displayName = info.version()->displayName() + QLatin1Char(' ');
|
||||
displayName += (info.buildConfig & QtSupport::BaseQtVersion::DebugBuild) ? tr("Debug") : tr("Release");
|
||||
target->addQt4BuildConfiguration(displayName, QString(),
|
||||
info.version(),
|
||||
info.buildConfig,
|
||||
info.additionalArguments,
|
||||
info.directory,
|
||||
info.importing);
|
||||
}
|
||||
|
||||
target->addDeployConfiguration(target->createDeployConfiguration(Core::Id(ANDROID_DEPLOYCONFIGURATION_ID)));
|
||||
|
||||
target->createApplicationProFiles(false);
|
||||
if (target->runConfigurations().isEmpty())
|
||||
target->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(target));
|
||||
return target;
|
||||
}
|
||||
|
||||
QString AndroidTargetFactory::buildNameForId(const Core::Id id) const
|
||||
{
|
||||
if (id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
|
||||
return QLatin1String("android");
|
||||
return QString();
|
||||
}
|
@@ -1,70 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QT4ANDROIDTARGETFACTORY_H
|
||||
#define QT4ANDROIDTARGETFACTORY_H
|
||||
|
||||
#include "qt4projectmanager/qt4basetargetfactory.h"
|
||||
#include "qt4projectmanager/qt4target.h"
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidTargetFactory : public Qt4ProjectManager::Qt4BaseTargetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AndroidTargetFactory(QObject *parent = 0);
|
||||
~AndroidTargetFactory();
|
||||
|
||||
QList<Core::Id> supportedTargetIds() const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
QIcon iconForId(const Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
|
||||
bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
|
||||
Qt4ProjectManager::Qt4BaseTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
|
||||
|
||||
bool supportsTargetId(const Core::Id id) const;
|
||||
virtual QSet<QString> targetFeatures(const Core::Id id) const;
|
||||
|
||||
Qt4ProjectManager::Qt4BaseTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
|
||||
Qt4ProjectManager::Qt4BaseTarget *create(ProjectExplorer::Project *parent, const Core::Id id,
|
||||
const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos);
|
||||
|
||||
QString buildNameForId(const Core::Id id) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
#endif // QT4ANDROIDTARGETFACTORY_H
|
@@ -33,7 +33,7 @@
|
||||
#include "androidtoolchain.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidtarget.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidqtversion.h"
|
||||
|
||||
#include "qt4projectmanager/qt4projectmanagerconstants.h"
|
||||
@@ -103,21 +103,17 @@ void AndroidToolChain::addToEnvironment(Utils::Environment &env) const
|
||||
|
||||
// this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info)
|
||||
env.set(QLatin1String("ANDROID_NDK_HOST"), ndk_host);
|
||||
env.set(QLatin1String("ANDROID_NDK_ROOT"),
|
||||
QDir::toNativeSeparators(AndroidConfigurations::instance().config().ndkLocation));
|
||||
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::instance().config().ndkLocation.toUserOutput());
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture()));
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture()));
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), AndroidConfigurations::instance().config().ndkToolchainVersion);
|
||||
|
||||
// TODO that is very ugly and likely to be wrong...
|
||||
Qt4Project *qt4pro = qobject_cast<Qt4Project *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentProject());
|
||||
if (!qt4pro)
|
||||
return;
|
||||
AndroidTarget *at = qobject_cast<AndroidTarget *>(qt4pro->activeTarget());
|
||||
if (!at)
|
||||
if (!qt4pro || !qt4pro->activeTarget())
|
||||
return;
|
||||
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
|
||||
AndroidConfigurations::instance().bestMatch(at->targetSDK()));
|
||||
AndroidConfigurations::instance().bestMatch(AndroidManager::targetSDK(qt4pro->activeTarget())));
|
||||
}
|
||||
|
||||
bool AndroidToolChain::operator ==(const ProjectExplorer::ToolChain &tc) const
|
||||
@@ -202,11 +198,6 @@ QList<ProjectExplorer::Abi> AndroidToolChain::detectSupportedAbis() const
|
||||
return aqv->qtAbis();
|
||||
}
|
||||
|
||||
QString AndroidToolChain::legacyId() const
|
||||
{
|
||||
return QString::fromLatin1("%1:%2").arg(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID)).arg(m_qtVersionId);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// ToolChainConfigWidget
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -218,7 +209,7 @@ AndroidToolChainConfigWidget::AndroidToolChainConfigWidget(AndroidToolChain *tc)
|
||||
QLabel *label = new QLabel;
|
||||
QtSupport::BaseQtVersion *v = QtSupport::QtVersionManager::instance()->version(tc->qtVersionId());
|
||||
Q_ASSERT(v);
|
||||
label->setText(tr("NDK Root: %1").arg(AndroidConfigurations::instance().config().ndkLocation));
|
||||
label->setText(tr("NDK Root: %1").arg(AndroidConfigurations::instance().config().ndkLocation.toUserOutput()));
|
||||
layout->addWidget(label);
|
||||
}
|
||||
|
||||
@@ -323,7 +314,7 @@ QList<ProjectExplorer::ToolChain *> AndroidToolChainFactory::createToolChainList
|
||||
aTc->setDisplayName(tr("Android GCC (%1-%2)")
|
||||
.arg(ProjectExplorer::Abi::toString(aTc->targetAbi().architecture()))
|
||||
.arg(AndroidConfigurations::instance().config().ndkToolchainVersion));
|
||||
aTc->setCompilerCommand(Utils::FileName::fromString(AndroidConfigurations::instance().gccPath(aTc->targetAbi().architecture())));
|
||||
aTc->setCompilerCommand(AndroidConfigurations::instance().gccPath(aTc->targetAbi().architecture()));
|
||||
result.append(aTc);
|
||||
}
|
||||
return result;
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
void setQtVersionId(int);
|
||||
int qtVersionId() const;
|
||||
QString legacyId() const;
|
||||
|
||||
protected:
|
||||
virtual QList<ProjectExplorer::Abi> detectSupportedAbis() const;
|
||||
|
||||
|
@@ -34,11 +34,11 @@
|
||||
|
||||
#include "autogenstep.h"
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolstarget.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -67,9 +67,9 @@ AutogenStepFactory::AutogenStepFactory(QObject *parent) :
|
||||
|
||||
QList<Core::Id> AutogenStepFactory::availableCreationIds(BuildStepList *parent) const
|
||||
{
|
||||
if (parent->target()->project()->id() == Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return QList<Core::Id>() << Core::Id(AUTOGEN_STEP_ID);
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << Core::Id(AUTOGEN_STEP_ID);
|
||||
}
|
||||
|
||||
QString AutogenStepFactory::displayNameForId(const Core::Id id) const
|
||||
@@ -81,13 +81,7 @@ QString AutogenStepFactory::displayNameForId(const Core::Id id) const
|
||||
|
||||
bool AutogenStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
|
||||
{
|
||||
if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return false;
|
||||
|
||||
if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD))
|
||||
return false;
|
||||
|
||||
return Core::Id(AUTOGEN_STEP_ID) == id;
|
||||
return canHandle(parent) && Core::Id(AUTOGEN_STEP_ID) == id;
|
||||
}
|
||||
|
||||
BuildStep *AutogenStepFactory::create(BuildStepList *parent, const Core::Id id)
|
||||
@@ -125,6 +119,13 @@ BuildStep *AutogenStepFactory::restore(BuildStepList *parent, const QVariantMap
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AutogenStepFactory::canHandle(BuildStepList *parent) const
|
||||
{
|
||||
if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return false;
|
||||
return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
// AutogenStep class
|
||||
////////////////////////
|
||||
|
@@ -72,6 +72,8 @@ public:
|
||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source);
|
||||
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
|
||||
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
|
||||
|
||||
bool canHandle(ProjectExplorer::BuildStepList *parent) const;
|
||||
};
|
||||
|
||||
///////////////////////
|
||||
|
@@ -34,11 +34,11 @@
|
||||
|
||||
#include "autoreconfstep.h"
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolstarget.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -66,9 +66,9 @@ AutoreconfStepFactory::AutoreconfStepFactory(QObject *parent) :
|
||||
|
||||
QList<Core::Id> AutoreconfStepFactory::availableCreationIds(BuildStepList *parent) const
|
||||
{
|
||||
if (parent->target()->project()->id() == Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return QList<Core::Id>() << Core::Id(AUTORECONF_STEP_ID);
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << Core::Id(AUTORECONF_STEP_ID);
|
||||
}
|
||||
|
||||
QString AutoreconfStepFactory::displayNameForId(const Core::Id id) const
|
||||
@@ -80,13 +80,7 @@ QString AutoreconfStepFactory::displayNameForId(const Core::Id id) const
|
||||
|
||||
bool AutoreconfStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
|
||||
{
|
||||
if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return false;
|
||||
|
||||
if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD))
|
||||
return false;
|
||||
|
||||
return Core::Id(AUTORECONF_STEP_ID) == id;
|
||||
return canHandle(parent) && Core::Id(AUTORECONF_STEP_ID) == id;
|
||||
}
|
||||
|
||||
BuildStep *AutoreconfStepFactory::create(BuildStepList *parent, const Core::Id id)
|
||||
@@ -124,6 +118,13 @@ BuildStep *AutoreconfStepFactory::restore(BuildStepList *parent, const QVariantM
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AutoreconfStepFactory::canHandle(BuildStepList *parent) const
|
||||
{
|
||||
if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return false;
|
||||
return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
// AutoreconfStep class
|
||||
/////////////////////////
|
||||
|
@@ -72,6 +72,8 @@ public:
|
||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source);
|
||||
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
|
||||
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
|
||||
|
||||
bool canHandle(ProjectExplorer::BuildStepList *parent) const;
|
||||
};
|
||||
|
||||
/////////////////////////
|
||||
|
@@ -35,15 +35,16 @@
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "makestep.h"
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolstarget.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
#include "autogenstep.h"
|
||||
#include "autoreconfstep.h"
|
||||
#include "configurestep.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -58,18 +59,26 @@ using namespace ProjectExplorer::Constants;
|
||||
//////////////////////////////////////
|
||||
// AutotoolsBuildConfiguration class
|
||||
//////////////////////////////////////
|
||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(AutotoolsTarget *parent)
|
||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target *parent)
|
||||
: BuildConfiguration(parent, Core::Id(AUTOTOOLS_BC_ID))
|
||||
{
|
||||
m_buildDirectory = autotoolsTarget()->defaultBuildDirectory();
|
||||
AutotoolsProject *project = qobject_cast<AutotoolsProject *>(parent->project());
|
||||
if (project)
|
||||
m_buildDirectory = project->defaultBuildDirectory();
|
||||
}
|
||||
|
||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(AutotoolsTarget *parent, const Core::Id id)
|
||||
BuildConfigWidget *AutotoolsBuildConfiguration::createConfigWidget()
|
||||
{
|
||||
return new AutotoolsBuildSettingsWidget;
|
||||
}
|
||||
|
||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id)
|
||||
: BuildConfiguration(parent, id)
|
||||
{
|
||||
}
|
||||
|
||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(AutotoolsTarget *parent, AutotoolsBuildConfiguration *source)
|
||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target *parent,
|
||||
AutotoolsBuildConfiguration *source)
|
||||
: BuildConfiguration(parent, source),
|
||||
m_buildDirectory(source->m_buildDirectory)
|
||||
{
|
||||
@@ -88,7 +97,7 @@ bool AutotoolsBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
if (!BuildConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY), autotoolsTarget()->defaultBuildDirectory()).toString();
|
||||
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY)).toString();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -105,14 +114,9 @@ void AutotoolsBuildConfiguration::setBuildDirectory(const QString &buildDirector
|
||||
emit buildDirectoryChanged();
|
||||
}
|
||||
|
||||
AutotoolsTarget *AutotoolsBuildConfiguration::autotoolsTarget() const
|
||||
{
|
||||
return static_cast<AutotoolsTarget *>(target());
|
||||
}
|
||||
|
||||
IOutputParser *AutotoolsBuildConfiguration::createOutputParser() const
|
||||
{
|
||||
ToolChain *tc = autotoolsTarget()->autotoolsProject()->toolChain();
|
||||
ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
|
||||
if (tc)
|
||||
return tc->outputParser();
|
||||
return 0;
|
||||
@@ -126,9 +130,9 @@ AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory(QObject *
|
||||
{
|
||||
}
|
||||
|
||||
QList<Core::Id> AutotoolsBuildConfigurationFactory::availableCreationIds(Target *parent) const
|
||||
QList<Core::Id> AutotoolsBuildConfigurationFactory::availableCreationIds(const Target *parent) const
|
||||
{
|
||||
if (!qobject_cast<AutotoolsTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << Core::Id(AUTOTOOLS_BC_ID);
|
||||
}
|
||||
@@ -140,52 +144,45 @@ QString AutotoolsBuildConfigurationFactory::displayNameForId(const Core::Id id)
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool AutotoolsBuildConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
|
||||
bool AutotoolsBuildConfigurationFactory::canCreate(const Target *parent, const Core::Id id) const
|
||||
{
|
||||
if (!qobject_cast<AutotoolsTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
if (id == Core::Id(AUTOTOOLS_BC_ID))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, const Core::Id id)
|
||||
AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, const Core::Id id, const QString &name)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
|
||||
AutotoolsTarget *t = static_cast<AutotoolsTarget *>(parent);
|
||||
AutotoolsBuildConfiguration *bc = createDefaultConfiguration(t);
|
||||
|
||||
bool ok;
|
||||
QString buildConfigurationName = QInputDialog::getText(0,
|
||||
bool ok = true;
|
||||
QString buildConfigurationName = name;
|
||||
if (buildConfigurationName.isEmpty())
|
||||
buildConfigurationName = QInputDialog::getText(0,
|
||||
tr("New Configuration"),
|
||||
tr("New configuration name:"),
|
||||
QLineEdit::Normal,
|
||||
QString(),
|
||||
&ok);
|
||||
|
||||
QString(), &ok);
|
||||
buildConfigurationName = buildConfigurationName.trimmed();
|
||||
if (!ok || buildConfigurationName.isEmpty())
|
||||
return 0;
|
||||
|
||||
AutotoolsBuildConfiguration *bc = createDefaultConfiguration(parent);
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
|
||||
t->addBuildConfiguration(bc);
|
||||
t->addDeployConfiguration(t->createDeployConfiguration(Core::Id(DEFAULT_DEPLOYCONFIGURATION_ID)));
|
||||
// User needs to choose where the executable file is.
|
||||
// TODO: Parse the file in *Anjuta style* to be able to add custom RunConfigurations.
|
||||
t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
|
||||
|
||||
return bc;
|
||||
}
|
||||
|
||||
AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultConfiguration(AutotoolsTarget *target) const
|
||||
AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultConfiguration(ProjectExplorer::Target *target)
|
||||
{
|
||||
AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(target);
|
||||
BuildStepList *buildSteps = bc->stepList(Core::Id(BUILDSTEPS_BUILD));
|
||||
|
||||
// ### Build Steps Build ###
|
||||
// autogen.sh or autoreconf
|
||||
QFile autogenFile(target->autotoolsProject()->projectDirectory() + QLatin1String("/autogen.sh"));
|
||||
QFile autogenFile(target->project()->projectDirectory() + QLatin1String("/autogen.sh"));
|
||||
if (autogenFile.exists()) {
|
||||
AutogenStep *autogenStep = new AutogenStep(buildSteps);
|
||||
buildSteps->insertStep(0, autogenStep);
|
||||
@@ -214,7 +211,14 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultCo
|
||||
return bc;
|
||||
}
|
||||
|
||||
bool AutotoolsBuildConfigurationFactory::canClone(Target *parent, BuildConfiguration *source) const
|
||||
bool AutotoolsBuildConfigurationFactory::canHandle(const Target *t) const
|
||||
{
|
||||
if (!t->project()->supportsProfile(t->profile()))
|
||||
return false;
|
||||
return t->project()->id() == Core::Id(Constants::AUTOTOOLS_PROJECT_ID);
|
||||
}
|
||||
|
||||
bool AutotoolsBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *source) const
|
||||
{
|
||||
return canCreate(parent, source->id());
|
||||
}
|
||||
@@ -225,11 +229,10 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::clone(Target *p
|
||||
return 0;
|
||||
|
||||
AutotoolsBuildConfiguration *origin = static_cast<AutotoolsBuildConfiguration *>(source);
|
||||
AutotoolsTarget *target(static_cast<AutotoolsTarget *>(parent));
|
||||
return new AutotoolsBuildConfiguration(target, origin);
|
||||
return new AutotoolsBuildConfiguration(parent, origin);
|
||||
}
|
||||
|
||||
bool AutotoolsBuildConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||
bool AutotoolsBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canCreate(parent, idFromMap(map));
|
||||
}
|
||||
@@ -238,8 +241,7 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::restore(Target
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
AutotoolsTarget *target(static_cast<AutotoolsTarget *>(parent));
|
||||
AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(target);
|
||||
AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(parent);
|
||||
if (bc->fromMap(map))
|
||||
return bc;
|
||||
delete bc;
|
||||
@@ -251,3 +253,8 @@ BuildConfiguration::BuildType AutotoolsBuildConfiguration::buildType() const
|
||||
// TODO: Should I return something different from Unknown?
|
||||
return Unknown;
|
||||
}
|
||||
|
||||
void AutotoolsBuildConfiguration::emitBuildDirectoryInitialized()
|
||||
{
|
||||
emit buildDirectoryInitialized();
|
||||
}
|
||||
|
@@ -35,6 +35,8 @@
|
||||
#ifndef AUTOTOOLSBUILDCONFIGURATION_H
|
||||
#define AUTOTOOLSBUILDCONFIGURATION_H
|
||||
|
||||
#include "autotoolsbuildsettingswidget.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
@@ -49,18 +51,21 @@ class AutotoolsBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
friend class AutotoolsBuildConfigurationFactory;
|
||||
|
||||
public:
|
||||
explicit AutotoolsBuildConfiguration(AutotoolsTarget *parent);
|
||||
explicit AutotoolsBuildConfiguration(ProjectExplorer::Target *parent);
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
|
||||
AutotoolsTarget *autotoolsTarget() const;
|
||||
QString buildDirectory() const;
|
||||
void setBuildDirectory(const QString &buildDirectory);
|
||||
QVariantMap toMap() const;
|
||||
ProjectExplorer::IOutputParser *createOutputParser() const;
|
||||
BuildType buildType() const;
|
||||
|
||||
void emitBuildDirectoryInitialized();
|
||||
|
||||
protected:
|
||||
AutotoolsBuildConfiguration(AutotoolsTarget *parent, const Core::Id id);
|
||||
AutotoolsBuildConfiguration(AutotoolsTarget *parent, AutotoolsBuildConfiguration *source);
|
||||
AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id);
|
||||
AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, AutotoolsBuildConfiguration *source);
|
||||
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
@@ -75,16 +80,20 @@ class AutotoolsBuildConfigurationFactory : public ProjectExplorer::IBuildConfigu
|
||||
public:
|
||||
explicit AutotoolsBuildConfigurationFactory(QObject *parent = 0);
|
||||
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
|
||||
QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
|
||||
AutotoolsBuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
|
||||
AutotoolsBuildConfiguration *createDefaultConfiguration(AutotoolsTarget *target) const;
|
||||
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
|
||||
bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
|
||||
AutotoolsBuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
|
||||
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
|
||||
AutotoolsBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
|
||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
AutotoolsBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||
|
||||
static AutotoolsBuildConfiguration *createDefaultConfiguration(ProjectExplorer::Target *target);
|
||||
|
||||
private:
|
||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
@@ -50,10 +50,7 @@ using namespace AutotoolsProjectManager;
|
||||
using namespace AutotoolsProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsTarget *target) :
|
||||
m_target(target),
|
||||
m_pathChooser(0),
|
||||
m_toolChainChooser(0),
|
||||
AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget() :
|
||||
m_buildConfiguration(0)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
@@ -63,23 +60,8 @@ AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsTarget *targ
|
||||
m_pathChooser = new Utils::PathChooser(this);
|
||||
m_pathChooser->setEnabled(true);
|
||||
m_pathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_pathChooser->setBaseDirectory(m_target->autotoolsProject()->projectDirectory());
|
||||
fl->addRow(tr("Build directory:"), m_pathChooser);
|
||||
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
|
||||
|
||||
// tool chain
|
||||
m_toolChainChooser = new QComboBox;
|
||||
m_toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
updateToolChainList();
|
||||
|
||||
fl->addRow(tr("Tool chain:"), m_toolChainChooser);
|
||||
connect(m_toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
|
||||
connect(m_target->autotoolsProject(), SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(toolChainChanged(ProjectExplorer::ToolChain*)));
|
||||
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(updateToolChainList()));
|
||||
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(updateToolChainList()));
|
||||
}
|
||||
|
||||
QString AutotoolsBuildSettingsWidget::displayName() const
|
||||
@@ -90,6 +72,7 @@ QString AutotoolsBuildSettingsWidget::displayName() const
|
||||
void AutotoolsBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = static_cast<AutotoolsBuildConfiguration *>(bc);
|
||||
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
|
||||
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
|
||||
}
|
||||
|
||||
@@ -97,39 +80,3 @@ void AutotoolsBuildSettingsWidget::buildDirectoryChanged()
|
||||
{
|
||||
m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
|
||||
}
|
||||
|
||||
void AutotoolsBuildSettingsWidget::toolChainSelected(int index)
|
||||
{
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
ToolChain *tc = static_cast<ToolChain *>(m_toolChainChooser->itemData(index).value<void *>());
|
||||
m_target->autotoolsProject()->setToolChain(tc);
|
||||
}
|
||||
|
||||
void AutotoolsBuildSettingsWidget::toolChainChanged(ProjectExplorer::ToolChain *tc)
|
||||
{
|
||||
for (int i = 0; i < m_toolChainChooser->count(); ++i) {
|
||||
ToolChain *currentTc = static_cast<ToolChain *>(m_toolChainChooser->itemData(i).value<void *>());
|
||||
if (currentTc != tc)
|
||||
continue;
|
||||
m_toolChainChooser->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AutotoolsBuildSettingsWidget::updateToolChainList()
|
||||
{
|
||||
m_toolChainChooser->clear();
|
||||
|
||||
QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains();
|
||||
if (!m_target->autotoolsProject()->toolChain()) {
|
||||
m_toolChainChooser->addItem(tr("<Invalid tool chain>"), qVariantFromValue(static_cast<void *>(0)));
|
||||
m_toolChainChooser->setCurrentIndex(0);
|
||||
}
|
||||
foreach (ToolChain *tc, tcs) {
|
||||
m_toolChainChooser->addItem(tc->displayName(), qVariantFromValue(static_cast<void *>(tc)));
|
||||
if (m_target->autotoolsProject()->toolChain()
|
||||
&& m_target->autotoolsProject()->toolChain()->id() == tc->id())
|
||||
m_toolChainChooser->setCurrentIndex(m_toolChainChooser->count() - 1);
|
||||
}
|
||||
}
|
||||
|
@@ -35,12 +35,10 @@
|
||||
#ifndef AUTOTOOLSBUILDSETTINGSWIDGET_H
|
||||
#define AUTOTOOLSBUILDSETTINGSWIDGET_H
|
||||
|
||||
#include "autotoolstarget.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
@@ -51,7 +49,7 @@ QT_END_NAMESPACE
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class AutotoolsProject;
|
||||
class AutotoolsBuildConfiguration;
|
||||
|
||||
/**
|
||||
* @brief Implementation of ProjectExplorer::BuildConfigWidget interface.
|
||||
@@ -63,21 +61,16 @@ class AutotoolsBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AutotoolsBuildSettingsWidget(AutotoolsTarget *target);
|
||||
AutotoolsBuildSettingsWidget();
|
||||
|
||||
QString displayName() const;
|
||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void buildDirectoryChanged();
|
||||
void toolChainSelected(int index);
|
||||
void toolChainChanged(ProjectExplorer::ToolChain *tc);
|
||||
void updateToolChainList();
|
||||
|
||||
private:
|
||||
AutotoolsTarget *m_target;
|
||||
Utils::PathChooser *m_pathChooser;
|
||||
QComboBox *m_toolChainChooser;
|
||||
AutotoolsBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
#include "autotoolsmanager.h"
|
||||
#include "autotoolsprojectnode.h"
|
||||
@@ -43,10 +44,12 @@
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/buildenvironmentwidget.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/profilemanager.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <cpptools/ModelManagerInterface.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -65,8 +68,6 @@ using namespace AutotoolsProjectManager;
|
||||
using namespace AutotoolsProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
const char TOOLCHAIN_KEY[] = "AutotoolsProjectManager.AutotoolsProject.Toolchain";
|
||||
|
||||
AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fileName) :
|
||||
m_manager(manager),
|
||||
m_fileName(fileName),
|
||||
@@ -75,8 +76,7 @@ AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fil
|
||||
m_rootNode(new AutotoolsProjectNode(this, m_file)),
|
||||
m_fileWatcher(new Utils::FileSystemWatcher(this)),
|
||||
m_watchedFiles(),
|
||||
m_makefileParserThread(0),
|
||||
m_toolChain(0)
|
||||
m_makefileParserThread(0)
|
||||
{
|
||||
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
|
||||
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
|
||||
@@ -103,26 +103,6 @@ AutotoolsProject::~AutotoolsProject()
|
||||
}
|
||||
}
|
||||
|
||||
void AutotoolsProject::setToolChain(ToolChain *tc)
|
||||
{
|
||||
if (m_toolChain == tc)
|
||||
return;
|
||||
|
||||
m_toolChain = tc;
|
||||
|
||||
foreach (Target *t, targets()) {
|
||||
foreach (BuildConfiguration *bc, t->buildConfigurations())
|
||||
bc->setToolChain(tc);
|
||||
}
|
||||
|
||||
emit toolChainChanged(m_toolChain);
|
||||
}
|
||||
|
||||
ToolChain *AutotoolsProject::toolChain() const
|
||||
{
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
QString AutotoolsProject::displayName() const
|
||||
{
|
||||
return m_projectName;
|
||||
@@ -143,11 +123,6 @@ IProjectManager *AutotoolsProject::projectManager() const
|
||||
return m_manager;
|
||||
}
|
||||
|
||||
AutotoolsTarget *AutotoolsProject::activeTarget() const
|
||||
{
|
||||
return static_cast<AutotoolsTarget *>(Project::activeTarget());
|
||||
}
|
||||
|
||||
QString AutotoolsProject::defaultBuildDirectory() const
|
||||
{
|
||||
return projectDirectory();
|
||||
@@ -169,13 +144,6 @@ QStringList AutotoolsProject::files(FilesMode fileMode) const
|
||||
return m_files;
|
||||
}
|
||||
|
||||
QVariantMap AutotoolsProject::toMap() const
|
||||
{
|
||||
QVariantMap map = Project::toMap();
|
||||
map.insert(QLatin1String(TOOLCHAIN_KEY), m_toolChain ? m_toolChain->id() : QString());
|
||||
return map;
|
||||
}
|
||||
|
||||
// This function, is called at the very beginning, to
|
||||
// restore the settings if there are some stored.
|
||||
bool AutotoolsProject::fromMap(const QVariantMap &map)
|
||||
@@ -183,57 +151,19 @@ bool AutotoolsProject::fromMap(const QVariantMap &map)
|
||||
if (!Project::fromMap(map))
|
||||
return false;
|
||||
|
||||
// Check if this project was already loaded by checking
|
||||
// if there already exists a .user file.
|
||||
bool hasUserFile = activeTarget();
|
||||
if (!hasUserFile) {
|
||||
AutotoolsTargetFactory *factory =
|
||||
ExtensionSystem::PluginManager::getObject<AutotoolsTargetFactory>();
|
||||
AutotoolsTarget *t = factory->create(this, Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID));
|
||||
|
||||
QTC_ASSERT(t, return false);
|
||||
QTC_ASSERT(t->activeBuildConfiguration(), return false);
|
||||
|
||||
// Ask the user for where he/she wants to build it.
|
||||
QPointer<AutotoolsOpenProjectWizard> wizard = new AutotoolsOpenProjectWizard(m_manager, projectDirectory());
|
||||
if (!wizard->exec() == QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
AutotoolsBuildConfiguration *bc =
|
||||
static_cast<AutotoolsBuildConfiguration *>(t->buildConfigurations().at(0));
|
||||
if (!wizard->buildDirectory().isEmpty())
|
||||
bc->setBuildDirectory(wizard->buildDirectory());
|
||||
|
||||
addTarget(t);
|
||||
}
|
||||
|
||||
// Toolchain
|
||||
QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
|
||||
const ToolChainManager *toolChainManager = ToolChainManager::instance();
|
||||
|
||||
if (!id.isNull()) {
|
||||
setToolChain(toolChainManager->findToolChain(id));
|
||||
} else {
|
||||
Abi abi = Abi::hostAbi();
|
||||
abi = Abi(abi.architecture(), abi.os(), Abi::UnknownFlavor,
|
||||
abi.binaryFormat(), abi.wordWidth() == 32 ? 32 : 0);
|
||||
QList<ToolChain *> tcs = toolChainManager->findToolChains(abi);
|
||||
if (tcs.isEmpty())
|
||||
tcs = toolChainManager->toolChains();
|
||||
if (!tcs.isEmpty())
|
||||
setToolChain(tcs.at(0));
|
||||
}
|
||||
|
||||
connect(m_fileWatcher, SIGNAL(fileChanged(QString)),
|
||||
this, SLOT(onFileChanged(QString)));
|
||||
|
||||
// Load the project tree structure.
|
||||
loadProjectTree();
|
||||
evaluateBuildSystem();
|
||||
|
||||
if (!activeTarget())
|
||||
addTarget(createTarget(ProfileManager::instance()->defaultProfile()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutotoolsProject::loadProjectTree()
|
||||
void AutotoolsProject::evaluateBuildSystem()
|
||||
{
|
||||
if (m_makefileParserThread != 0) {
|
||||
// The thread is still busy parsing a previus configuration.
|
||||
@@ -325,12 +255,14 @@ void AutotoolsProject::makefileParsingFinished()
|
||||
|
||||
m_makefileParserThread->deleteLater();
|
||||
m_makefileParserThread = 0;
|
||||
|
||||
buildSystemEvaluationFinished(true);
|
||||
}
|
||||
|
||||
void AutotoolsProject::onFileChanged(const QString &file)
|
||||
{
|
||||
Q_UNUSED(file);
|
||||
loadProjectTree();
|
||||
evaluateBuildSystem();
|
||||
}
|
||||
|
||||
QStringList AutotoolsProject::buildTargets() const
|
||||
@@ -483,15 +415,20 @@ void AutotoolsProject::updateCppCodeModel()
|
||||
|
||||
QStringList allIncludePaths = m_makefileParserThread->includePaths();
|
||||
QStringList allFrameworkPaths;
|
||||
QByteArray macros;
|
||||
|
||||
if (m_toolChain) {
|
||||
const QList<HeaderPath> allHeaderPaths = m_toolChain->systemHeaderPaths();
|
||||
if (activeTarget()) {
|
||||
ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(activeTarget()->profile());
|
||||
if (tc) {
|
||||
const QList<HeaderPath> allHeaderPaths = tc->systemHeaderPaths();
|
||||
foreach (const HeaderPath &headerPath, allHeaderPaths) {
|
||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath) {
|
||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
||||
allFrameworkPaths.append(headerPath.path());
|
||||
} else {
|
||||
else
|
||||
allIncludePaths.append(headerPath.path());
|
||||
}
|
||||
macros = tc->predefinedMacros(QStringList());
|
||||
macros += '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,7 +436,7 @@ void AutotoolsProject::updateCppCodeModel()
|
||||
|
||||
const bool update = (pinfo.includePaths() != allIncludePaths)
|
||||
|| (pinfo.sourceFiles() != m_files)
|
||||
|| (pinfo.defines() != m_toolChain->predefinedMacros(QStringList()))
|
||||
|| (pinfo.defines() != macros)
|
||||
|| (pinfo.frameworkPaths() != allFrameworkPaths);
|
||||
if (update) {
|
||||
pinfo.clearProjectParts();
|
||||
@@ -507,8 +444,7 @@ void AutotoolsProject::updateCppCodeModel()
|
||||
new CPlusPlus::CppModelManagerInterface::ProjectPart);
|
||||
part->includePaths = allIncludePaths;
|
||||
part->sourceFiles = m_files;
|
||||
if (m_toolChain)
|
||||
part->defines = m_toolChain->predefinedMacros(QStringList());
|
||||
part->defines = macros;
|
||||
part->frameworkPaths = allFrameworkPaths;
|
||||
part->language = CPlusPlus::CppModelManagerInterface::CXX;
|
||||
pinfo.appendProjectPart(part);
|
||||
|
@@ -35,10 +35,7 @@
|
||||
#ifndef AUTOTOOLSPROJECT_H
|
||||
#define AUTOTOOLSPROJECT_H
|
||||
|
||||
#include "autotoolstarget.h"
|
||||
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
@@ -47,10 +44,6 @@
|
||||
#include <QPointer>
|
||||
#include <QDir>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class ToolChain;
|
||||
}
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
class AutotoolsConfigurationFactory;
|
||||
@@ -80,18 +73,11 @@ public:
|
||||
Core::Id id() const;
|
||||
Core::IDocument *document() const;
|
||||
ProjectExplorer::IProjectManager *projectManager() const;
|
||||
AutotoolsTarget *activeTarget() const;
|
||||
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
||||
QStringList files(FilesMode fileMode) const;
|
||||
QString defaultBuildDirectory() const;
|
||||
QStringList buildTargets() const;
|
||||
ProjectExplorer::ToolChain *toolChain() const;
|
||||
void setToolChain(ProjectExplorer::ToolChain *tc);
|
||||
QVariantMap toMap() const;
|
||||
|
||||
signals:
|
||||
void toolChainChanged(ProjectExplorer::ToolChain *tc);
|
||||
|
||||
protected:
|
||||
bool fromMap(const QVariantMap &map);
|
||||
@@ -100,7 +86,7 @@ private slots:
|
||||
/**
|
||||
* Loads the project tree by parsing the makefiles.
|
||||
*/
|
||||
void loadProjectTree();
|
||||
void evaluateBuildSystem();
|
||||
|
||||
/**
|
||||
* Is invoked when the makefile parsing by m_makefileParserThread has
|
||||
@@ -171,8 +157,6 @@ private:
|
||||
|
||||
/// Responsible for parsing the makefiles asynchronously in a thread
|
||||
MakefileParserThread *m_makefileParserThread;
|
||||
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -46,9 +46,6 @@ namespace Constants {
|
||||
const char AUTOTOOLS_BC_ID[] = "AutotoolsProjectManager.AutotoolsBuildConfiguration";
|
||||
const char BUILD_DIRECTORY_KEY[] = "AutotoolsProjectManager.AutotoolsBuildConfiguration.BuildDirectory";
|
||||
|
||||
//Target
|
||||
const char DEFAULT_AUTOTOOLS_TARGET_ID[] = "AutotoolsProjectManager.DefaultAutotoolsTarget";
|
||||
|
||||
//Project
|
||||
const char AUTOTOOLS_PROJECT_ID[] = "AutotoolsProjectManager.AutotoolsProject";
|
||||
const char PROJECT_CONTEXT[] = "AutotoolsProject.ProjectContext";
|
||||
|
@@ -12,7 +12,6 @@ HEADERS = autotoolsprojectplugin.h\
|
||||
autotoolsprojectfile.h\
|
||||
autotoolsprojectnode.h\
|
||||
autotoolsproject.h\
|
||||
autotoolstarget.h\
|
||||
autotoolsbuildsettingswidget.h\
|
||||
autotoolsbuildconfiguration.h\
|
||||
autotoolsprojectconstants.h\
|
||||
@@ -28,7 +27,6 @@ SOURCES = autotoolsprojectplugin.cpp\
|
||||
autotoolsprojectfile.cpp\
|
||||
autotoolsprojectnode.cpp\
|
||||
autotoolsproject.cpp\
|
||||
autotoolstarget.cpp\
|
||||
autotoolsbuildsettingswidget.cpp\
|
||||
autotoolsbuildconfiguration.cpp\
|
||||
makestep.cpp\
|
||||
|
@@ -43,8 +43,6 @@ QtcPlugin {
|
||||
"autotoolsprojectnode.h",
|
||||
"autotoolsprojectplugin.cpp",
|
||||
"autotoolsprojectplugin.h",
|
||||
"autotoolstarget.cpp",
|
||||
"autotoolstarget.h",
|
||||
"configurestep.cpp",
|
||||
"configurestep.h",
|
||||
"makefileparser.cpp",
|
||||
|
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "autotoolsprojectplugin.h"
|
||||
#include "autotoolsmanager.h"
|
||||
#include "autotoolstarget.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "makestep.h"
|
||||
#include "autogenstep.h"
|
||||
@@ -66,7 +65,7 @@ bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
|
||||
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":autotoolsproject/AutotoolsProject.mimetypes.xml"), errorString))
|
||||
return false;
|
||||
|
||||
addAutoReleasedObject(new AutotoolsTargetFactory);
|
||||
addAutoReleasedObject(new AutotoolsBuildConfigurationFactory);
|
||||
addAutoReleasedObject(new MakeStepFactory);
|
||||
addAutoReleasedObject(new AutogenStepFactory);
|
||||
addAutoReleasedObject(new ConfigureStepFactory);
|
||||
|
@@ -1,175 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010-2011 Openismus GmbH.
|
||||
** Authors: Peter Penz (ppenz@openismus.com)
|
||||
** Patricia Santana Cruz (patriciasantanacruz@gmail.com)
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "autotoolstarget.h"
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
#include "autotoolsbuildsettingswidget.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "makestep.h"
|
||||
#include "autogenstep.h"
|
||||
#include "autoreconfstep.h"
|
||||
#include "configurestep.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStyle>
|
||||
|
||||
using namespace AutotoolsProjectManager;
|
||||
using namespace AutotoolsProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
static QString displayNameForId(const Core::Id id)
|
||||
{
|
||||
if (id == Core::Id(AutotoolsProjectManager::Constants::DEFAULT_AUTOTOOLS_TARGET_ID))
|
||||
return QApplication::translate("AutotoolsProjectManager::Internal::AutotoolsTarget",
|
||||
"Desktop", "Autotools Default target display name");
|
||||
return QString();
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
// AutotoolsTarget class
|
||||
//////////////////////////
|
||||
|
||||
AutotoolsTarget::AutotoolsTarget(AutotoolsProject *parent) :
|
||||
Target(parent, Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID)),
|
||||
m_buildConfigurationFactory(new AutotoolsBuildConfigurationFactory(this))
|
||||
{
|
||||
setDefaultDisplayName(displayNameForId(id()));
|
||||
setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
|
||||
}
|
||||
|
||||
BuildConfigWidget *AutotoolsTarget::createConfigWidget()
|
||||
{
|
||||
return new AutotoolsBuildSettingsWidget(this);
|
||||
}
|
||||
|
||||
|
||||
AutotoolsProject *AutotoolsTarget::autotoolsProject() const
|
||||
{
|
||||
return static_cast<AutotoolsProject *>(project());
|
||||
}
|
||||
|
||||
AutotoolsBuildConfiguration *AutotoolsTarget::activeBuildConfiguration() const
|
||||
{
|
||||
return static_cast<AutotoolsBuildConfiguration *>(Target::activeBuildConfiguration());
|
||||
}
|
||||
|
||||
AutotoolsBuildConfigurationFactory *AutotoolsTarget::buildConfigurationFactory() const
|
||||
{
|
||||
return m_buildConfigurationFactory;
|
||||
}
|
||||
|
||||
QString AutotoolsTarget::defaultBuildDirectory() const
|
||||
{
|
||||
return autotoolsProject()->defaultBuildDirectory();
|
||||
}
|
||||
|
||||
bool AutotoolsTarget::fromMap(const QVariantMap &map)
|
||||
{
|
||||
return Target::fromMap(map);
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
// AutotoolsTargetFactory class
|
||||
/////////////////////////////////
|
||||
AutotoolsTargetFactory::AutotoolsTargetFactory(QObject *parent) :
|
||||
ITargetFactory(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool AutotoolsTargetFactory::supportsTargetId(const Core::Id id) const
|
||||
{
|
||||
return id == Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID);
|
||||
}
|
||||
|
||||
QList<Core::Id> AutotoolsTargetFactory::supportedTargetIds() const
|
||||
{
|
||||
return QList<Core::Id>() << Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID);
|
||||
}
|
||||
|
||||
QString AutotoolsTargetFactory::displayNameForId(const Core::Id id) const
|
||||
{
|
||||
return ::displayNameForId(id);
|
||||
}
|
||||
|
||||
bool AutotoolsTargetFactory::canCreate(Project *parent, const Core::Id id) const
|
||||
{
|
||||
if (!qobject_cast<AutotoolsProject *>(parent))
|
||||
return false;
|
||||
return id == Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID);
|
||||
}
|
||||
|
||||
AutotoolsTarget *AutotoolsTargetFactory::create(Project *parent, const Core::Id id)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
|
||||
AutotoolsProject *project(static_cast<AutotoolsProject *>(parent));
|
||||
AutotoolsTarget *t = new AutotoolsTarget(project);
|
||||
|
||||
// Add default build configuration:
|
||||
AutotoolsBuildConfigurationFactory *bcf = t->buildConfigurationFactory();
|
||||
AutotoolsBuildConfiguration *bc = bcf->createDefaultConfiguration(t);
|
||||
bc->setDisplayName(tr("Default Build"));
|
||||
|
||||
t->addBuildConfiguration(bc);
|
||||
t->addDeployConfiguration(t->createDeployConfiguration(Core::Id(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID)));
|
||||
// User needs to choose where the executable file is.
|
||||
// TODO: Parse the file in *Anjuta style* to be able to add custom RunConfigurations.
|
||||
t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
bool AutotoolsTargetFactory::canRestore(Project *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canCreate(parent, idFromMap(map));
|
||||
}
|
||||
|
||||
AutotoolsTarget *AutotoolsTargetFactory::restore(Project *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
AutotoolsProject *autotoolsproject(static_cast<AutotoolsProject *>(parent));
|
||||
AutotoolsTarget *target = new AutotoolsTarget(autotoolsproject);
|
||||
if (target->fromMap(map))
|
||||
return target;
|
||||
delete target;
|
||||
return 0;
|
||||
}
|
@@ -1,99 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010-2011 Openismus GmbH.
|
||||
** Authors: Peter Penz (ppenz@openismus.com)
|
||||
** Patricia Santana Cruz (patriciasantanacruz@gmail.com)
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef AUTOTOOLSTARGET_H
|
||||
#define AUTOTOOLSTARGET_H
|
||||
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class AutotoolsTargetFactory;
|
||||
class AutotoolsBuildConfiguration;
|
||||
class AutotoolsBuildConfigurationFactory;
|
||||
class AutotoolsProject;
|
||||
|
||||
///////////////////////////
|
||||
//// AutotoolsTarget class
|
||||
///////////////////////////
|
||||
class AutotoolsTarget : public ProjectExplorer::Target
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class AutotoolsTargetFactory;
|
||||
|
||||
public:
|
||||
explicit AutotoolsTarget(AutotoolsProject *parent);
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
AutotoolsProject *autotoolsProject() const;
|
||||
AutotoolsBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||
AutotoolsBuildConfiguration *activeBuildConfiguration() const;
|
||||
QString defaultBuildDirectory() const;
|
||||
|
||||
protected:
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
AutotoolsBuildConfigurationFactory *m_buildConfigurationFactory;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
//// AutotoolsTargetFactory class
|
||||
//////////////////////////////////
|
||||
class AutotoolsTargetFactory : public ProjectExplorer::ITargetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AutotoolsTargetFactory(QObject *parent = 0);
|
||||
|
||||
bool supportsTargetId(const Core::Id id) const;
|
||||
|
||||
QList<Core::Id> supportedTargetIds() const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
|
||||
AutotoolsTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
|
||||
bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
|
||||
AutotoolsTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AutotoolsProjectManager
|
||||
|
||||
#endif // AUTOTOOLSTARGET_H
|
@@ -34,11 +34,11 @@
|
||||
|
||||
#include "configurestep.h"
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolstarget.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -67,9 +67,9 @@ ConfigureStepFactory::ConfigureStepFactory(QObject *parent) :
|
||||
|
||||
QList<Core::Id> ConfigureStepFactory::availableCreationIds(BuildStepList *parent) const
|
||||
{
|
||||
if (parent->target()->project()->id() == Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return QList<Core::Id>() << Core::Id(CONFIGURE_STEP_ID);
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << Core::Id(CONFIGURE_STEP_ID);
|
||||
}
|
||||
|
||||
QString ConfigureStepFactory::displayNameForId(const Core::Id id) const
|
||||
@@ -81,13 +81,7 @@ QString ConfigureStepFactory::displayNameForId(const Core::Id id) const
|
||||
|
||||
bool ConfigureStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
|
||||
{
|
||||
if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return false;
|
||||
|
||||
if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD))
|
||||
return false;
|
||||
|
||||
return Core::Id(CONFIGURE_STEP_ID) == id;
|
||||
return canHandle(parent) && Core::Id(CONFIGURE_STEP_ID) == id;
|
||||
}
|
||||
|
||||
BuildStep *ConfigureStepFactory::create(BuildStepList *parent, const Core::Id id)
|
||||
@@ -125,6 +119,13 @@ BuildStep *ConfigureStepFactory::restore(BuildStepList *parent, const QVariantMa
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ConfigureStepFactory::canHandle(BuildStepList *parent) const
|
||||
{
|
||||
if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
|
||||
return false;
|
||||
return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
// ConfigureStep class
|
||||
////////////////////////
|
||||
@@ -229,6 +230,19 @@ QVariantMap ConfigureStep::toMap() const
|
||||
return map;
|
||||
}
|
||||
|
||||
bool ConfigureStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
|
||||
{
|
||||
if (exitCode != 0 || status != QProcess::NormalExit)
|
||||
return false;
|
||||
AutotoolsBuildConfiguration *bc = qobject_cast<AutotoolsBuildConfiguration *>(buildConfiguration());
|
||||
if (!bc)
|
||||
bc = qobject_cast<AutotoolsBuildConfiguration *>(target()->activeBuildConfiguration());
|
||||
if (!bc)
|
||||
return true;
|
||||
bc->emitBuildDirectoryInitialized();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfigureStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_additionalArguments = map.value(QLatin1String(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY)).toString();
|
||||
|
@@ -72,6 +72,8 @@ public:
|
||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source);
|
||||
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
|
||||
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
|
||||
|
||||
bool canHandle(ProjectExplorer::BuildStepList *parent) const;
|
||||
};
|
||||
|
||||
//////////////////////////
|
||||
@@ -104,6 +106,8 @@ public:
|
||||
QString additionalArguments() const;
|
||||
QVariantMap toMap() const;
|
||||
|
||||
bool processSucceeded(int exitCode, QProcess::ExitStatus status);
|
||||
|
||||
public slots:
|
||||
void setAdditionalArguments(const QString &list);
|
||||
|
||||
|
@@ -36,11 +36,12 @@
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "autotoolstarget.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -65,8 +66,7 @@ const char MAKE_STEP_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.MakeS
|
||||
//////////////////////////
|
||||
MakeStepFactory::MakeStepFactory(QObject *parent) :
|
||||
IBuildStepFactory(parent)
|
||||
{
|
||||
}
|
||||
{ setObjectName(QLatin1String("Autotools::MakeStepFactory")); }
|
||||
|
||||
QList<Core::Id> MakeStepFactory::availableCreationIds(BuildStepList *parent) const
|
||||
{
|
||||
@@ -87,9 +87,6 @@ bool MakeStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
|
||||
if (parent->target()->project()->id() != Core::Id(AUTOTOOLS_PROJECT_ID))
|
||||
return false;
|
||||
|
||||
if (parent->id() != Core::Id(BUILDSTEPS_BUILD))
|
||||
return false;
|
||||
|
||||
return Core::Id(MAKE_STEP_ID) == id;
|
||||
}
|
||||
|
||||
@@ -178,16 +175,18 @@ bool MakeStep::init()
|
||||
|
||||
setIgnoreReturnValue(m_clean);
|
||||
|
||||
ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(bc->target()->profile());
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setEnvironment(bc->environment());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
pp->setCommand(bc->toolChain()->makeCommand());
|
||||
pp->setCommand(tc ? tc->makeCommand() : QLatin1String("make"));
|
||||
pp->setArguments(arguments);
|
||||
|
||||
setOutputParser(new GnuMakeParser());
|
||||
if (bc->autotoolsTarget()->autotoolsProject()->toolChain())
|
||||
appendOutputParser(bc->autotoolsTarget()->autotoolsProject()->toolChain()->outputParser());
|
||||
if (tc)
|
||||
appendOutputParser(tc->outputParser());
|
||||
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
|
||||
|
||||
return AbstractProcessStep::init();
|
||||
@@ -291,7 +290,7 @@ QString MakeStepConfigWidget::summaryText() const
|
||||
void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
AutotoolsBuildConfiguration *bc = m_makeStep->autotoolsBuildConfiguration();
|
||||
ToolChain *tc = bc->toolChain();
|
||||
ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(m_makeStep->target()->profile());
|
||||
|
||||
if (tc) {
|
||||
QString arguments = Utils::QtcProcess::joinArgs(m_makeStep->m_buildTargets);
|
||||
@@ -305,7 +304,7 @@ void MakeStepConfigWidget::updateDetails()
|
||||
param.setArguments(arguments);
|
||||
m_summaryText = param.summary(displayName());
|
||||
} else {
|
||||
m_summaryText = tr("<b>Unknown tool chain</b>");
|
||||
m_summaryText = tr("<b>No tool chain set up for this profile</b>");
|
||||
}
|
||||
|
||||
emit updateSummary();
|
||||
|
@@ -34,12 +34,11 @@
|
||||
|
||||
#include "cmakeopenprojectwizard.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmaketarget.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QInputDialog>
|
||||
@@ -49,17 +48,19 @@ using namespace Internal;
|
||||
|
||||
namespace {
|
||||
const char CMAKE_BC_ID[] = "CMakeProjectManager.CMakeBuildConfiguration";
|
||||
const char TOOLCHAIN_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.ToolChain";
|
||||
const char BUILD_DIRECTORY_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory";
|
||||
} // namespace
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent) :
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
|
||||
BuildConfiguration(parent, Core::Id(CMAKE_BC_ID))
|
||||
{
|
||||
m_buildDirectory = cmakeTarget()->defaultBuildDirectory();
|
||||
CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
|
||||
if (project)
|
||||
m_buildDirectory = project->defaultBuildDirectory();
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuildConfiguration *source) :
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
||||
CMakeBuildConfiguration *source) :
|
||||
BuildConfiguration(parent, source),
|
||||
m_buildDirectory(source->m_buildDirectory),
|
||||
m_msvcVersion(source->m_msvcVersion)
|
||||
@@ -71,7 +72,6 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuild
|
||||
QVariantMap CMakeBuildConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
|
||||
map.insert(QLatin1String(TOOLCHAIN_KEY), toolChain() ? toolChain()->id() : QString());
|
||||
map.insert(QLatin1String(BUILD_DIRECTORY_KEY), m_buildDirectory);
|
||||
return map;
|
||||
}
|
||||
@@ -81,46 +81,17 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
if (!BuildConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
setToolChain(ProjectExplorer::ToolChainManager::instance()->
|
||||
findToolChain(map.value(QLatin1String(TOOLCHAIN_KEY)).toString()));
|
||||
|
||||
if (!toolChain()) {
|
||||
// restoring from older versions?
|
||||
QList<ProjectExplorer::ToolChain *> list = ProjectExplorer::ToolChainManager::instance()->toolChains();
|
||||
if (!map.value("CMakeProjectManager.CMakeBuildConfiguration.MsvcVersion").toString().isEmpty()) {
|
||||
foreach (ProjectExplorer::ToolChain *tc, list) {
|
||||
if (tc->id().startsWith(ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID)) {
|
||||
setToolChain(tc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef Q_OS_WIN
|
||||
QString toolChainId = ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID;
|
||||
#else
|
||||
QString toolChainId = ProjectExplorer::Constants::GCC_TOOLCHAIN_ID;
|
||||
#endif
|
||||
foreach (ProjectExplorer::ToolChain *tc, list) {
|
||||
if (tc->id().startsWith(toolChainId)) {
|
||||
setToolChain(tc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY), cmakeTarget()->defaultBuildDirectory()).toString();
|
||||
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY)).toString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
CMakeTarget *CMakeBuildConfiguration::cmakeTarget() const
|
||||
ProjectExplorer::BuildConfigWidget *CMakeBuildConfiguration::createConfigWidget()
|
||||
{
|
||||
return static_cast<CMakeTarget *>(target());
|
||||
return new CMakeBuildSettingsWidget;
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::buildDirectory() const
|
||||
@@ -139,16 +110,16 @@ void CMakeBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
||||
|
||||
ProjectExplorer::IOutputParser *CMakeBuildConfiguration::createOutputParser() const
|
||||
{
|
||||
if (toolChain())
|
||||
return toolChain()->outputParser();
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
|
||||
if (tc)
|
||||
return tc->outputParser();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Utils::Environment CMakeBuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
Utils::Environment env = BuildConfiguration::baseEnvironment();
|
||||
if (toolChain())
|
||||
toolChain()->addToEnvironment(env);
|
||||
target()->profile()->addToEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
@@ -165,9 +136,9 @@ CMakeBuildConfigurationFactory::~CMakeBuildConfigurationFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QList<Core::Id> CMakeBuildConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
QList<Core::Id> CMakeBuildConfigurationFactory::availableCreationIds(const ProjectExplorer::Target *parent) const
|
||||
{
|
||||
if (!qobject_cast<CMakeTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << Core::Id(CMAKE_BC_ID);
|
||||
}
|
||||
@@ -179,34 +150,37 @@ QString CMakeBuildConfigurationFactory::displayNameForId(const Core::Id id) cons
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool CMakeBuildConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
bool CMakeBuildConfigurationFactory::canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
{
|
||||
if (!qobject_cast<CMakeTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
if (id == Core::Id(CMAKE_BC_ID))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
|
||||
CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
|
||||
CMakeTarget *cmtarget = static_cast<CMakeTarget *>(parent);
|
||||
Q_ASSERT(cmtarget);
|
||||
CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
|
||||
if (!project)
|
||||
return 0;
|
||||
|
||||
//TODO configuration name should be part of the cmakeopenprojectwizard
|
||||
bool ok;
|
||||
QString buildConfigurationName = QInputDialog::getText(0,
|
||||
bool ok = true;
|
||||
QString buildConfigurationName = name;
|
||||
if (buildConfigurationName.isEmpty())
|
||||
buildConfigurationName = QInputDialog::getText(0,
|
||||
tr("New Configuration"),
|
||||
tr("New configuration name:"),
|
||||
QLineEdit::Normal,
|
||||
QString(),
|
||||
&ok);
|
||||
QString(), &ok);
|
||||
buildConfigurationName = buildConfigurationName.trimmed();
|
||||
if (!ok || buildConfigurationName.isEmpty())
|
||||
return 0;
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(cmtarget);
|
||||
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
|
||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
@@ -220,28 +194,25 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
|
||||
cleanMakeStep->setAdditionalArguments("clean");
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
CMakeOpenProjectWizard copw(cmtarget->cmakeProject()->projectManager(),
|
||||
cmtarget->project()->projectDirectory(),
|
||||
CMakeOpenProjectWizard copw(project->projectManager(),
|
||||
project->projectDirectory(),
|
||||
bc->buildDirectory(),
|
||||
bc->environment());
|
||||
if (copw.exec() != QDialog::Accepted) {
|
||||
delete bc;
|
||||
return 0;
|
||||
}
|
||||
bc->setToolChain(copw.toolChain());
|
||||
cmtarget->addBuildConfiguration(bc); // this also makes the name unique
|
||||
|
||||
bc->setBuildDirectory(copw.buildDirectory());
|
||||
cmtarget->cmakeProject()->parseCMakeLists();
|
||||
|
||||
// Default to all
|
||||
if (cmtarget->cmakeProject()->hasBuildTarget("all"))
|
||||
if (project->hasBuildTarget("all"))
|
||||
makeStep->setBuildTarget("all", true);
|
||||
|
||||
return bc;
|
||||
}
|
||||
|
||||
bool CMakeBuildConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
|
||||
bool CMakeBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
|
||||
{
|
||||
return canCreate(parent, source->id());
|
||||
}
|
||||
@@ -251,11 +222,10 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
CMakeBuildConfiguration *old = static_cast<CMakeBuildConfiguration *>(source);
|
||||
CMakeTarget *cmtarget(static_cast<CMakeTarget *>(parent));
|
||||
return new CMakeBuildConfiguration(cmtarget, old);
|
||||
return new CMakeBuildConfiguration(parent, old);
|
||||
}
|
||||
|
||||
bool CMakeBuildConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
bool CMakeBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||
}
|
||||
@@ -264,14 +234,20 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::restore(ProjectExplorer
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
CMakeTarget *cmtarget(static_cast<CMakeTarget *>(parent));
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(cmtarget);
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
||||
if (bc->fromMap(map))
|
||||
return bc;
|
||||
delete bc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMakeBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
|
||||
{
|
||||
if (!t->project()->supportsProfile(t->profile()))
|
||||
return false;
|
||||
return qobject_cast<CMakeProject *>(t->project());
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfiguration::BuildType CMakeBuildConfiguration::buildType() const
|
||||
{
|
||||
QString cmakeBuildType;
|
||||
@@ -303,4 +279,3 @@ ProjectExplorer::BuildConfiguration::BuildType CMakeBuildConfiguration::buildTyp
|
||||
|
||||
return Unknown;
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,6 @@ class ToolChain;
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeTarget;
|
||||
class CMakeBuildConfigurationFactory;
|
||||
|
||||
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
@@ -52,12 +51,11 @@ class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
friend class CMakeBuildConfigurationFactory;
|
||||
|
||||
public:
|
||||
CMakeBuildConfiguration(CMakeTarget *parent);
|
||||
CMakeBuildConfiguration(ProjectExplorer::Target *parent);
|
||||
~CMakeBuildConfiguration();
|
||||
|
||||
CMakeTarget *cmakeTarget() const;
|
||||
|
||||
virtual QString buildDirectory() const;
|
||||
ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
QString buildDirectory() const;
|
||||
|
||||
void setBuildDirectory(const QString &buildDirectory);
|
||||
|
||||
@@ -70,7 +68,7 @@ public:
|
||||
BuildType buildType() const;
|
||||
|
||||
protected:
|
||||
CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuildConfiguration *source);
|
||||
CMakeBuildConfiguration(ProjectExplorer::Target *parent, CMakeBuildConfiguration *source);
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
@@ -86,15 +84,18 @@ public:
|
||||
CMakeBuildConfigurationFactory(QObject *parent = 0);
|
||||
~CMakeBuildConfigurationFactory();
|
||||
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
|
||||
QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
|
||||
CMakeBuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
|
||||
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
|
||||
bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
|
||||
CMakeBuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
|
||||
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
|
||||
CMakeBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
|
||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
CMakeBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||
|
||||
private:
|
||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -31,12 +31,12 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "cmakelocatorfilter.h"
|
||||
#include "cmaketarget.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "makestep.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
|
||||
|
@@ -34,7 +34,8 @@
|
||||
#include "cmakeprojectmanager.h"
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/profilemanager.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <texteditor/fontsettings.h>
|
||||
@@ -65,8 +66,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
|
||||
: m_cmakeManager(cmakeManager),
|
||||
m_sourceDirectory(sourceDirectory),
|
||||
m_creatingCbpFiles(false),
|
||||
m_environment(env),
|
||||
m_toolChain(0)
|
||||
m_environment(env)
|
||||
{
|
||||
int startid;
|
||||
if (hasInSourceBuild()) {
|
||||
@@ -98,8 +98,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
|
||||
: m_cmakeManager(cmakeManager),
|
||||
m_sourceDirectory(sourceDirectory),
|
||||
m_creatingCbpFiles(true),
|
||||
m_environment(env),
|
||||
m_toolChain(0)
|
||||
m_environment(env)
|
||||
{
|
||||
|
||||
CMakeRunPage::Mode rmode;
|
||||
@@ -119,8 +118,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
|
||||
: m_cmakeManager(cmakeManager),
|
||||
m_sourceDirectory(sourceDirectory),
|
||||
m_creatingCbpFiles(true),
|
||||
m_environment(env),
|
||||
m_toolChain(0)
|
||||
m_environment(env)
|
||||
{
|
||||
m_buildDirectory = oldBuildDirectory;
|
||||
addPage(new ShadowBuildPage(this, true));
|
||||
@@ -200,17 +198,6 @@ void CMakeOpenProjectWizard::setArguments(const QString &args)
|
||||
m_arguments = args;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *CMakeOpenProjectWizard::toolChain() const
|
||||
{
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
void CMakeOpenProjectWizard::setToolChain(ProjectExplorer::ToolChain *tc)
|
||||
{
|
||||
m_toolChain = tc;
|
||||
}
|
||||
|
||||
|
||||
Utils::Environment CMakeOpenProjectWizard::environment() const
|
||||
{
|
||||
return m_environment;
|
||||
@@ -414,51 +401,50 @@ void CMakeRunPage::initializePage()
|
||||
Q_UNUSED(cmakeCxxCompiler);
|
||||
m_generatorComboBox->clear();
|
||||
bool hasCodeBlocksGenerator = m_cmakeWizard->cmakeManager()->hasCodeBlocksMsvcGenerator();
|
||||
ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
|
||||
abi = ProjectExplorer::Abi(abi.architecture(), abi.os(), ProjectExplorer::Abi::UnknownFlavor,
|
||||
abi.binaryFormat(), 0);
|
||||
QList<ProjectExplorer::ToolChain *> tcs =
|
||||
ProjectExplorer::ToolChainManager::instance()->findToolChains(abi);
|
||||
|
||||
foreach (ProjectExplorer::ToolChain *tc, tcs) {
|
||||
QList<ProjectExplorer::Profile *> profileList =
|
||||
ProjectExplorer::ProfileManager::instance()->profiles();
|
||||
|
||||
foreach (ProjectExplorer::Profile *p, profileList) {
|
||||
QVariant profileVariant = qVariantFromValue(static_cast<void *>(p));
|
||||
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
|
||||
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
||||
QVariant tcVariant = qVariantFromValue(static_cast<void *>(tc));
|
||||
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
||||
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
|
||||
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
|
||||
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor) {
|
||||
if (hasCodeBlocksGenerator && (cachedGenerator.isEmpty() || cachedGenerator == "NMake Makefiles"))
|
||||
m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(tc->displayName()), tcVariant);
|
||||
m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(p->displayName()), profileVariant);
|
||||
} else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
|
||||
if (cachedGenerator.isEmpty() || cachedGenerator == "MinGW Makefiles")
|
||||
m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(tc->displayName()), tcVariant);
|
||||
m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(p->displayName()), profileVariant);
|
||||
}
|
||||
} else {
|
||||
// Non windows
|
||||
if (cachedGenerator.isEmpty() || cachedGenerator == "Unix Makefiles")
|
||||
m_generatorComboBox->addItem(tr("Unix Generator (%1)").arg(tc->displayName()), tcVariant);
|
||||
m_generatorComboBox->addItem(tr("Unix Generator (%1)").arg(p->displayName()), profileVariant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeRunPage::runCMake()
|
||||
{
|
||||
if (m_cmakeExecutable) {
|
||||
if (m_cmakeExecutable)
|
||||
// We asked the user for the cmake executable
|
||||
m_cmakeWizard->cmakeManager()->setCMakeExecutable(m_cmakeExecutable->path());
|
||||
}
|
||||
|
||||
int index = m_generatorComboBox->currentIndex();
|
||||
|
||||
ProjectExplorer::ToolChain *tc = 0;
|
||||
ProjectExplorer::Profile *p = 0;
|
||||
if (index >= 0)
|
||||
tc = static_cast<ProjectExplorer::ToolChain *>(m_generatorComboBox->itemData(index).value<void *>());
|
||||
if (!tc) {
|
||||
p = static_cast<ProjectExplorer::Profile *>(m_generatorComboBox->itemData(index).value<void *>());
|
||||
if (!p) {
|
||||
m_output->appendPlainText(tr("No generator selected."));
|
||||
return;
|
||||
}
|
||||
|
||||
m_cmakeWizard->setToolChain(tc);
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
|
||||
|
||||
m_runCMake->setEnabled(false);
|
||||
m_argumentsLineEdit->setEnabled(false);
|
||||
@@ -473,12 +459,9 @@ void CMakeRunPage::runCMake()
|
||||
generator = QLatin1String("-GCodeBlocks - NMake Makefiles");
|
||||
}
|
||||
|
||||
|
||||
Utils::Environment env = m_cmakeWizard->environment();
|
||||
tc->addToEnvironment(env);
|
||||
|
||||
|
||||
|
||||
m_output->clear();
|
||||
|
||||
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
|
||||
|
@@ -90,8 +90,6 @@ public:
|
||||
CMakeManager *cmakeManager() const;
|
||||
QString arguments() const;
|
||||
void setArguments(const QString &args);
|
||||
ProjectExplorer::ToolChain *toolChain() const;
|
||||
void setToolChain(ProjectExplorer::ToolChain *);
|
||||
Utils::Environment environment() const;
|
||||
bool existsUpToDateXmlFile() const;
|
||||
|
||||
@@ -104,7 +102,6 @@ private:
|
||||
QString m_arguments;
|
||||
bool m_creatingCbpFiles;
|
||||
Utils::Environment m_environment;
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
};
|
||||
|
||||
class InSourceBuildPage : public QWizardPage
|
||||
|
@@ -31,10 +31,11 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "cmakeproject.h"
|
||||
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakerunconfiguration.h"
|
||||
#include "cmaketarget.h"
|
||||
#include "makestep.h"
|
||||
#include "cmakeopenprojectwizard.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
@@ -46,7 +47,11 @@
|
||||
#include <projectexplorer/buildenvironmentwidget.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/profilemanager.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
#include <cpptools/ModelManagerInterface.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -107,6 +112,8 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
|
||||
connect(this, SIGNAL(addedTarget(ProjectExplorer::Target*)),
|
||||
SLOT(targetAdded(ProjectExplorer::Target*)));
|
||||
connect(this, SIGNAL(buildDirectoryChanged()),
|
||||
this, SLOT(triggerBuildSystemEvaluation()));
|
||||
}
|
||||
|
||||
CMakeProject::~CMakeProject()
|
||||
@@ -130,7 +137,7 @@ void CMakeProject::fileChanged(const QString &fileName)
|
||||
{
|
||||
Q_UNUSED(fileName)
|
||||
|
||||
parseCMakeLists();
|
||||
evaluateBuildSystem();
|
||||
}
|
||||
|
||||
void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
|
||||
@@ -168,7 +175,7 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur
|
||||
copw.exec();
|
||||
}
|
||||
// reparse
|
||||
parseCMakeLists();
|
||||
evaluateBuildSystem();
|
||||
}
|
||||
|
||||
void CMakeProject::targetAdded(ProjectExplorer::Target *t)
|
||||
@@ -183,7 +190,7 @@ void CMakeProject::targetAdded(ProjectExplorer::Target *t)
|
||||
void CMakeProject::changeBuildDirectory(CMakeBuildConfiguration *bc, const QString &newBuildDirectory)
|
||||
{
|
||||
bc->setBuildDirectory(newBuildDirectory);
|
||||
parseCMakeLists();
|
||||
evaluateBuildSystem();
|
||||
}
|
||||
|
||||
QString CMakeProject::defaultBuildDirectory() const
|
||||
@@ -191,23 +198,31 @@ QString CMakeProject::defaultBuildDirectory() const
|
||||
return projectDirectory() + QLatin1String("/qtcreator-build");
|
||||
}
|
||||
|
||||
bool CMakeProject::parseCMakeLists()
|
||||
void CMakeProject::evaluateBuildSystem()
|
||||
{
|
||||
if (!activeTarget() ||
|
||||
!activeTarget()->activeBuildConfiguration())
|
||||
return false;
|
||||
!activeTarget()->activeBuildConfiguration()) {
|
||||
buildSystemEvaluationFinished(false);
|
||||
return;
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
|
||||
if (!activeBC) {
|
||||
buildSystemEvaluationFinished(false);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Core::IEditor *editor, Core::EditorManager::instance()->openedEditors())
|
||||
if (isProjectFile(editor->document()->fileName()))
|
||||
editor->document()->infoBar()->removeInfo(QLatin1String("CMakeEditor.RunCMake"));
|
||||
|
||||
// Find cbp file
|
||||
CMakeBuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration();
|
||||
QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory());
|
||||
|
||||
if (cbpFile.isEmpty()) {
|
||||
emit buildTargetsChanged();
|
||||
return false;
|
||||
buildSystemEvaluationFinished(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// setFolderName
|
||||
@@ -218,7 +233,8 @@ bool CMakeProject::parseCMakeLists()
|
||||
if (!cbpparser.parseCbpFile(cbpFile)) {
|
||||
// TODO report error
|
||||
emit buildTargetsChanged();
|
||||
return false;
|
||||
buildSystemEvaluationFinished(true);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (const QString &file, m_watcher->files())
|
||||
@@ -228,8 +244,6 @@ bool CMakeProject::parseCMakeLists()
|
||||
// how can we ensure that it is completely written?
|
||||
m_watcher->addPath(cbpFile);
|
||||
|
||||
// ToolChain
|
||||
// activeBC->updateToolChain(cbpparser.compilerName());
|
||||
m_projectName = cbpparser.projectName();
|
||||
m_rootNode->setDisplayName(cbpparser.projectName());
|
||||
|
||||
@@ -285,8 +299,11 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
createUiCodeModelSupport();
|
||||
|
||||
if (!activeBC->toolChain())
|
||||
return true;
|
||||
ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(activeTarget()->profile());
|
||||
if (!tc) {
|
||||
buildSystemEvaluationFinished(true);
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList allIncludePaths;
|
||||
// This explicitly adds -I. to the include paths
|
||||
@@ -294,13 +311,12 @@ bool CMakeProject::parseCMakeLists()
|
||||
allIncludePaths.append(cbpparser.includeFiles());
|
||||
|
||||
QByteArray allDefines;
|
||||
allDefines.append(activeBC->toolChain()->predefinedMacros(QStringList()));
|
||||
allDefines.append(tc->predefinedMacros(QStringList()));
|
||||
allDefines.append(cbpparser.defines());
|
||||
|
||||
QStringList allFrameworkPaths;
|
||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths;
|
||||
if (activeBC->toolChain())
|
||||
allHeaderPaths = activeBC->toolChain()->systemHeaderPaths();
|
||||
allHeaderPaths = tc->systemHeaderPaths();
|
||||
foreach (const ProjectExplorer::HeaderPath &headerPath, allHeaderPaths) {
|
||||
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
||||
allFrameworkPaths.append(headerPath.path());
|
||||
@@ -333,7 +349,8 @@ bool CMakeProject::parseCMakeLists()
|
||||
}
|
||||
emit buildTargetsChanged();
|
||||
emit fileListChanged();
|
||||
return true;
|
||||
|
||||
buildSystemEvaluationFinished(true);
|
||||
}
|
||||
|
||||
bool CMakeProject::isProjectFile(const QString &fileName)
|
||||
@@ -501,11 +518,6 @@ CMakeManager *CMakeProject::projectManager() const
|
||||
return m_manager;
|
||||
}
|
||||
|
||||
CMakeTarget *CMakeProject::activeTarget() const
|
||||
{
|
||||
return static_cast<CMakeTarget *>(Project::activeTarget());
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
|
||||
{
|
||||
QList<ProjectExplorer::BuildConfigWidget*> list;
|
||||
@@ -530,34 +542,15 @@ bool CMakeProject::fromMap(const QVariantMap &map)
|
||||
if (!Project::fromMap(map))
|
||||
return false;
|
||||
|
||||
bool hasUserFile = activeTarget();
|
||||
if (!hasUserFile) {
|
||||
CMakeTargetFactory *factory =
|
||||
ExtensionSystem::PluginManager::getObject<CMakeTargetFactory>();
|
||||
CMakeTarget *t = factory->create(this, Core::Id(DEFAULT_CMAKE_TARGET_ID));
|
||||
if (!activeTarget())
|
||||
addTarget(createTarget(ProfileManager::instance()->defaultProfile()));
|
||||
|
||||
Q_ASSERT(t);
|
||||
Q_ASSERT(t->activeBuildConfiguration());
|
||||
|
||||
// Ask the user for where he wants to build it
|
||||
// and the cmake command line
|
||||
|
||||
CMakeOpenProjectWizard copw(m_manager, projectDirectory(), Utils::Environment::systemEnvironment());
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
CMakeBuildConfiguration *bc =
|
||||
static_cast<CMakeBuildConfiguration *>(t->buildConfigurations().at(0));
|
||||
if (!copw.buildDirectory().isEmpty())
|
||||
bc->setBuildDirectory(copw.buildDirectory());
|
||||
bc->setToolChain(copw.toolChain());
|
||||
|
||||
addTarget(t);
|
||||
} else {
|
||||
// We have a user file, but we could still be missing the cbp file
|
||||
// or simply run createXml with the saved settings
|
||||
QFileInfo sourceFileInfo(m_fileName);
|
||||
CMakeBuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration();
|
||||
CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
|
||||
if (!activeBC)
|
||||
return false;
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
|
||||
@@ -575,29 +568,23 @@ bool CMakeProject::fromMap(const QVariantMap &map)
|
||||
activeBC->environment());
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
activeBC->setToolChain(copw.toolChain());
|
||||
}
|
||||
}
|
||||
|
||||
m_watcher = new QFileSystemWatcher(this);
|
||||
connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString)));
|
||||
|
||||
if (!parseCMakeLists()) // Gets the directory from the active buildconfiguration
|
||||
return false;
|
||||
triggerBuildSystemEvaluation();
|
||||
|
||||
if (!hasUserFile && hasBuildTarget("all")) {
|
||||
if (hasBuildTarget("all")) {
|
||||
MakeStep *makeStep = qobject_cast<MakeStep *>(
|
||||
activeTarget()->activeBuildConfiguration()->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(0));
|
||||
Q_ASSERT(makeStep);
|
||||
makeStep->setBuildTarget("all", true);
|
||||
}
|
||||
|
||||
foreach (Target *t, targets()) {
|
||||
foreach (Target *t, targets())
|
||||
connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
||||
this, SLOT(changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
||||
connect(t, SIGNAL(environmentChanged()),
|
||||
this, SLOT(changeEnvironment()));
|
||||
}
|
||||
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
||||
@@ -817,8 +804,7 @@ bool CMakeFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
|
||||
return true;
|
||||
}
|
||||
|
||||
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeTarget *target)
|
||||
: m_target(target), m_buildConfiguration(0)
|
||||
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget() : m_buildConfiguration(0)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setContentsMargins(20, -1, 0, -1);
|
||||
@@ -853,7 +839,7 @@ void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||
if (m_buildConfiguration->buildDirectory() == m_target->cmakeProject()->projectDirectory())
|
||||
if (m_buildConfiguration->buildDirectory() == bc->target()->project()->projectDirectory())
|
||||
m_changeButton->setEnabled(false);
|
||||
else
|
||||
m_changeButton->setEnabled(true);
|
||||
@@ -861,7 +847,9 @@ void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
|
||||
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
||||
{
|
||||
CMakeProject *project = m_target->cmakeProject();
|
||||
CMakeProject *project = qobject_cast<CMakeProject *>(m_buildConfiguration->target()->project());
|
||||
if (!project)
|
||||
return;
|
||||
CMakeOpenProjectWizard copw(project->projectManager(),
|
||||
project->projectDirectory(),
|
||||
m_buildConfiguration->buildDirectory(),
|
||||
@@ -875,15 +863,16 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
||||
void CMakeBuildSettingsWidget::runCMake()
|
||||
{
|
||||
// TODO skip build directory
|
||||
CMakeProject *project = m_target->cmakeProject();
|
||||
CMakeProject *project = qobject_cast<CMakeProject *>(m_buildConfiguration->target()->project());
|
||||
if (!project)
|
||||
return;
|
||||
CMakeOpenProjectWizard copw(project->projectManager(),
|
||||
project->projectDirectory(),
|
||||
m_buildConfiguration->buildDirectory(),
|
||||
CMakeOpenProjectWizard::WantToUpdate,
|
||||
m_buildConfiguration->environment());
|
||||
if (copw.exec() == QDialog::Accepted) {
|
||||
project->parseCMakeLists();
|
||||
}
|
||||
if (copw.exec() == QDialog::Accepted)
|
||||
project->evaluateBuildSystem();
|
||||
}
|
||||
|
||||
/////
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "cmakeprojectmanager.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmaketarget.h"
|
||||
#include "makestep.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -87,8 +86,6 @@ public:
|
||||
Core::IDocument *document() const;
|
||||
CMakeManager *projectManager() const;
|
||||
|
||||
CMakeTarget *activeTarget() const;
|
||||
|
||||
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
||||
@@ -102,12 +99,12 @@ public:
|
||||
|
||||
QString defaultBuildDirectory() const;
|
||||
|
||||
bool parseCMakeLists();
|
||||
|
||||
QString uicCommand() const;
|
||||
|
||||
bool isProjectFile(const QString &fileName);
|
||||
|
||||
|
||||
signals:
|
||||
/// emitted after parsing
|
||||
void buildTargetsChanged();
|
||||
@@ -128,12 +125,15 @@ private slots:
|
||||
void uiEditorContentsChanged();
|
||||
void buildStateChanged(ProjectExplorer::Project *project);
|
||||
private:
|
||||
void evaluateBuildSystem();
|
||||
|
||||
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
||||
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
|
||||
ProjectExplorer::FolderNode *findOrCreateFolder(CMakeProjectNode *rootNode, QString directory);
|
||||
void updateCodeModelSupportFromEditor(const QString &uiFileName, const QString &contents);
|
||||
void createUiCodeModelSupport();
|
||||
QString uiHeaderFile(const QString &uiFile);
|
||||
void updateRunConfigurations(ProjectExplorer::Target *t);
|
||||
|
||||
CMakeManager *m_manager;
|
||||
QString m_fileName;
|
||||
@@ -228,16 +228,16 @@ class CMakeBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CMakeBuildSettingsWidget(CMakeTarget *target);
|
||||
CMakeBuildSettingsWidget();
|
||||
QString displayName() const;
|
||||
|
||||
// This is called to set up the config widget before showing it
|
||||
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void openChangeBuildDirectoryDialog();
|
||||
void runCMake();
|
||||
private:
|
||||
CMakeTarget *m_target;
|
||||
QLineEdit *m_pathLineEdit;
|
||||
QPushButton *m_changeButton;
|
||||
CMakeBuildConfiguration *m_buildConfiguration;
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <utils/QtConcurrentTools>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QCoreApplication>
|
||||
@@ -114,22 +115,21 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
|
||||
if (!project)
|
||||
return;
|
||||
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(project);
|
||||
if (!cmakeProject)
|
||||
if (!cmakeProject || !cmakeProject->activeTarget() || !cmakeProject->activeTarget()->activeBuildConfiguration())
|
||||
return;
|
||||
|
||||
if (!cmakeProject->activeTarget())
|
||||
CMakeBuildConfiguration *bc
|
||||
= qobject_cast<CMakeBuildConfiguration *>(cmakeProject->activeTarget()->activeBuildConfiguration());
|
||||
if (!bc)
|
||||
return;
|
||||
if (!cmakeProject->activeTarget()->activeBuildConfiguration())
|
||||
return;
|
||||
CMakeBuildConfiguration *bc = cmakeProject->activeTarget()->activeBuildConfiguration();
|
||||
|
||||
CMakeOpenProjectWizard copw(this,
|
||||
cmakeProject->projectDirectory(),
|
||||
bc->buildDirectory(),
|
||||
CMakeOpenProjectWizard::WantToUpdate,
|
||||
bc->environment());
|
||||
if (copw.exec() == QDialog::Accepted) {
|
||||
cmakeProject->parseCMakeLists();
|
||||
}
|
||||
if (copw.exec() == QDialog::Accepted)
|
||||
cmakeProject->triggerBuildSystemEvaluation();
|
||||
}
|
||||
|
||||
ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QString *errorString)
|
||||
|
@@ -9,7 +9,6 @@ HEADERS = cmakeproject.h \
|
||||
cmakeprojectmanager.h \
|
||||
cmakeprojectconstants.h \
|
||||
cmakeprojectnodes.h \
|
||||
cmaketarget.h \
|
||||
makestep.h \
|
||||
cmakerunconfiguration.h \
|
||||
cmakeopenprojectwizard.h \
|
||||
@@ -24,7 +23,6 @@ SOURCES = cmakeproject.cpp \
|
||||
cmakeprojectplugin.cpp \
|
||||
cmakeprojectmanager.cpp \
|
||||
cmakeprojectnodes.cpp \
|
||||
cmaketarget.cpp \
|
||||
makestep.cpp \
|
||||
cmakerunconfiguration.cpp \
|
||||
cmakeopenprojectwizard.cpp \
|
||||
|
@@ -48,8 +48,6 @@ QtcPlugin {
|
||||
"cmakeprojectplugin.h",
|
||||
"cmakerunconfiguration.cpp",
|
||||
"cmakerunconfiguration.h",
|
||||
"cmaketarget.cpp",
|
||||
"cmaketarget.h",
|
||||
"cmakeuicodemodelsupport.cpp",
|
||||
"cmakeuicodemodelsupport.h",
|
||||
"makestep.cpp",
|
||||
|
@@ -32,11 +32,11 @@
|
||||
|
||||
#include "cmakeprojectplugin.h"
|
||||
#include "cmakeprojectmanager.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakerunconfiguration.h"
|
||||
#include "cmakeeditorfactory.h"
|
||||
#include "makestep.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmaketarget.h"
|
||||
#include "cmakelocatorfilter.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -67,9 +67,9 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
|
||||
addAutoReleasedObject(manager);
|
||||
addAutoReleasedObject(new MakeStepFactory);
|
||||
addAutoReleasedObject(new CMakeRunConfigurationFactory);
|
||||
addAutoReleasedObject(new CMakeBuildConfigurationFactory);
|
||||
|
||||
addAutoReleasedObject(new CMakeEditorFactory(manager));
|
||||
addAutoReleasedObject(new CMakeTargetFactory);
|
||||
addAutoReleasedObject(new CMakeLocatorFilter);
|
||||
|
||||
return true;
|
||||
|
@@ -35,12 +35,12 @@
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmaketarget.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <qtsupport/debugginghelper.h>
|
||||
#include <projectexplorer/environmentwidget.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/detailswidget.h>
|
||||
@@ -60,7 +60,6 @@ using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
namespace {
|
||||
const char CMAKE_RC_ID[] = "CMakeProjectManager.CMakeRunConfiguration";
|
||||
const char CMAKE_RC_PREFIX[] = "CMakeProjectManager.CMakeRunConfiguration.";
|
||||
|
||||
const char USER_WORKING_DIRECTORY_KEY[] = "CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory";
|
||||
@@ -86,8 +85,9 @@ Core::Id idFromBuildTarget(const QString &target)
|
||||
|
||||
} // namespace
|
||||
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(CMakeTarget *parent, const QString &target, const QString &workingDirectory, const QString &title) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, Core::Id(CMAKE_RC_PREFIX)),
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &target,
|
||||
const QString &workingDirectory, const QString &title) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, id),
|
||||
m_runMode(Gui),
|
||||
m_buildTarget(target),
|
||||
m_workingDirectory(workingDirectory),
|
||||
@@ -98,7 +98,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeTarget *parent, const QString
|
||||
ctor();
|
||||
}
|
||||
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(CMakeTarget *parent, CMakeRunConfiguration *source) :
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(ProjectExplorer::Target *parent, CMakeRunConfiguration *source) :
|
||||
ProjectExplorer::LocalApplicationRunConfiguration(parent, source),
|
||||
m_runMode(source->m_runMode),
|
||||
m_buildTarget(source->m_buildTarget),
|
||||
@@ -122,14 +122,9 @@ void CMakeRunConfiguration::ctor()
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
CMakeTarget *CMakeRunConfiguration::cmakeTarget() const
|
||||
ProjectExplorer::BuildConfiguration *CMakeRunConfiguration::activeBuildConfiguration() const
|
||||
{
|
||||
return static_cast<CMakeTarget *>(target());
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *CMakeRunConfiguration::activeBuildConfiguration() const
|
||||
{
|
||||
return cmakeTarget()->activeBuildConfiguration();
|
||||
return target()->activeBuildConfiguration();
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::executable() const
|
||||
@@ -496,8 +491,7 @@ void CMakeRunConfigurationWidget::setArguments(const QString &args)
|
||||
// Factory
|
||||
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory(QObject *parent) :
|
||||
ProjectExplorer::IRunConfigurationFactory(parent)
|
||||
{
|
||||
}
|
||||
{ setObjectName(QLatin1String("CMakeRunConfigurationFactory")); }
|
||||
|
||||
CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
|
||||
{
|
||||
@@ -506,11 +500,11 @@ CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
|
||||
// used to show the list of possible additons to a project, returns a list of ids
|
||||
QList<Core::Id> CMakeRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
{
|
||||
CMakeTarget *t(qobject_cast<CMakeTarget *>(parent));
|
||||
if (!t)
|
||||
CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
QList<Core::Id> allIds;
|
||||
foreach (const QString &buildTarget, t->cmakeProject()->buildTargetTitles())
|
||||
foreach (const QString &buildTarget, project->buildTargetTitles())
|
||||
allIds << idFromBuildTarget(buildTarget);
|
||||
return allIds;
|
||||
}
|
||||
@@ -521,12 +515,19 @@ QString CMakeRunConfigurationFactory::displayNameForId(const Core::Id id) const
|
||||
return buildTargetFromId(id);
|
||||
}
|
||||
|
||||
bool CMakeRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
|
||||
{
|
||||
if (!parent->project()->supportsProfile(parent->profile()))
|
||||
return false;
|
||||
return qobject_cast<CMakeProject *>(parent->project());
|
||||
}
|
||||
|
||||
bool CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
{
|
||||
CMakeTarget *t(qobject_cast<CMakeTarget *>(parent));
|
||||
if (!t)
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
return t->cmakeProject()->hasBuildTarget(buildTargetFromId(id));
|
||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||
return project->hasBuildTarget(buildTargetFromId(id));
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::create(ProjectExplorer::Target *parent,
|
||||
@@ -534,43 +535,41 @@ ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::create(ProjectE
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
CMakeTarget *t(static_cast<CMakeTarget *>(parent));
|
||||
|
||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||
const QString title(buildTargetFromId(id));
|
||||
const CMakeBuildTarget &ct = t->cmakeProject()->buildTargetForTitle(title);
|
||||
return new CMakeRunConfiguration(t, ct.executable, ct.workingDirectory, ct.title);
|
||||
const CMakeBuildTarget &ct = project->buildTargetForTitle(title);
|
||||
return new CMakeRunConfiguration(parent, id, ct.executable, ct.workingDirectory, ct.title);
|
||||
}
|
||||
|
||||
bool CMakeRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
|
||||
{
|
||||
if (!qobject_cast<CMakeTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
return source->id() == Core::Id(CMAKE_RC_ID);
|
||||
return source->id().toString().startsWith(QLatin1String(CMAKE_RC_PREFIX));
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration * source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
CMakeTarget *t(static_cast<CMakeTarget *>(parent));
|
||||
CMakeRunConfiguration *crc(static_cast<CMakeRunConfiguration *>(source));
|
||||
return new CMakeRunConfiguration(t, crc);
|
||||
return new CMakeRunConfiguration(parent, crc);
|
||||
}
|
||||
|
||||
bool CMakeRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
if (!qobject_cast<CMakeTarget *>(parent))
|
||||
if (!qobject_cast<CMakeProject *>(parent->project()))
|
||||
return false;
|
||||
QString id = QString::fromUtf8(ProjectExplorer::idFromMap(map).name());
|
||||
return id.startsWith(QLatin1String(CMAKE_RC_ID));
|
||||
return id.startsWith(QLatin1String(CMAKE_RC_PREFIX));
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
CMakeTarget *t(static_cast<CMakeTarget *>(parent));
|
||||
CMakeRunConfiguration *rc(new CMakeRunConfiguration(t, QString(), QString(), QString()));
|
||||
CMakeRunConfiguration *rc(new CMakeRunConfiguration(parent, ProjectExplorer::idFromMap(map),
|
||||
QString(), QString(), QString()));
|
||||
if (rc->fromMap(map))
|
||||
return rc;
|
||||
delete rc;
|
||||
|
@@ -62,12 +62,11 @@ class CMakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfigu
|
||||
friend class CMakeRunConfigurationFactory;
|
||||
|
||||
public:
|
||||
CMakeRunConfiguration(CMakeTarget *parent, const QString &target,
|
||||
CMakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &target,
|
||||
const QString &workingDirectory, const QString &title);
|
||||
~CMakeRunConfiguration();
|
||||
|
||||
CMakeTarget *cmakeTarget() const;
|
||||
CMakeBuildConfiguration *activeBuildConfiguration() const;
|
||||
ProjectExplorer::BuildConfiguration *activeBuildConfiguration() const;
|
||||
|
||||
QString executable() const;
|
||||
RunMode runMode() const;
|
||||
@@ -101,7 +100,7 @@ private slots:
|
||||
void setCommandLineArguments(const QString &newText);
|
||||
|
||||
protected:
|
||||
CMakeRunConfiguration(CMakeTarget *parent, CMakeRunConfiguration *source);
|
||||
CMakeRunConfiguration(ProjectExplorer::Target *parent, CMakeRunConfiguration *source);
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
QString defaultDisplayName() const;
|
||||
|
||||
@@ -177,6 +176,8 @@ public:
|
||||
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
bool canHandle(ProjectExplorer::Target *parent) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -1,242 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "cmaketarget.h"
|
||||
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakerunconfiguration.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStyle>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
namespace {
|
||||
|
||||
QString displayNameForId(const Core::Id id) {
|
||||
if (id == Core::Id(DEFAULT_CMAKE_TARGET_ID))
|
||||
return QApplication::translate("CMakeProjectManager::Internal::CMakeTarget", "Desktop", "CMake Default target display name");
|
||||
return QString();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// CMakeTarget
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
CMakeTarget::CMakeTarget(CMakeProject *parent) :
|
||||
ProjectExplorer::Target(parent, Core::Id(DEFAULT_CMAKE_TARGET_ID)),
|
||||
m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this))
|
||||
{
|
||||
setDefaultDisplayName(displayNameForId(id()));
|
||||
setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
|
||||
connect(parent, SIGNAL(buildTargetsChanged()), SLOT(updateRunConfigurations()));
|
||||
}
|
||||
|
||||
CMakeTarget::~CMakeTarget()
|
||||
{
|
||||
}
|
||||
|
||||
CMakeProject *CMakeTarget::cmakeProject() const
|
||||
{
|
||||
return static_cast<CMakeProject *>(project());
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *CMakeTarget::createConfigWidget()
|
||||
{
|
||||
return new CMakeBuildSettingsWidget(this);
|
||||
}
|
||||
|
||||
bool CMakeTargetFactory::supportsTargetId(const Core::Id id) const
|
||||
{
|
||||
return id == Core::Id(DEFAULT_CMAKE_TARGET_ID);
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *CMakeTarget::activeBuildConfiguration() const
|
||||
{
|
||||
return static_cast<CMakeBuildConfiguration *>(Target::activeBuildConfiguration());
|
||||
}
|
||||
|
||||
CMakeBuildConfigurationFactory *CMakeTarget::buildConfigurationFactory() const
|
||||
{
|
||||
return m_buildConfigurationFactory;
|
||||
}
|
||||
|
||||
QString CMakeTarget::defaultBuildDirectory() const
|
||||
{
|
||||
return cmakeProject()->defaultBuildDirectory();
|
||||
}
|
||||
|
||||
bool CMakeTarget::fromMap(const QVariantMap &map)
|
||||
{
|
||||
return Target::fromMap(map);
|
||||
}
|
||||
|
||||
void CMakeTarget::updateRunConfigurations()
|
||||
{
|
||||
// *Update* runconfigurations:
|
||||
QMultiMap<QString, CMakeRunConfiguration*> existingRunConfigurations;
|
||||
QList<ProjectExplorer::RunConfiguration *> toRemove;
|
||||
foreach (ProjectExplorer::RunConfiguration* rc, runConfigurations()) {
|
||||
if (CMakeRunConfiguration* cmakeRC = qobject_cast<CMakeRunConfiguration *>(rc))
|
||||
existingRunConfigurations.insert(cmakeRC->title(), cmakeRC);
|
||||
QtSupport::CustomExecutableRunConfiguration *ceRC =
|
||||
qobject_cast<QtSupport::CustomExecutableRunConfiguration *>(rc);
|
||||
if (ceRC && !ceRC->isConfigured())
|
||||
toRemove << rc;
|
||||
}
|
||||
|
||||
foreach (const CMakeBuildTarget &ct, cmakeProject()->buildTargets()) {
|
||||
if (ct.library)
|
||||
continue;
|
||||
if (ct.executable.isEmpty())
|
||||
continue;
|
||||
if (ct.title.endsWith("/fast"))
|
||||
continue;
|
||||
QList<CMakeRunConfiguration *> list = existingRunConfigurations.values(ct.title);
|
||||
if (!list.isEmpty()) {
|
||||
// Already exists, so override the settings...
|
||||
foreach (CMakeRunConfiguration *rc, list) {
|
||||
rc->setExecutable(ct.executable);
|
||||
rc->setBaseWorkingDirectory(ct.workingDirectory);
|
||||
rc->setEnabled(true);
|
||||
}
|
||||
existingRunConfigurations.remove(ct.title);
|
||||
} else {
|
||||
// Does not exist yet
|
||||
addRunConfiguration(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory, ct.title));
|
||||
}
|
||||
}
|
||||
QMultiMap<QString, CMakeRunConfiguration *>::const_iterator it =
|
||||
existingRunConfigurations.constBegin();
|
||||
for ( ; it != existingRunConfigurations.constEnd(); ++it) {
|
||||
CMakeRunConfiguration *rc = it.value();
|
||||
// The executables for those runconfigurations aren't build by the current buildconfiguration
|
||||
// We just set a disable flag and show that in the display name
|
||||
rc->setEnabled(false);
|
||||
// removeRunConfiguration(rc);
|
||||
}
|
||||
|
||||
foreach (ProjectExplorer::RunConfiguration *rc, toRemove)
|
||||
removeRunConfiguration(rc);
|
||||
|
||||
if (runConfigurations().isEmpty()) {
|
||||
// Oh no, no run configuration,
|
||||
// create a custom executable run configuration
|
||||
addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this));
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// CMakeTargetFactory
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
CMakeTargetFactory::CMakeTargetFactory(QObject *parent) :
|
||||
ITargetFactory(parent)
|
||||
{
|
||||
}
|
||||
|
||||
CMakeTargetFactory::~CMakeTargetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QList<Core::Id> CMakeTargetFactory::supportedTargetIds() const
|
||||
{
|
||||
return QList<Core::Id>() << Core::Id(DEFAULT_CMAKE_TARGET_ID);
|
||||
}
|
||||
QString CMakeTargetFactory::displayNameForId(const Core::Id id) const
|
||||
{
|
||||
return ::displayNameForId(id);
|
||||
}
|
||||
|
||||
bool CMakeTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
|
||||
{
|
||||
if (!qobject_cast<CMakeProject *>(parent))
|
||||
return false;
|
||||
return id == Core::Id(DEFAULT_CMAKE_TARGET_ID);
|
||||
}
|
||||
|
||||
CMakeTarget *CMakeTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
CMakeProject *cmakeparent(static_cast<CMakeProject *>(parent));
|
||||
CMakeTarget *t(new CMakeTarget(cmakeparent));
|
||||
|
||||
// Add default build configuration:
|
||||
CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t));
|
||||
bc->setDefaultDisplayName("all");
|
||||
|
||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||
|
||||
// Now create a standard build configuration
|
||||
buildSteps->insertStep(0, new MakeStep(buildSteps));
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
||||
cleanSteps->insertStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setAdditionalArguments("clean");
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
t->addBuildConfiguration(bc);
|
||||
|
||||
t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID));
|
||||
|
||||
t->updateRunConfigurations();
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
bool CMakeTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||
}
|
||||
|
||||
CMakeTarget *CMakeTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
CMakeProject *cmakeparent(static_cast<CMakeProject *>(parent));
|
||||
CMakeTarget *t(new CMakeTarget(cmakeparent));
|
||||
if (t->fromMap(map))
|
||||
return t;
|
||||
delete t;
|
||||
return 0;
|
||||
}
|
@@ -1,100 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef CMAKETARGET_H
|
||||
#define CMAKETARGET_H
|
||||
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
const char DEFAULT_CMAKE_TARGET_ID[] = "CMakeProjectManager.DefaultCMakeTarget";
|
||||
|
||||
class CMakeBuildConfiguration;
|
||||
class CMakeBuildConfigurationFactory;
|
||||
class CMakeProject;
|
||||
class CMakeTargetFactory;
|
||||
|
||||
class CMakeTarget : public ProjectExplorer::Target
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class CMakeTargetFactory;
|
||||
|
||||
public:
|
||||
CMakeTarget(CMakeProject *parent);
|
||||
~CMakeTarget();
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
|
||||
CMakeProject *cmakeProject() const;
|
||||
CMakeBuildConfiguration *activeBuildConfiguration() const;
|
||||
|
||||
CMakeBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||
|
||||
QString defaultBuildDirectory() const;
|
||||
|
||||
protected:
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
private slots:
|
||||
void updateRunConfigurations();
|
||||
|
||||
private:
|
||||
CMakeBuildConfigurationFactory *m_buildConfigurationFactory;
|
||||
};
|
||||
|
||||
class CMakeTargetFactory : public ProjectExplorer::ITargetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMakeTargetFactory(QObject *parent = 0);
|
||||
~CMakeTargetFactory();
|
||||
|
||||
bool supportsTargetId(const Core::Id id) const;
|
||||
|
||||
QList<Core::Id> supportedTargetIds() const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
|
||||
CMakeTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
|
||||
bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
|
||||
CMakeTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
#endif // CMAKETARGET_H
|
@@ -32,10 +32,10 @@
|
||||
|
||||
#include "cmakeuicodemodelsupport.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmaketarget.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <cpptools/ModelManagerInterface.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
@@ -48,14 +48,10 @@ CMakeUiCodeModelSupport::CMakeUiCodeModelSupport(CPlusPlus::CppModelManagerInter
|
||||
const QString &uiHeaderFile)
|
||||
: CppTools::UiCodeModelSupport(modelmanager, source, uiHeaderFile),
|
||||
m_project(project)
|
||||
{
|
||||
|
||||
}
|
||||
{ }
|
||||
|
||||
CMakeUiCodeModelSupport::~CMakeUiCodeModelSupport()
|
||||
{
|
||||
|
||||
}
|
||||
{ }
|
||||
|
||||
QString CMakeUiCodeModelSupport::uicCommand() const
|
||||
{
|
||||
@@ -64,6 +60,7 @@ QString CMakeUiCodeModelSupport::uicCommand() const
|
||||
|
||||
QStringList CMakeUiCodeModelSupport::environment() const
|
||||
{
|
||||
CMakeBuildConfiguration *bc = m_project->activeTarget()->activeBuildConfiguration();
|
||||
return bc->environment().toStringList();
|
||||
if (!m_project || !m_project->activeTarget() || !m_project->activeTarget()->activeBuildConfiguration())
|
||||
return QStringList();
|
||||
return m_project->activeTarget()->activeBuildConfiguration()->environment().toStringList();
|
||||
}
|
||||
|
@@ -34,14 +34,16 @@
|
||||
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmaketarget.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
@@ -138,19 +140,20 @@ bool MakeStep::init()
|
||||
|
||||
setIgnoreReturnValue(m_clean);
|
||||
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setEnvironment(bc->environment());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
if (bc->toolChain())
|
||||
pp->setCommand(bc->toolChain()->makeCommand());
|
||||
if (tc)
|
||||
pp->setCommand(tc->makeCommand());
|
||||
else
|
||||
pp->setCommand(QLatin1String("make"));
|
||||
pp->setArguments(arguments);
|
||||
|
||||
setOutputParser(new ProjectExplorer::GnuMakeParser());
|
||||
if (bc->toolChain())
|
||||
appendOutputParser(bc->toolChain()->outputParser());
|
||||
if (tc)
|
||||
appendOutputParser(tc->outputParser());
|
||||
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
|
||||
|
||||
return AbstractProcessStep::init();
|
||||
@@ -302,7 +305,13 @@ void MakeStepConfigWidget::updateDetails()
|
||||
CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration();
|
||||
if (!bc)
|
||||
bc = static_cast<CMakeBuildConfiguration *>(m_makeStep->target()->activeBuildConfiguration());
|
||||
ProjectExplorer::ToolChain *tc = bc->toolChain();
|
||||
if (!bc) {
|
||||
m_summaryText = tr("<b>No build configuration found on this target.</b>");
|
||||
updateSummary();
|
||||
return;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(m_makeStep->target()->profile());
|
||||
if (tc) {
|
||||
QString arguments = Utils::QtcProcess::joinArgs(m_makeStep->buildTargets());
|
||||
Utils::QtcProcess::addArgs(&arguments, m_makeStep->additionalArguments());
|
||||
@@ -315,7 +324,7 @@ void MakeStepConfigWidget::updateDetails()
|
||||
param.setArguments(arguments);
|
||||
m_summaryText = param.summary(displayName());
|
||||
} else {
|
||||
m_summaryText = tr("<b>Unknown tool chain</b>");
|
||||
m_summaryText = tr("<b>No tool chain set for this target</b>");
|
||||
}
|
||||
emit updateSummary();
|
||||
}
|
||||
|
@@ -38,6 +38,8 @@ HEADERS += \
|
||||
debuggerstartparameters.h \
|
||||
debuggerstreamops.h \
|
||||
debuggerstringutils.h \
|
||||
debuggerprofileconfigwidget.h \
|
||||
debuggerprofileinformation.h \
|
||||
disassembleragent.h \
|
||||
disassemblerlines.h \
|
||||
loadremotecoredialog.h \
|
||||
@@ -92,6 +94,8 @@ SOURCES += \
|
||||
debuggerplugin.cpp \
|
||||
debuggerrunner.cpp \
|
||||
debuggerstreamops.cpp \
|
||||
debuggerprofileconfigwidget.cpp \
|
||||
debuggerprofileinformation.cpp \
|
||||
disassembleragent.cpp \
|
||||
disassemblerlines.cpp \
|
||||
loadremotecoredialog.cpp \
|
||||
|
@@ -36,6 +36,10 @@ QtcPlugin {
|
||||
"breakcondition.ui",
|
||||
"breakpoint.ui",
|
||||
"debugger.qrc",
|
||||
"debuggerprofileconfigwidget.cpp",
|
||||
"debuggerprofileconfigwidget.h",
|
||||
"debuggerprofileinformation.cpp",
|
||||
"debuggerprofileinformation.h",
|
||||
"attachcoredialog.ui",
|
||||
"attachexternaldialog.ui",
|
||||
"attachtoqmlportdialog.ui",
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "debuggerrunner.h"
|
||||
#include "debuggerruncontrolfactory.h"
|
||||
#include "debuggerstringutils.h"
|
||||
#include "debuggerprofileinformation.h"
|
||||
#include "memoryagent.h"
|
||||
#include "breakpoint.h"
|
||||
#include "breakhandler.h"
|
||||
@@ -99,6 +100,8 @@
|
||||
#include <projectexplorer/projectexplorersettings.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/profilemanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
@@ -2839,18 +2842,27 @@ QString DebuggerPluginPrivate::debuggerForAbi(const Abi &abi, DebuggerEngineType
|
||||
qDebug() << "debuggerForAbi" << abi.toString() << searchAbis.size()
|
||||
<< searchAbis.front().toString() << et;
|
||||
|
||||
foreach (const Abi &searchAbi, searchAbis) {
|
||||
const QList<ToolChain *> toolchains =
|
||||
ToolChainManager::instance()->findToolChains(searchAbi);
|
||||
// Find manually configured ones first
|
||||
for (int i = toolchains.size() - 1; i >= 0; i--) {
|
||||
const QString debugger = toolchains.at(i)->debuggerCommand().toString();
|
||||
if (debug)
|
||||
qDebug() << i << toolchains.at(i)->displayName() << debugger;
|
||||
if (!debugger.isEmpty())
|
||||
return debugger;
|
||||
QList<Profile *> profileList = ProfileManager::instance()->profiles();
|
||||
// Note: stList is not sorted with autodected first!
|
||||
QStringList debuggerList;
|
||||
foreach (Profile *p, profileList) {
|
||||
if (!p->isValid())
|
||||
continue;
|
||||
ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
|
||||
if (!tc)
|
||||
continue;
|
||||
if (searchAbis.contains(tc->targetAbi())) {
|
||||
const QString debugger = DebuggerProfileInformation::debuggerCommand(p).toString();
|
||||
if (!debugger.isEmpty()) {
|
||||
if (p->isAutoDetected())
|
||||
debuggerList.append(debugger);
|
||||
else
|
||||
debuggerList.prepend(debugger);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!debuggerList.isEmpty())
|
||||
return debuggerList.at(0);
|
||||
return QString();
|
||||
}
|
||||
|
||||
@@ -3620,6 +3632,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
|
||||
mstart->addSeparator(globalcontext, Constants::G_MANUAL_REMOTE);
|
||||
mstart->addSeparator(globalcontext, Constants::G_AUTOMATIC_REMOTE);
|
||||
|
||||
ProfileManager::instance()->registerProfileInformation(new DebuggerProfileInformation);
|
||||
|
||||
return theDebuggerCore->initialize(arguments, errorMessage);
|
||||
}
|
||||
|
||||
@@ -3711,35 +3725,23 @@ void DebuggerPluginPrivate::testUnloadProject()
|
||||
invoke<void>(pe, "unloadProject");
|
||||
}
|
||||
|
||||
static Project *currentProject()
|
||||
{
|
||||
return ProjectExplorerPlugin::instance()->currentProject();
|
||||
}
|
||||
|
||||
static Target *activeTarget()
|
||||
{
|
||||
Project *project = currentProject();
|
||||
Project *project = ProjectExplorerPlugin::instance()->currentProject();
|
||||
return project->activeTarget();
|
||||
}
|
||||
|
||||
static BuildConfiguration *activeBuildConfiguration()
|
||||
{
|
||||
return activeTarget()->activeBuildConfiguration();
|
||||
}
|
||||
|
||||
static RunConfiguration *activeRunConfiguration()
|
||||
{
|
||||
return activeTarget()->activeRunConfiguration();
|
||||
}
|
||||
|
||||
static ToolChain *currentToolChain()
|
||||
{
|
||||
return activeBuildConfiguration()->toolChain();
|
||||
Target *t = activeTarget();
|
||||
if (!t || !t->isEnabled())
|
||||
return 0;
|
||||
return ToolChainProfileInformation::toolChain(activeTarget()->profile());
|
||||
}
|
||||
|
||||
static LocalApplicationRunConfiguration *activeLocalRunConfiguration()
|
||||
{
|
||||
return qobject_cast<LocalApplicationRunConfiguration *>(activeRunConfiguration());
|
||||
return qobject_cast<LocalApplicationRunConfiguration *>(activeTarget()->activeRunConfiguration());
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb)
|
||||
|
148
src/plugins/debugger/debuggerprofileconfigwidget.cpp
Normal file
148
src/plugins/debugger/debuggerprofileconfigwidget.cpp
Normal file
@@ -0,0 +1,148 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "debuggerprofileconfigwidget.h"
|
||||
|
||||
#include "debuggerprofileinformation.h"
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <utils/winutils.h>
|
||||
#endif
|
||||
|
||||
#include <QUrl>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
|
||||
static const char dgbToolsDownloadLink32C[] = "http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx";
|
||||
static const char dgbToolsDownloadLink64C[] = "http://www.microsoft.com/whdc/devtools/debugging/install64bit.Mspx";
|
||||
// -----------------------------------------------------------------------
|
||||
// DebuggerProfileConfigWidget:
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
DebuggerProfileConfigWidget::DebuggerProfileConfigWidget(ProjectExplorer::Profile *p,
|
||||
const DebuggerProfileInformation *pi,
|
||||
QWidget *parent) :
|
||||
ProjectExplorer::ProfileConfigWidget(parent),
|
||||
m_profile(p),
|
||||
m_info(pi),
|
||||
m_chooser(new Utils::PathChooser)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
|
||||
if (tc && tc->targetAbi().os() == ProjectExplorer::Abi::WindowsOS
|
||||
&& tc->targetAbi().osFlavor() != ProjectExplorer::Abi::WindowsMSysFlavor) {
|
||||
QLabel *msvcDebuggerConfigLabel = new QLabel;
|
||||
#ifdef Q_OS_WIN
|
||||
const bool is64bit = Utils::winIs64BitSystem();
|
||||
#else
|
||||
const bool is64bit = false;
|
||||
#endif
|
||||
const QString link = is64bit ? QLatin1String(dgbToolsDownloadLink64C) : QLatin1String(dgbToolsDownloadLink32C);
|
||||
//: Label text for path configuration. %2 is "x-bit version".
|
||||
msvcDebuggerConfigLabel->setText(tr("<html><body><p>Specify the path to the "
|
||||
"<a href=\"%1\">Windows Console Debugger executable</a>"
|
||||
" (%2) here.</p>"
|
||||
"</body></html>").arg(link, (is64bit ? tr("64-bit version")
|
||||
: tr("32-bit version"))));
|
||||
msvcDebuggerConfigLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
msvcDebuggerConfigLabel->setOpenExternalLinks(true);
|
||||
layout->addWidget(msvcDebuggerConfigLabel);
|
||||
|
||||
}
|
||||
|
||||
m_chooser->setContentsMargins(0, 0, 0, 0);
|
||||
m_chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
|
||||
QPushButton *button = new QPushButton(tr("Auto detect"));
|
||||
button->setContentsMargins(0, 0, 0, 0);
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(autoDetectDebugger()));
|
||||
|
||||
QHBoxLayout *box = dynamic_cast<QHBoxLayout *>(m_chooser->layout());
|
||||
QTC_CHECK(box);
|
||||
if (box)
|
||||
box->insertWidget(1, button);
|
||||
layout->addWidget(m_chooser);
|
||||
|
||||
discard();
|
||||
connect(m_chooser, SIGNAL(changed(QString)), this, SIGNAL(dirty()));
|
||||
}
|
||||
|
||||
QString DebuggerProfileConfigWidget::displayName() const
|
||||
{
|
||||
return tr("Debugger command:");
|
||||
}
|
||||
|
||||
void DebuggerProfileConfigWidget::makeReadOnly()
|
||||
{
|
||||
m_chooser->setEnabled(false);
|
||||
}
|
||||
|
||||
void DebuggerProfileConfigWidget::apply()
|
||||
{
|
||||
Utils::FileName fn = m_chooser->fileName();
|
||||
DebuggerProfileInformation::setDebuggerCommand(m_profile, fn);
|
||||
}
|
||||
|
||||
void DebuggerProfileConfigWidget::discard()
|
||||
{
|
||||
m_chooser->setFileName(DebuggerProfileInformation::debuggerCommand(m_profile));
|
||||
}
|
||||
|
||||
bool DebuggerProfileConfigWidget::isDirty() const
|
||||
{
|
||||
return m_chooser->fileName() != DebuggerProfileInformation::debuggerCommand(m_profile);
|
||||
}
|
||||
|
||||
void DebuggerProfileConfigWidget::autoDetectDebugger()
|
||||
{
|
||||
QVariant v = m_info->defaultValue(m_profile);
|
||||
m_chooser->setFileName(Utils::FileName::fromString(v.toString()));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
} // namespace Debugger
|
81
src/plugins/debugger/debuggerprofileconfigwidget.h
Normal file
81
src/plugins/debugger/debuggerprofileconfigwidget.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef DEBUGGER_DEBUGGERPROFILECONFIGWIDGET_H
|
||||
#define DEBUGGER_DEBUGGERPROFILECONFIGWIDGET_H
|
||||
|
||||
#include <projectexplorer/profileconfigwidget.h>
|
||||
|
||||
#include <QLabel>
|
||||
#include <debuggerprofileinformation.h>
|
||||
|
||||
namespace ProjectExplorer { class Profile; }
|
||||
namespace Utils { class PathChooser; }
|
||||
|
||||
namespace Debugger {
|
||||
class DebuggerProfileInformation;
|
||||
|
||||
namespace Internal {
|
||||
// -----------------------------------------------------------------------
|
||||
// DebuggerProfileConfigWidget:
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
class DebuggerProfileConfigWidget : public ProjectExplorer::ProfileConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerProfileConfigWidget(ProjectExplorer::Profile *p,
|
||||
const DebuggerProfileInformation *pi,
|
||||
QWidget *parent = 0);
|
||||
|
||||
QString displayName() const;
|
||||
|
||||
void makeReadOnly();
|
||||
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const;
|
||||
|
||||
private slots:
|
||||
void autoDetectDebugger();
|
||||
|
||||
private:
|
||||
ProjectExplorer::Profile *m_profile;
|
||||
const DebuggerProfileInformation *m_info;
|
||||
Utils::PathChooser *m_chooser;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
#endif // DEBUGGER_DEBUGGERPROFILEINFORMATION_H
|
208
src/plugins/debugger/debuggerprofileinformation.cpp
Normal file
208
src/plugins/debugger/debuggerprofileinformation.cpp
Normal file
@@ -0,0 +1,208 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "debuggerprofileinformation.h"
|
||||
|
||||
#include "debuggerprofileconfigwidget.h"
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QPair>
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Helpers:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
static QPair<QString, QString> autoDetectCdbDebugger()
|
||||
{
|
||||
QPair<QString, QString> result;
|
||||
QList<Utils::FileName> cdbs;
|
||||
|
||||
QStringList programDirs;
|
||||
programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramFiles")));
|
||||
programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramFiles(x86)")));
|
||||
programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramW6432")));
|
||||
|
||||
foreach (const QString &dirName, programDirs) {
|
||||
if (dirName.isEmpty())
|
||||
continue;
|
||||
QDir dir(dirName);
|
||||
// Windows SDK's starting from version 8 live in
|
||||
// "ProgramDir\Windows Kits\<version>"
|
||||
const QString windowsKitsFolderName = QLatin1String("Windows Kits");
|
||||
if (dir.exists(windowsKitsFolderName)) {
|
||||
QDir windowKitsFolder = dir;
|
||||
if (windowKitsFolder.cd(windowsKitsFolderName)) {
|
||||
// Check in reverse order (latest first)
|
||||
const QFileInfoList kitFolders =
|
||||
windowKitsFolder.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot,
|
||||
QDir::Time | QDir::Reversed);
|
||||
foreach (const QFileInfo &kitFolderFi, kitFolders) {
|
||||
const QString path = kitFolderFi.absoluteFilePath();
|
||||
const QFileInfo cdb32(path + QLatin1String("/Debuggers/x86/cdb.exe"));
|
||||
if (cdb32.isExecutable())
|
||||
cdbs.push_back(Utils::FileName::fromString(cdb32.absoluteFilePath()));
|
||||
const QFileInfo cdb64(path + QLatin1String("/Debuggers/x64/cdb.exe"));
|
||||
if (cdb64.isExecutable())
|
||||
cdbs.push_back(Utils::FileName::fromString(cdb64.absoluteFilePath()));
|
||||
} // for Kits
|
||||
} // can cd to "Windows Kits"
|
||||
} // "Windows Kits" exists
|
||||
|
||||
// Pre Windows SDK 8: Check 'Debugging Tools for Windows'
|
||||
foreach (const QFileInfo &fi, dir.entryInfoList(QStringList(QLatin1String("Debugging Tools for Windows*")),
|
||||
QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||
Utils::FileName filePath(fi);
|
||||
filePath.appendPath(QLatin1String("cdb.exe"));
|
||||
if (!cdbs.contains(filePath))
|
||||
cdbs.append(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const Utils::FileName &cdb, cdbs) {
|
||||
QList<ProjectExplorer::Abi> abis = ProjectExplorer::Abi::abisOfBinary(cdb);
|
||||
if (abis.isEmpty())
|
||||
continue;
|
||||
if (abis.first().wordWidth() == 32)
|
||||
result.first = cdb.toString();
|
||||
else if (abis.first().wordWidth() == 64)
|
||||
result.second = cdb.toString();
|
||||
}
|
||||
|
||||
// prefer 64bit debugger, even for 32bit binaries:
|
||||
if (!result.second.isEmpty())
|
||||
result.first = result.second;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// DebuggerProfileInformation:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
static const char DEBUGGER_INFORMATION[] = "Debugger.Information";
|
||||
|
||||
DebuggerProfileInformation::DebuggerProfileInformation()
|
||||
{
|
||||
setObjectName(QLatin1String("DebuggerProfileInformation"));
|
||||
}
|
||||
|
||||
Core::Id DebuggerProfileInformation::dataId() const
|
||||
{
|
||||
static Core::Id id = Core::Id(DEBUGGER_INFORMATION);
|
||||
return id;
|
||||
}
|
||||
|
||||
unsigned int DebuggerProfileInformation::priority() const
|
||||
{
|
||||
return 28000;
|
||||
}
|
||||
|
||||
QVariant DebuggerProfileInformation::defaultValue(ProjectExplorer::Profile *p) const
|
||||
{
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
|
||||
ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
|
||||
if (tc)
|
||||
abi = tc->targetAbi();
|
||||
|
||||
// CDB for windows:
|
||||
if (abi.os() == ProjectExplorer::Abi::WindowsOS
|
||||
&& abi.osFlavor() != ProjectExplorer::Abi::WindowsMSysFlavor) {
|
||||
QPair<QString, QString> cdbs = autoDetectCdbDebugger();
|
||||
return (abi.wordWidth() == 32) ? cdbs.first : cdbs.second;
|
||||
}
|
||||
|
||||
// Check suggestions from the SDK:
|
||||
if (tc) {
|
||||
const QString path = tc->suggestedDebugger().toString();
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
}
|
||||
|
||||
// fall back to system GDB:
|
||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||
return env.searchInPath(QLatin1String("gdb"));
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Task> DebuggerProfileInformation::validate(ProjectExplorer::Profile *p) const
|
||||
{
|
||||
QList<ProjectExplorer::Task> result;
|
||||
Utils::FileName dbg = debuggerCommand(p);
|
||||
if (dbg.isEmpty()) {
|
||||
result << ProjectExplorer::Task(ProjectExplorer::Task::Warning,
|
||||
tr("No debugger set up."), Utils::FileName(), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
return result;
|
||||
}
|
||||
|
||||
QFileInfo fi = dbg.toFileInfo();
|
||||
if (!fi.exists() || fi.isDir())
|
||||
result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
|
||||
tr("Debugger not found."), Utils::FileName(), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
else if (!fi.isExecutable())
|
||||
result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
|
||||
tr("Debugger not exectutable."), Utils::FileName(), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ProjectExplorer::ProfileConfigWidget *
|
||||
DebuggerProfileInformation::createConfigWidget(ProjectExplorer::Profile *p) const
|
||||
{
|
||||
return new Internal::DebuggerProfileConfigWidget(p, this);
|
||||
}
|
||||
|
||||
ProjectExplorer::ProfileInformation::ItemList DebuggerProfileInformation::toUserOutput(ProjectExplorer::Profile *p) const
|
||||
{
|
||||
return ItemList() << qMakePair(tr("Debugger"), debuggerCommand(p).toUserOutput());
|
||||
}
|
||||
|
||||
Utils::FileName DebuggerProfileInformation::debuggerCommand(const ProjectExplorer::Profile *p)
|
||||
{
|
||||
return Utils::FileName::fromString(p->value(Core::Id(DEBUGGER_INFORMATION)).toString());
|
||||
}
|
||||
|
||||
void DebuggerProfileInformation::setDebuggerCommand(ProjectExplorer::Profile *p, Utils::FileName &command)
|
||||
{
|
||||
p->setValue(Core::Id(DEBUGGER_INFORMATION), command.toString());
|
||||
}
|
||||
|
||||
} // namespace Debugger
|
67
src/plugins/debugger/debuggerprofileinformation.h
Normal file
67
src/plugins/debugger/debuggerprofileinformation.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef DEBUGGER_DEBUGGERPROFILEINFORMATION_H
|
||||
#define DEBUGGER_DEBUGGERPROFILEINFORMATION_H
|
||||
|
||||
#include "debugger_global.h"
|
||||
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
class DEBUGGER_EXPORT DebuggerProfileInformation : public ProjectExplorer::ProfileInformation
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerProfileInformation();
|
||||
|
||||
Core::Id dataId() const;
|
||||
|
||||
unsigned int priority() const; // the higher the closer to the top.
|
||||
|
||||
QVariant defaultValue(ProjectExplorer::Profile *p) const;
|
||||
|
||||
QList<ProjectExplorer::Task> validate(ProjectExplorer::Profile *p) const;
|
||||
|
||||
ProjectExplorer::ProfileConfigWidget *createConfigWidget(ProjectExplorer::Profile *p) const;
|
||||
|
||||
ItemList toUserOutput(ProjectExplorer::Profile *p) const;
|
||||
|
||||
static Utils::FileName debuggerCommand(const ProjectExplorer::Profile *p);
|
||||
static void setDebuggerCommand(ProjectExplorer::Profile *p, Utils::FileName &command);
|
||||
};
|
||||
|
||||
} // namespace Debugger
|
||||
|
||||
#endif // DEBUGGER_DEBUGGERPROFILEINFORMATION_H
|
@@ -41,6 +41,7 @@
|
||||
#include "debuggerplugin.h"
|
||||
#include "debuggerstringutils.h"
|
||||
#include "debuggerstartparameters.h"
|
||||
#include "debuggerprofileinformation.h"
|
||||
#include "lldb/lldbenginehost.h"
|
||||
#include "debuggertooltipmanager.h"
|
||||
#include "qml/qmlengine.h"
|
||||
@@ -905,6 +906,12 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
|
||||
|
||||
if (const ProjectExplorer::Target *target = runConfiguration->target()) {
|
||||
if (QByteArray(target->metaObject()->className()).contains("Qt4")) {
|
||||
// FIXME: Get this from the profile?
|
||||
// We could query the QtVersion for this information directly, but then we
|
||||
// will need to add a dependency on QtSupport to the debugger.
|
||||
//
|
||||
// The profile could also get a method to extract the required information from
|
||||
// its information to avoid this dependecy (as we do for the environment).
|
||||
const Utils::FileName qmake = Utils::BuildableHelperLibrary::findSystemQt(sp.environment);
|
||||
if (!qmake.isEmpty())
|
||||
sp.qtInstallPath = findQtInstallPath(qmake);
|
||||
@@ -913,8 +920,8 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
|
||||
sp.projectSourceDirectory = project->projectDirectory();
|
||||
if (const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration()) {
|
||||
sp.projectBuildDirectory = buildConfig->buildDirectory();
|
||||
if (const ProjectExplorer::ToolChain *tc = buildConfig->toolChain())
|
||||
sp.debuggerCommand = tc->debuggerCommand().toString();
|
||||
const ProjectExplorer::Profile *p = runConfiguration->target()->profile();
|
||||
sp.debuggerCommand = DebuggerProfileInformation::debuggerCommand(p).toString();
|
||||
}
|
||||
sp.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles);
|
||||
}
|
||||
|
@@ -32,8 +32,10 @@
|
||||
|
||||
#include "debuggertoolchaincombobox.h"
|
||||
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include "debuggerprofileinformation.h"
|
||||
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/profilemanager.h>
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -58,18 +60,26 @@ DebuggerToolChainComboBox::DebuggerToolChainComboBox(QWidget *parent) :
|
||||
void DebuggerToolChainComboBox::init(bool hostAbiOnly)
|
||||
{
|
||||
const ProjectExplorer::Abi hostAbi = ProjectExplorer::Abi::hostAbi();
|
||||
foreach (const ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
|
||||
foreach (const ProjectExplorer::Profile *st,
|
||||
ProjectExplorer::ProfileManager::instance()->profiles()) {
|
||||
if (!st->isValid())
|
||||
continue;
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(st);
|
||||
if (!tc)
|
||||
continue;
|
||||
const ProjectExplorer::Abi abi = tc->targetAbi();
|
||||
if (!hostAbiOnly || hostAbi.isCompatibleWith(abi)) {
|
||||
const QString debuggerCommand = tc->debuggerCommand().toString();
|
||||
if (!debuggerCommand.isEmpty()) {
|
||||
if (hostAbiOnly && hostAbi.os() != abi.os())
|
||||
continue;
|
||||
|
||||
const QString debuggerCommand = DebuggerProfileInformation::debuggerCommand(st).toString();
|
||||
if (debuggerCommand.isEmpty())
|
||||
continue;
|
||||
|
||||
const AbiDebuggerCommandPair data(abi, debuggerCommand);
|
||||
const QString completeBase = QFileInfo(debuggerCommand).completeBaseName();
|
||||
const QString name = tr("%1 (%2)").arg(tc->displayName(), completeBase);
|
||||
const QString name = tr("%1 (%2)").arg(st->displayName(), completeBase);
|
||||
addItem(name, qVariantFromValue(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
setEnabled(count() > 1);
|
||||
}
|
||||
|
||||
|
@@ -34,13 +34,15 @@
|
||||
|
||||
#include "genericmakestep.h"
|
||||
#include "genericproject.h"
|
||||
#include "generictarget.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QInputDialog>
|
||||
|
||||
using namespace GenericProjectManager;
|
||||
@@ -53,17 +55,17 @@ const char * const GENERIC_BC_ID("GenericProjectManager.GenericBuildConfiguratio
|
||||
const char * const BUILD_DIRECTORY_KEY("GenericProjectManager.GenericBuildConfiguration.BuildDirectory");
|
||||
}
|
||||
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent)
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent)
|
||||
: BuildConfiguration(parent, Core::Id(GENERIC_BC_ID))
|
||||
{
|
||||
}
|
||||
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent, const Core::Id id)
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id)
|
||||
: BuildConfiguration(parent, id)
|
||||
{
|
||||
}
|
||||
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent, GenericBuildConfiguration *source) :
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent, GenericBuildConfiguration *source) :
|
||||
BuildConfiguration(parent, source),
|
||||
m_buildDirectory(source->m_buildDirectory)
|
||||
{
|
||||
@@ -112,17 +114,16 @@ void GenericBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
||||
emit buildDirectoryChanged();
|
||||
}
|
||||
|
||||
GenericTarget *GenericBuildConfiguration::genericTarget() const
|
||||
ProjectExplorer::BuildConfigWidget *GenericBuildConfiguration::createConfigWidget()
|
||||
{
|
||||
return static_cast<GenericTarget *>(target());
|
||||
return new GenericBuildSettingsWidget;
|
||||
}
|
||||
|
||||
ProjectExplorer::IOutputParser *GenericBuildConfiguration::createOutputParser() const
|
||||
{
|
||||
ProjectExplorer::ToolChain *tc = genericTarget()->genericProject()->toolChain();
|
||||
if (tc)
|
||||
return tc->outputParser();
|
||||
return 0;
|
||||
ProjectExplorer::ToolChain *tc =
|
||||
ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
|
||||
return tc ? tc->outputParser() : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,9 +140,9 @@ GenericBuildConfigurationFactory::~GenericBuildConfigurationFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QList<Core::Id> GenericBuildConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
QList<Core::Id> GenericBuildConfigurationFactory::availableCreationIds(const ProjectExplorer::Target *parent) const
|
||||
{
|
||||
if (!qobject_cast<GenericTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << Core::Id(GENERIC_BC_ID);
|
||||
}
|
||||
@@ -153,33 +154,35 @@ QString GenericBuildConfigurationFactory::displayNameForId(const Core::Id id) co
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool GenericBuildConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
bool GenericBuildConfigurationFactory::canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
{
|
||||
if (!qobject_cast<GenericTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
if (id == Core::Id(GENERIC_BC_ID))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
|
||||
BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
GenericTarget *target(static_cast<GenericTarget *>(parent));
|
||||
|
||||
//TODO asking for name is duplicated everywhere, but maybe more
|
||||
// wizards will show up, that incorporate choosing the name
|
||||
bool ok;
|
||||
QString buildConfigurationName = QInputDialog::getText(0,
|
||||
// wizards will show up, that incorporate choosing the nam
|
||||
bool ok = true;
|
||||
QString buildConfigurationName = name;
|
||||
if (buildConfigurationName.isEmpty())
|
||||
buildConfigurationName = QInputDialog::getText(0,
|
||||
tr("New Configuration"),
|
||||
tr("New configuration name:"),
|
||||
QLineEdit::Normal,
|
||||
QString(),
|
||||
&ok);
|
||||
QString(), &ok);
|
||||
buildConfigurationName = buildConfigurationName.trimmed();
|
||||
if (!ok || buildConfigurationName.isEmpty())
|
||||
return 0;
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(target);
|
||||
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(parent);
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
|
||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
@@ -196,11 +199,10 @@ BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Ta
|
||||
cleanMakeStep->setBuildTarget(QLatin1String("clean"), /* on = */ true);
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
target->addBuildConfiguration(bc); // also makes the name unique...
|
||||
return bc;
|
||||
}
|
||||
|
||||
bool GenericBuildConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
|
||||
bool GenericBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
|
||||
{
|
||||
return canCreate(parent, source->id());
|
||||
}
|
||||
@@ -209,11 +211,10 @@ BuildConfiguration *GenericBuildConfigurationFactory::clone(ProjectExplorer::Tar
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
GenericTarget *target(static_cast<GenericTarget *>(parent));
|
||||
return new GenericBuildConfiguration(target, qobject_cast<GenericBuildConfiguration *>(source));
|
||||
return new GenericBuildConfiguration(parent, qobject_cast<GenericBuildConfiguration *>(source));
|
||||
}
|
||||
|
||||
bool GenericBuildConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
bool GenericBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||
}
|
||||
@@ -222,16 +223,53 @@ BuildConfiguration *GenericBuildConfigurationFactory::restore(ProjectExplorer::T
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
GenericTarget *target(static_cast<GenericTarget *>(parent));
|
||||
GenericBuildConfiguration *bc(new GenericBuildConfiguration(target));
|
||||
GenericBuildConfiguration *bc(new GenericBuildConfiguration(parent));
|
||||
if (bc->fromMap(map))
|
||||
return bc;
|
||||
delete bc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GenericBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
|
||||
{
|
||||
if (!t->project()->supportsProfile(t->profile()))
|
||||
return false;
|
||||
return qobject_cast<GenericProject *>(t->project());
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildType GenericBuildConfiguration::buildType() const
|
||||
{
|
||||
return Unknown;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// GenericBuildSettingsWidget
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericBuildSettingsWidget::GenericBuildSettingsWidget() : m_buildConfiguration(0)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setContentsMargins(0, -1, 0, -1);
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
|
||||
// build directory
|
||||
m_pathChooser = new Utils::PathChooser(this);
|
||||
m_pathChooser->setEnabled(true);
|
||||
fl->addRow(tr("Build directory:"), m_pathChooser);
|
||||
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
|
||||
}
|
||||
|
||||
QString GenericBuildSettingsWidget::displayName() const
|
||||
{ return tr("Generic Manager"); }
|
||||
|
||||
void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
|
||||
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
|
||||
m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::buildDirectoryChanged()
|
||||
{
|
||||
m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
|
||||
}
|
||||
|
@@ -34,6 +34,9 @@
|
||||
#define GENERICBUILDCONFIGURATION_H
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildstep.h> // for BuildConfigWidget
|
||||
|
||||
namespace Utils { class PathChooser; }
|
||||
|
||||
namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
@@ -47,11 +50,10 @@ class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
friend class GenericBuildConfigurationFactory;
|
||||
|
||||
public:
|
||||
explicit GenericBuildConfiguration(GenericTarget *parent);
|
||||
explicit GenericBuildConfiguration(ProjectExplorer::Target *parent);
|
||||
virtual ~GenericBuildConfiguration();
|
||||
|
||||
GenericTarget *genericTarget() const;
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
virtual QString buildDirectory() const;
|
||||
|
||||
QString rawBuildDirectory() const;
|
||||
@@ -64,8 +66,8 @@ public:
|
||||
BuildType buildType() const;
|
||||
|
||||
protected:
|
||||
GenericBuildConfiguration(GenericTarget *parent, GenericBuildConfiguration *source);
|
||||
GenericBuildConfiguration(GenericTarget *parent, const Core::Id id);
|
||||
GenericBuildConfiguration(ProjectExplorer::Target *parent, GenericBuildConfiguration *source);
|
||||
GenericBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id);
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
@@ -80,17 +82,39 @@ public:
|
||||
explicit GenericBuildConfigurationFactory(QObject *parent = 0);
|
||||
~GenericBuildConfigurationFactory();
|
||||
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
|
||||
QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
|
||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
|
||||
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
|
||||
bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
|
||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
|
||||
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
|
||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
|
||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||
|
||||
private:
|
||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
||||
};
|
||||
|
||||
class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GenericBuildSettingsWidget();
|
||||
|
||||
QString displayName() const;
|
||||
|
||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void buildDirectoryChanged();
|
||||
|
||||
private:
|
||||
Utils::PathChooser *m_pathChooser;
|
||||
GenericBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace GenericProjectManager
|
||||
} // namespace Internal
|
||||
} // namespace GenericProjectManager
|
||||
#endif // GENERICBUILDCONFIGURATION_H
|
||||
|
@@ -33,16 +33,16 @@
|
||||
#include "genericmakestep.h"
|
||||
#include "genericprojectconstants.h"
|
||||
#include "genericproject.h"
|
||||
#include "generictarget.h"
|
||||
#include "ui_genericmakestep.h"
|
||||
#include "genericbuildconfiguration.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <coreplugin/variablemanager.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -126,8 +126,10 @@ bool GenericMakeStep::init()
|
||||
setIgnoreReturnValue(m_clean);
|
||||
|
||||
setOutputParser(new ProjectExplorer::GnuMakeParser());
|
||||
if (bc->genericTarget()->genericProject()->toolChain())
|
||||
appendOutputParser(bc->genericTarget()->genericProject()->toolChain()->outputParser());
|
||||
ProjectExplorer::ToolChain *tc =
|
||||
ProjectExplorer::ToolChainProfileInformation::toolChain(bc->target()->profile());
|
||||
if (tc)
|
||||
appendOutputParser(tc->outputParser());
|
||||
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
|
||||
|
||||
return AbstractProcessStep::init();
|
||||
@@ -175,9 +177,9 @@ QString GenericMakeStep::makeCommand() const
|
||||
{
|
||||
QString command = m_makeCommand;
|
||||
if (command.isEmpty()) {
|
||||
GenericProject *pro = static_cast<GenericProject *>(target()->project());
|
||||
if (ProjectExplorer::ToolChain *toolChain = pro->toolChain())
|
||||
command = toolChain->makeCommand();
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
|
||||
if (tc)
|
||||
command = tc->makeCommand();
|
||||
else
|
||||
command = QLatin1String("make");
|
||||
}
|
||||
@@ -249,7 +251,7 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt
|
||||
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
||||
this, SLOT(updateDetails()));
|
||||
|
||||
connect(pro, SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
|
||||
connect(m_makeStep->target(), SIGNAL(profileChanged()),
|
||||
this, SLOT(updateMakeOverrrideLabel()));
|
||||
}
|
||||
|
||||
|
@@ -34,17 +34,19 @@
|
||||
|
||||
#include "genericbuildconfiguration.h"
|
||||
#include "genericprojectconstants.h"
|
||||
#include "generictarget.h"
|
||||
|
||||
#include "genericmakestep.h"
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/buildenvironmentwidget.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/headerpath.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/profilemanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
#include <cpptools/ModelManagerInterface.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -54,7 +56,6 @@
|
||||
#include <QDir>
|
||||
#include <QProcessEnvironment>
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QMainWindow>
|
||||
#include <QComboBox>
|
||||
|
||||
@@ -62,18 +63,13 @@ using namespace GenericProjectManager;
|
||||
using namespace GenericProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace {
|
||||
const char * const TOOLCHAIN_KEY("GenericProjectManager.GenericProject.Toolchain");
|
||||
} // end of anonymous namespace
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// GenericProject
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericProject::GenericProject(Manager *manager, const QString &fileName)
|
||||
: m_manager(manager),
|
||||
m_fileName(fileName),
|
||||
m_toolChain(0)
|
||||
m_fileName(fileName)
|
||||
{
|
||||
setProjectContext(Core::Context(GenericProjectManager::Constants::PROJECTCONTEXT));
|
||||
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
|
||||
@@ -107,12 +103,6 @@ GenericProject::~GenericProject()
|
||||
m_manager->unregisterProject(this);
|
||||
|
||||
delete m_rootNode;
|
||||
// do not delete m_toolChain
|
||||
}
|
||||
|
||||
GenericTarget *GenericProject::activeTarget() const
|
||||
{
|
||||
return static_cast<GenericTarget *>(Project::activeTarget());
|
||||
}
|
||||
|
||||
QString GenericProject::filesFileName() const
|
||||
@@ -261,11 +251,13 @@ void GenericProject::refresh(RefreshOptions options)
|
||||
CPlusPlus::CppModelManagerInterface::ProjectPart::Ptr part(
|
||||
new CPlusPlus::CppModelManagerInterface::ProjectPart);
|
||||
|
||||
if (m_toolChain) {
|
||||
part->defines = m_toolChain->predefinedMacros(QStringList());
|
||||
ToolChain *tc = activeTarget() ?
|
||||
ProjectExplorer::ToolChainProfileInformation::toolChain(activeTarget()->profile()) : 0;
|
||||
if (tc) {
|
||||
part->defines = tc->predefinedMacros(QStringList());
|
||||
part->defines += '\n';
|
||||
|
||||
foreach (const HeaderPath &headerPath, m_toolChain->systemHeaderPaths()) {
|
||||
foreach (const HeaderPath &headerPath, tc->systemHeaderPaths()) {
|
||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
||||
part->frameworkPaths.append(headerPath.path());
|
||||
else
|
||||
@@ -389,27 +381,6 @@ QByteArray GenericProject::defines() const
|
||||
return m_defines;
|
||||
}
|
||||
|
||||
void GenericProject::setToolChain(ToolChain *tc)
|
||||
{
|
||||
if (m_toolChain == tc)
|
||||
return;
|
||||
|
||||
m_toolChain = tc;
|
||||
refresh(Configuration);
|
||||
|
||||
foreach (Target *t, targets()) {
|
||||
foreach (BuildConfiguration *bc, t->buildConfigurations())
|
||||
bc->setToolChain(tc);
|
||||
}
|
||||
|
||||
emit toolChainChanged(m_toolChain);
|
||||
}
|
||||
|
||||
ToolChain *GenericProject::toolChain() const
|
||||
{
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
QString GenericProject::displayName() const
|
||||
{
|
||||
return m_projectName;
|
||||
@@ -456,18 +427,14 @@ QStringList GenericProject::buildTargets() const
|
||||
return targets;
|
||||
}
|
||||
|
||||
QVariantMap GenericProject::toMap() const
|
||||
{
|
||||
QVariantMap map(Project::toMap());
|
||||
map.insert(QLatin1String(TOOLCHAIN_KEY), m_toolChain ? m_toolChain->id() : QString());
|
||||
return map;
|
||||
}
|
||||
|
||||
bool GenericProject::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!Project::fromMap(map))
|
||||
return false;
|
||||
|
||||
if (!activeTarget())
|
||||
addTarget(createTarget(ProfileManager::instance()->defaultProfile()));
|
||||
|
||||
// Sanity check: We need both a buildconfiguration and a runconfiguration!
|
||||
QList<Target *> targetList = targets();
|
||||
foreach (Target *t, targetList) {
|
||||
@@ -480,119 +447,16 @@ bool GenericProject::fromMap(const QVariantMap &map)
|
||||
t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
|
||||
}
|
||||
|
||||
// Add default setup:
|
||||
if (targets().isEmpty()) {
|
||||
GenericTargetFactory *factory =
|
||||
ExtensionSystem::PluginManager::getObject<GenericTargetFactory>();
|
||||
addTarget(factory->create(this, Core::Id(GENERIC_DESKTOP_TARGET_ID)));
|
||||
}
|
||||
|
||||
QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
|
||||
const ToolChainManager *toolChainManager = ToolChainManager::instance();
|
||||
|
||||
if (!id.isNull()) {
|
||||
setToolChain(toolChainManager->findToolChain(id));
|
||||
} else {
|
||||
ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
|
||||
abi = ProjectExplorer::Abi(abi.architecture(), abi.os(), ProjectExplorer::Abi::UnknownFlavor,
|
||||
abi.binaryFormat(), abi.wordWidth() == 32 ? 32 : 0);
|
||||
QList<ToolChain *> tcs = toolChainManager->findToolChains(abi);
|
||||
if (tcs.isEmpty())
|
||||
tcs = toolChainManager->toolChains();
|
||||
if (!tcs.isEmpty())
|
||||
setToolChain(tcs.at(0));
|
||||
}
|
||||
|
||||
setIncludePaths(allIncludePaths());
|
||||
|
||||
refresh(Everything);
|
||||
evaluateBuildSystem();
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// GenericBuildSettingsWidget
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericTarget *target)
|
||||
: m_target(target), m_toolChainChooser(0), m_buildConfiguration(0)
|
||||
void GenericProject::evaluateBuildSystem()
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setContentsMargins(0, -1, 0, -1);
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
|
||||
// build directory
|
||||
m_pathChooser = new Utils::PathChooser(this);
|
||||
m_pathChooser->setEnabled(true);
|
||||
m_pathChooser->setBaseDirectory(m_target->genericProject()->projectDirectory());
|
||||
fl->addRow(tr("Build directory:"), m_pathChooser);
|
||||
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
|
||||
|
||||
// tool chain
|
||||
m_toolChainChooser = new QComboBox;
|
||||
m_toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
updateToolChainList();
|
||||
|
||||
fl->addRow(tr("Tool chain:"), m_toolChainChooser);
|
||||
connect(m_toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
|
||||
connect(m_target->genericProject(), SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(toolChainChanged(ProjectExplorer::ToolChain*)));
|
||||
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(updateToolChainList()));
|
||||
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(updateToolChainList()));
|
||||
}
|
||||
|
||||
GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
|
||||
{ }
|
||||
|
||||
QString GenericBuildSettingsWidget::displayName() const
|
||||
{ return tr("Generic Manager"); }
|
||||
|
||||
void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
|
||||
m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::buildDirectoryChanged()
|
||||
{
|
||||
m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::toolChainSelected(int index)
|
||||
{
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
ToolChain *tc = static_cast<ToolChain *>(m_toolChainChooser->itemData(index).value<void *>());
|
||||
m_target->genericProject()->setToolChain(tc);
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::toolChainChanged(ProjectExplorer::ToolChain *tc)
|
||||
{
|
||||
for (int i = 0; i < m_toolChainChooser->count(); ++i) {
|
||||
ToolChain * currentTc = static_cast<ToolChain *>(m_toolChainChooser->itemData(i).value<void *>());
|
||||
if (currentTc != tc)
|
||||
continue;
|
||||
m_toolChainChooser->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::updateToolChainList()
|
||||
{
|
||||
m_toolChainChooser->clear();
|
||||
|
||||
QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains();
|
||||
if (!m_target->genericProject()->toolChain()) {
|
||||
m_toolChainChooser->addItem(tr("<Invalid tool chain>"), qVariantFromValue(static_cast<void *>(0)));
|
||||
m_toolChainChooser->setCurrentIndex(0);
|
||||
}
|
||||
foreach (ToolChain *tc, tcs) {
|
||||
m_toolChainChooser->addItem(tc->displayName(), qVariantFromValue(static_cast<void *>(tc)));
|
||||
if (m_target->genericProject()->toolChain()
|
||||
&& m_target->genericProject()->toolChain()->id() == tc->id())
|
||||
m_toolChainChooser->setCurrentIndex(m_toolChainChooser->count() - 1);
|
||||
}
|
||||
refresh(Everything);
|
||||
buildSystemEvaluationFinished(true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -35,13 +35,11 @@
|
||||
|
||||
#include "genericprojectmanager.h"
|
||||
#include "genericprojectnodes.h"
|
||||
#include "generictarget.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
@@ -51,13 +49,7 @@ QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class PathChooser;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class ToolChain;
|
||||
}
|
||||
namespace ProjectExplorer { class ToolChain; }
|
||||
|
||||
namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
@@ -84,7 +76,6 @@ public:
|
||||
Core::Id id() const;
|
||||
Core::IDocument *document() const;
|
||||
ProjectExplorer::IProjectManager *projectManager() const;
|
||||
GenericTarget *activeTarget() const;
|
||||
|
||||
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
@@ -114,18 +105,12 @@ public:
|
||||
QStringList projectIncludePaths() const;
|
||||
QStringList files() const;
|
||||
QStringList generated() const;
|
||||
ProjectExplorer::ToolChain *toolChain() const;
|
||||
void setToolChain(ProjectExplorer::ToolChain *tc);
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
signals:
|
||||
void toolChainChanged(ProjectExplorer::ToolChain *);
|
||||
|
||||
protected:
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
void evaluateBuildSystem();
|
||||
bool saveRawFileList(const QStringList &rawFileList);
|
||||
void parseProject(RefreshOptions options);
|
||||
QStringList processEntries(const QStringList &paths,
|
||||
@@ -150,7 +135,6 @@ private:
|
||||
QByteArray m_defines;
|
||||
|
||||
GenericProjectNode *m_rootNode;
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
QFuture<void> m_codeModelFuture;
|
||||
};
|
||||
|
||||
@@ -182,31 +166,6 @@ private:
|
||||
GenericProject::RefreshOptions m_options;
|
||||
};
|
||||
|
||||
class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GenericBuildSettingsWidget(GenericTarget *target);
|
||||
virtual ~GenericBuildSettingsWidget();
|
||||
|
||||
virtual QString displayName() const;
|
||||
|
||||
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private Q_SLOTS:
|
||||
void buildDirectoryChanged();
|
||||
void toolChainSelected(int index);
|
||||
void toolChainChanged(ProjectExplorer::ToolChain *);
|
||||
void updateToolChainList();
|
||||
|
||||
private:
|
||||
GenericTarget *m_target;
|
||||
Utils::PathChooser *m_pathChooser;
|
||||
QComboBox *m_toolChainChooser;
|
||||
GenericBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace GenericProjectManager
|
||||
|
||||
|
@@ -4,7 +4,6 @@ include(../../qtcreatorplugin.pri)
|
||||
include(genericprojectmanager_dependencies.pri)
|
||||
HEADERS = genericproject.h \
|
||||
genericprojectplugin.h \
|
||||
generictarget.h \
|
||||
genericprojectmanager.h \
|
||||
genericprojectconstants.h \
|
||||
genericprojectnodes.h \
|
||||
@@ -17,7 +16,6 @@ HEADERS = genericproject.h \
|
||||
filesselectionwizardpage.h
|
||||
SOURCES = genericproject.cpp \
|
||||
genericprojectplugin.cpp \
|
||||
generictarget.cpp \
|
||||
genericprojectmanager.cpp \
|
||||
genericprojectnodes.cpp \
|
||||
genericprojectwizard.cpp \
|
||||
|
@@ -25,7 +25,6 @@ QtcPlugin {
|
||||
files: [
|
||||
"genericproject.h",
|
||||
"genericprojectplugin.h",
|
||||
"generictarget.h",
|
||||
"genericprojectmanager.h",
|
||||
"genericprojectconstants.h",
|
||||
"genericprojectnodes.h",
|
||||
@@ -38,7 +37,6 @@ QtcPlugin {
|
||||
"filesselectionwizardpage.h",
|
||||
"genericproject.cpp",
|
||||
"genericprojectplugin.cpp",
|
||||
"generictarget.cpp",
|
||||
"genericprojectmanager.cpp",
|
||||
"genericprojectnodes.cpp",
|
||||
"genericprojectwizard.cpp",
|
||||
|
@@ -31,12 +31,13 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "genericprojectplugin.h"
|
||||
|
||||
#include "genericbuildconfiguration.h"
|
||||
#include "genericprojectmanager.h"
|
||||
#include "genericprojectwizard.h"
|
||||
#include "genericprojectconstants.h"
|
||||
#include "genericprojectfileseditor.h"
|
||||
#include "genericmakestep.h"
|
||||
#include "generictarget.h"
|
||||
#include "genericproject.h"
|
||||
#include "selectablefilesmodel.h"
|
||||
|
||||
@@ -92,7 +93,7 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
|
||||
addAutoReleasedObject(manager);
|
||||
addAutoReleasedObject(new GenericMakeStepFactory);
|
||||
addAutoReleasedObject(new GenericProjectWizard);
|
||||
addAutoReleasedObject(new GenericTargetFactory);
|
||||
addAutoReleasedObject(new GenericBuildConfigurationFactory);
|
||||
|
||||
const Core::Context projectContext(Constants::PROJECTCONTEXT);
|
||||
Core::ActionContainer *mproject =
|
||||
|
@@ -1,176 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "generictarget.h"
|
||||
|
||||
#include "genericbuildconfiguration.h"
|
||||
#include "genericproject.h"
|
||||
#include "genericmakestep.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStyle>
|
||||
|
||||
const char GENERIC_DESKTOP_TARGET_DISPLAY_NAME[] = "Desktop";
|
||||
|
||||
using namespace GenericProjectManager;
|
||||
using namespace GenericProjectManager::Internal;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// GenericTarget
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericTarget::GenericTarget(GenericProject *parent) :
|
||||
ProjectExplorer::Target(parent, Core::Id(GENERIC_DESKTOP_TARGET_ID)),
|
||||
m_buildConfigurationFactory(new GenericBuildConfigurationFactory(this))
|
||||
{
|
||||
setDefaultDisplayName(QApplication::translate("GenericProjectManager::GenericTarget",
|
||||
GENERIC_DESKTOP_TARGET_DISPLAY_NAME));
|
||||
setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *GenericTarget::createConfigWidget()
|
||||
{
|
||||
return new GenericBuildSettingsWidget(this);
|
||||
}
|
||||
|
||||
GenericProject *GenericTarget::genericProject() const
|
||||
{
|
||||
return static_cast<GenericProject *>(project());
|
||||
}
|
||||
|
||||
GenericBuildConfigurationFactory *GenericTarget::buildConfigurationFactory() const
|
||||
{
|
||||
return m_buildConfigurationFactory;
|
||||
}
|
||||
|
||||
GenericBuildConfiguration *GenericTarget::activeBuildConfiguration() const
|
||||
{
|
||||
return static_cast<GenericBuildConfiguration *>(Target::activeBuildConfiguration());
|
||||
}
|
||||
|
||||
bool GenericTarget::fromMap(const QVariantMap &map)
|
||||
{
|
||||
return Target::fromMap(map);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// GenericTargetFactory
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericTargetFactory::GenericTargetFactory(QObject *parent) :
|
||||
ITargetFactory(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool GenericTargetFactory::supportsTargetId(const Core::Id id) const
|
||||
{
|
||||
return id == Core::Id(GENERIC_DESKTOP_TARGET_ID);
|
||||
}
|
||||
|
||||
QList<Core::Id> GenericTargetFactory::supportedTargetIds() const
|
||||
{
|
||||
return QList<Core::Id>() << Core::Id(GENERIC_DESKTOP_TARGET_ID);
|
||||
}
|
||||
|
||||
QString GenericTargetFactory::displayNameForId(const Core::Id id) const
|
||||
{
|
||||
if (id == Core::Id(GENERIC_DESKTOP_TARGET_ID))
|
||||
return QCoreApplication::translate("GenericProjectManager::GenericTarget",
|
||||
GENERIC_DESKTOP_TARGET_DISPLAY_NAME,
|
||||
"Generic desktop target display name");
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool GenericTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
|
||||
{
|
||||
if (!qobject_cast<GenericProject *>(parent))
|
||||
return false;
|
||||
return id == Core::Id(GENERIC_DESKTOP_TARGET_ID);
|
||||
}
|
||||
|
||||
GenericTarget *GenericTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
GenericProject *genericproject = static_cast<GenericProject *>(parent);
|
||||
GenericTarget *t = new GenericTarget(genericproject);
|
||||
|
||||
// Set up BuildConfiguration:
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(t);
|
||||
bc->setDisplayName(QLatin1String("all"));
|
||||
|
||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(buildSteps);
|
||||
buildSteps->insertStep(0, makeStep);
|
||||
makeStep->setBuildTarget(QLatin1String("all"), /* on = */ true);
|
||||
|
||||
GenericMakeStep *cleanMakeStep = new GenericMakeStep(cleanSteps);
|
||||
cleanSteps->insertStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setBuildTarget(QLatin1String("clean"), /* on = */ true);
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
bc->setBuildDirectory(genericproject->projectDirectory());
|
||||
|
||||
t->addBuildConfiguration(bc);
|
||||
|
||||
t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID));
|
||||
|
||||
// Add a runconfiguration. The CustomExecutableRC one will query the user
|
||||
// for its settings, so it is a good choice here.
|
||||
t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
bool GenericTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||
}
|
||||
|
||||
GenericTarget *GenericTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
GenericProject *genericproject = static_cast<GenericProject *>(parent);
|
||||
GenericTarget *target = new GenericTarget(genericproject);
|
||||
if (target->fromMap(map))
|
||||
return target;
|
||||
delete target;
|
||||
return 0;
|
||||
}
|
@@ -1,100 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef GENERICTARGET_H
|
||||
#define GENERICTARGET_H
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include "genericbuildconfiguration.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QVariantMap>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class IBuildConfigurationFactory;
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
const char GENERIC_DESKTOP_TARGET_ID[] = "GenericProjectManager.GenericTarget";
|
||||
|
||||
class GenericProject;
|
||||
class GenericRunConfiguration;
|
||||
|
||||
class GenericTargetFactory;
|
||||
|
||||
class GenericTarget : public ProjectExplorer::Target
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class GenericTargetFactory;
|
||||
|
||||
public:
|
||||
explicit GenericTarget(GenericProject *parent);
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
|
||||
GenericProject *genericProject() const;
|
||||
|
||||
GenericBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||
GenericBuildConfiguration *activeBuildConfiguration() const;
|
||||
|
||||
protected:
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
GenericBuildConfigurationFactory *m_buildConfigurationFactory;
|
||||
};
|
||||
|
||||
class GenericTargetFactory : public ProjectExplorer::ITargetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GenericTargetFactory(QObject *parent = 0);
|
||||
|
||||
bool supportsTargetId(const Core::Id id) const;
|
||||
|
||||
QList<Core::Id> supportedTargetIds() const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
|
||||
GenericTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
|
||||
bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
|
||||
GenericTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace GenericProjectManager
|
||||
|
||||
#endif // GENERICTARGET_H
|
728
src/plugins/madde/debianmanager.cpp
Normal file
728
src/plugins/madde/debianmanager.cpp
Normal file
@@ -0,0 +1,728 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "debianmanager.h"
|
||||
|
||||
#include "maddedevice.h"
|
||||
#include "maemoconstants.h"
|
||||
#include "maemoglobal.h"
|
||||
#include "maemopackagecreationstep.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||
#include <qtsupport/qtprofileinformation.h>
|
||||
#include <utils/filesystemwatcher.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Helpers:
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
|
||||
const QByteArray IconFieldName("XB-Maemo-Icon-26");
|
||||
const QByteArray NameFieldName("Package");
|
||||
const QByteArray ShortDescriptionFieldName("Description");
|
||||
|
||||
const QLatin1String PackagingDirName("qtc_packaging");
|
||||
|
||||
// The QDateTime API can only deliver these in localized form...
|
||||
QString shortMonthName(const QDateTime &dt)
|
||||
{
|
||||
switch (dt.date().month()) {
|
||||
case 1: return QLatin1String("Jan");
|
||||
case 2: return QLatin1String("Feb");
|
||||
case 3: return QLatin1String("Mar");
|
||||
case 4: return QLatin1String("Apr");
|
||||
case 5: return QLatin1String("May");
|
||||
case 6: return QLatin1String("Jun");
|
||||
case 7: return QLatin1String("Jul");
|
||||
case 8: return QLatin1String("Aug");
|
||||
case 9: return QLatin1String("Sep");
|
||||
case 10: return QLatin1String("Oct");
|
||||
case 11: return QLatin1String("Nov");
|
||||
case 12: return QLatin1String("Dec");
|
||||
default: QTC_ASSERT(false, return QString());
|
||||
}
|
||||
}
|
||||
|
||||
QString shortDayOfWeekName(const QDateTime &dt)
|
||||
{
|
||||
switch (dt.date().dayOfWeek()) {
|
||||
case Qt::Monday: return QLatin1String("Mon");
|
||||
case Qt::Tuesday: return QLatin1String("Tue");
|
||||
case Qt::Wednesday: return QLatin1String("Wed");
|
||||
case Qt::Thursday: return QLatin1String("Thu");
|
||||
case Qt::Friday: return QLatin1String("Fri");
|
||||
case Qt::Saturday: return QLatin1String("Sat");
|
||||
case Qt::Sunday: return QLatin1String("Sun");
|
||||
default: QTC_ASSERT(false, return QString());
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray packageManagerNameFieldName(Core::Id deviceType)
|
||||
{
|
||||
if (deviceType == Core::Id(Madde::Internal::Maemo5OsType))
|
||||
return QByteArray("XB-Maemo-Display-Name");
|
||||
return QByteArray("XSBC-Maemo-Display-Name");
|
||||
}
|
||||
|
||||
QList<QPair<QByteArray, QByteArray> > additionalFields(Core::Id deviceType, const QString &projectName)
|
||||
{
|
||||
QList<QPair<QByteArray, QByteArray> > fields;
|
||||
if (deviceType == Core::Id(Madde::Internal::HarmattanOsType))
|
||||
fields << qMakePair(QByteArray("XB-Maemo-Flags"), QByteArray("visible"))
|
||||
<< qMakePair(QByteArray("XB-MeeGo-Desktop-Entry-Filename"),
|
||||
QString::fromLatin1("%1_harmattan").arg(projectName).toUtf8())
|
||||
<< qMakePair(QByteArray("XB-MeeGo-Desktop-Entry"),
|
||||
QString::fromLatin1("\n [Desktop Entry]\n Type=Application\n Name=%1\n Icon=/usr/share/icons/hicolor/80x80/apps/%1%2.png")
|
||||
.arg(projectName).arg(80).toUtf8());
|
||||
return fields;
|
||||
}
|
||||
|
||||
QByteArray section(Core::Id deviceType) {
|
||||
if (deviceType == Core::Id(Madde::Internal::Maemo5OsType))
|
||||
return "user/hidden";
|
||||
else if (deviceType == Core::Id(Madde::Internal::HarmattanOsType))
|
||||
return "user/other";
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
void raiseError(const QString &reason)
|
||||
{
|
||||
QMessageBox::critical(0, QCoreApplication::translate("Madde::DebianManager",
|
||||
"Error creating debian project templates"), reason);
|
||||
}
|
||||
|
||||
QString defaultPackageFileName(ProjectExplorer::Project *project)
|
||||
{
|
||||
QString packageName = project->displayName().toLower();
|
||||
|
||||
// We also replace dots later, because OVI store chokes on them (for the N900).
|
||||
QRegExp illegalLetter(QLatin1String("[^a-z0-9+-]"), Qt::CaseSensitive, QRegExp::WildcardUnix);
|
||||
|
||||
return packageName.replace(illegalLetter, QLatin1String("-"));
|
||||
}
|
||||
|
||||
bool adaptTagValue(QByteArray &document, const QByteArray &fieldName,
|
||||
const QByteArray &newFieldValue, bool caseSensitive)
|
||||
{
|
||||
QByteArray adaptedLine = fieldName + ": " + newFieldValue;
|
||||
const QByteArray completeTag = fieldName + ':';
|
||||
const int lineOffset = caseSensitive ? document.indexOf(completeTag)
|
||||
: document.toLower().indexOf(completeTag.toLower());
|
||||
if (lineOffset == -1) {
|
||||
document.append(adaptedLine).append('\n');
|
||||
return true;
|
||||
}
|
||||
|
||||
int newlineOffset = document.indexOf('\n', lineOffset);
|
||||
bool updated = false;
|
||||
if (newlineOffset == -1) {
|
||||
newlineOffset = document.length();
|
||||
adaptedLine += '\n';
|
||||
updated = true;
|
||||
}
|
||||
const int replaceCount = newlineOffset - lineOffset;
|
||||
if (!updated && document.mid(lineOffset, replaceCount) != adaptedLine)
|
||||
updated = true;
|
||||
if (updated)
|
||||
document.replace(lineOffset, replaceCount, adaptedLine);
|
||||
return updated;
|
||||
}
|
||||
|
||||
QByteArray controlFileFieldValue(const Utils::FileName &control, const QString &key, bool multiLine)
|
||||
{
|
||||
QByteArray value;
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(control.toString()))
|
||||
return value;
|
||||
const QByteArray &contents = reader.data();
|
||||
const int keyPos = contents.indexOf(key.toUtf8() + ':');
|
||||
if (keyPos == -1)
|
||||
return value;
|
||||
int valueStartPos = keyPos + key.length() + 1;
|
||||
int valueEndPos = contents.indexOf('\n', keyPos);
|
||||
if (valueEndPos == -1)
|
||||
valueEndPos = contents.count();
|
||||
value = contents.mid(valueStartPos, valueEndPos - valueStartPos).trimmed();
|
||||
if (multiLine) {
|
||||
Q_FOREVER {
|
||||
valueStartPos = valueEndPos + 1;
|
||||
if (valueStartPos >= contents.count())
|
||||
break;
|
||||
const char firstChar = contents.at(valueStartPos);
|
||||
if (firstChar == '#' || isspace(firstChar)) {
|
||||
valueEndPos = contents.indexOf('\n', valueStartPos);
|
||||
if (valueEndPos == -1)
|
||||
valueEndPos = contents.count();
|
||||
if (firstChar != '#') {
|
||||
value += contents.mid(valueStartPos,
|
||||
valueEndPos - valueStartPos).trimmed();
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
bool setControlFieldValue(const Utils::FileName &control, const QByteArray &fieldName,
|
||||
const QByteArray &fieldValue)
|
||||
{
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(control.toString()))
|
||||
return false;
|
||||
QByteArray contents = reader.data();
|
||||
if (!adaptTagValue(contents, fieldName, fieldValue, true))
|
||||
return false;
|
||||
Core::FileChangeBlocker update(control.toString());
|
||||
Utils::FileSaver saver(control.toString());
|
||||
saver.write(contents);
|
||||
return saver.finalize();
|
||||
}
|
||||
|
||||
bool adaptRulesFile(const Utils::FileName &rulesPath)
|
||||
{
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(rulesPath.toString())) {
|
||||
raiseError(reader.errorString());
|
||||
return false;
|
||||
}
|
||||
QByteArray rulesContents = reader.data();
|
||||
const QByteArray comment("# Uncomment this line for use without Qt Creator");
|
||||
rulesContents.replace("DESTDIR", "INSTALL_ROOT");
|
||||
rulesContents.replace("dh_shlibdeps", "# dh_shlibdeps " + comment);
|
||||
rulesContents.replace("# Add here commands to configure the package.",
|
||||
"# qmake PREFIX=/usr" + comment);
|
||||
rulesContents.replace("$(MAKE)\n", "# $(MAKE) " + comment + '\n');
|
||||
|
||||
// Would be the right solution, but does not work (on Windows),
|
||||
// because dpkg-genchanges doesn't know about it (and can't be told).
|
||||
// rulesContents.replace("dh_builddeb", "dh_builddeb --destdir=.");
|
||||
|
||||
Utils::FileSaver saver(rulesPath.toString());
|
||||
saver.write(rulesContents);
|
||||
if (!saver.finalize()) {
|
||||
raiseError(saver.errorString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool adaptControlFile(const Utils::FileName &controlPath, Qt4ProjectManager::Qt4BuildConfiguration *bc,
|
||||
const QByteArray §ion, const QByteArray &packageManagerNameField,
|
||||
QList<QPair<QByteArray, QByteArray> > additionalFields)
|
||||
{
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(controlPath.toString())) {
|
||||
raiseError(reader.errorString());
|
||||
return false;
|
||||
}
|
||||
QByteArray controlContents = reader.data();
|
||||
|
||||
adaptTagValue(controlContents, "Section", section, true);
|
||||
adaptTagValue(controlContents, "Priority", "optional", true);
|
||||
adaptTagValue(controlContents, packageManagerNameField,
|
||||
bc->target()->project()->displayName().toUtf8(), true);
|
||||
const int buildDependsOffset = controlContents.indexOf("Build-Depends:");
|
||||
if (buildDependsOffset == -1) {
|
||||
qDebug("Unexpected: no Build-Depends field in debian control file.");
|
||||
} else {
|
||||
int buildDependsNewlineOffset
|
||||
= controlContents.indexOf('\n', buildDependsOffset);
|
||||
if (buildDependsNewlineOffset == -1) {
|
||||
controlContents += '\n';
|
||||
buildDependsNewlineOffset = controlContents.length() - 1;
|
||||
}
|
||||
controlContents.insert(buildDependsNewlineOffset,
|
||||
", libqt4-dev");
|
||||
}
|
||||
|
||||
for (int i = 0; i < additionalFields.count(); ++i)
|
||||
adaptTagValue(controlContents, additionalFields.at(i).first, additionalFields.at(i).second, true);
|
||||
|
||||
Utils::FileSaver saver(controlPath.toString());
|
||||
saver.write(controlContents);
|
||||
if (!saver.finalize()) {
|
||||
raiseError(saver.errorString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Madde {
|
||||
namespace Internal {
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// DebianManager:
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
DebianManager *DebianManager::m_instance = 0;
|
||||
|
||||
DebianManager::DebianManager(QObject *parent) :
|
||||
QObject(parent),
|
||||
m_watcher(new Utils::FileSystemWatcher(this))
|
||||
{
|
||||
m_instance = this;
|
||||
|
||||
m_watcher->setObjectName("Madde::DebianManager");
|
||||
connect(m_watcher, SIGNAL(directoryChanged(QString)),
|
||||
this, SLOT(directoryWasChanged(QString)));
|
||||
}
|
||||
|
||||
DebianManager::~DebianManager()
|
||||
{ }
|
||||
|
||||
DebianManager *DebianManager::instance()
|
||||
{
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
void DebianManager::monitor(const Utils::FileName &debianDir)
|
||||
{
|
||||
QFileInfo fi = debianDir.toFileInfo();
|
||||
if (!fi.isDir())
|
||||
return;
|
||||
|
||||
if (!m_watches.contains(debianDir)) {
|
||||
m_watches.insert(debianDir, 1);
|
||||
m_watcher->addDirectory(debianDir.toString(), Utils::FileSystemWatcher::WatchAllChanges);
|
||||
|
||||
WatchableFile *controlFile = new WatchableFile(controlFilePath(debianDir).toString(), this);
|
||||
connect(controlFile, SIGNAL(modified()), this, SLOT(controlWasChanged()));
|
||||
WatchableFile *changelogFile = new WatchableFile(changelogFilePath(debianDir).toString(), this);
|
||||
connect(changelogFile, SIGNAL(modified()), SLOT(changelogWasChanged()));
|
||||
Core::DocumentManager::addDocuments(QList<Core::IDocument *>() << controlFile << changelogFile);
|
||||
}
|
||||
}
|
||||
|
||||
bool DebianManager::isMonitoring(const Utils::FileName &debianDir)
|
||||
{
|
||||
return m_watches.contains(debianDir);
|
||||
}
|
||||
|
||||
void DebianManager::ignore(const Utils::FileName &debianDir)
|
||||
{
|
||||
int count = m_watches.value(debianDir, 0) - 1;
|
||||
if (count < 0)
|
||||
return;
|
||||
if (count > 0) {
|
||||
m_watches[debianDir] = 0;
|
||||
} else {
|
||||
m_watches.remove(debianDir);
|
||||
m_watcher->removeDirectory(debianDir.toString());
|
||||
}
|
||||
}
|
||||
|
||||
QString DebianManager::projectVersion(const Utils::FileName &debianDir, QString *error)
|
||||
{
|
||||
Utils::FileName path = changelogFilePath(debianDir);
|
||||
QFile changelog(path.toString());
|
||||
if (!changelog.open(QIODevice::ReadOnly)) {
|
||||
if (error)
|
||||
*error = tr("Failed to open debian changelog \"%1\" file for reading.").arg(path.toUserOutput());
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QByteArray &firstLine = changelog.readLine();
|
||||
const int openParenPos = firstLine.indexOf('(');
|
||||
if (openParenPos == -1) {
|
||||
if (error)
|
||||
*error = tr("Debian changelog file '%1' has unexpected format.").arg(path.toUserOutput());
|
||||
return QString();
|
||||
}
|
||||
const int closeParenPos = firstLine.indexOf(')', openParenPos);
|
||||
if (closeParenPos == -1) {
|
||||
if (error)
|
||||
*error = tr("Debian changelog file '%1' has unexpected format.").arg(path.toUserOutput());
|
||||
return QString();
|
||||
}
|
||||
return QString::fromUtf8(firstLine.mid(openParenPos + 1, closeParenPos - openParenPos - 1).data());
|
||||
}
|
||||
|
||||
bool DebianManager::setProjectVersion(const Utils::FileName &debianDir, const QString &version, QString *error)
|
||||
{
|
||||
const Utils::FileName filePath = changelogFilePath(debianDir);
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(filePath.toString(), error))
|
||||
return false;
|
||||
QString content = QString::fromUtf8(reader.data());
|
||||
if (content.contains(QLatin1Char('(') + version + QLatin1Char(')'))) {
|
||||
if (error)
|
||||
*error = tr("Refusing to update changelog file: Already contains version '%1'.").arg(version);
|
||||
return false;
|
||||
}
|
||||
|
||||
int maintainerOffset = content.indexOf(QLatin1String("\n -- "));
|
||||
const int eolOffset = content.indexOf(QLatin1Char('\n'), maintainerOffset + 1);
|
||||
if (maintainerOffset == -1 || eolOffset == -1) {
|
||||
if (error)
|
||||
*error = tr("Cannot update changelog: Invalid format (no maintainer entry found).");
|
||||
return false;
|
||||
}
|
||||
|
||||
++maintainerOffset;
|
||||
const QDateTime currentDateTime = QDateTime::currentDateTime();
|
||||
QDateTime utcDateTime = QDateTime(currentDateTime);
|
||||
utcDateTime.setTimeSpec(Qt::UTC);
|
||||
int utcOffsetSeconds = currentDateTime.secsTo(utcDateTime);
|
||||
QChar sign;
|
||||
if (utcOffsetSeconds < 0) {
|
||||
utcOffsetSeconds = -utcOffsetSeconds;
|
||||
sign = QLatin1Char('-');
|
||||
} else {
|
||||
sign = QLatin1Char('+');
|
||||
}
|
||||
const int utcOffsetMinutes = (utcOffsetSeconds / 60) % 60;
|
||||
const int utcOffsetHours = utcOffsetSeconds / 3600;
|
||||
const QString dateString = QString::fromLatin1("%1, %2 %3 %4 %5%6%7")
|
||||
.arg(shortDayOfWeekName(currentDateTime))
|
||||
.arg(currentDateTime.toString(QLatin1String("dd")))
|
||||
.arg(shortMonthName(currentDateTime))
|
||||
.arg(currentDateTime.toString(QLatin1String("yyyy hh:mm:ss"))).arg(sign)
|
||||
.arg(utcOffsetHours, 2, 10, QLatin1Char('0'))
|
||||
.arg(utcOffsetMinutes, 2, 10, QLatin1Char('0'));
|
||||
const QString maintainerLine = content.mid(maintainerOffset, eolOffset - maintainerOffset + 1)
|
||||
.replace(QRegExp(QLatin1String("> [^\\n]*\n")),
|
||||
QString::fromLatin1("> %1").arg(dateString));
|
||||
QString versionLine = content.left(content.indexOf(QLatin1Char('\n')))
|
||||
.replace(QRegExp(QLatin1String("\\([a-zA-Z0-9_\\.]+\\)")),
|
||||
QLatin1Char('(') + version + QLatin1Char(')'));
|
||||
const QString newEntry = versionLine + QLatin1String("\n * <Add change description here>\n\n")
|
||||
+ maintainerLine + QLatin1String("\n\n");
|
||||
content.prepend(newEntry);
|
||||
Core::FileChangeBlocker update(filePath.toString());
|
||||
Utils::FileSaver saver(filePath.toString());
|
||||
saver.write(content.toUtf8());
|
||||
return saver.finalize(error);
|
||||
}
|
||||
|
||||
QString DebianManager::packageName(const Utils::FileName &debianDir)
|
||||
{
|
||||
return QString::fromUtf8(controlFileFieldValue(controlFilePath(debianDir), NameFieldName, false));
|
||||
}
|
||||
|
||||
bool DebianManager::setPackageName(const Utils::FileName &debianDir, const QString &newName)
|
||||
{
|
||||
const QString oldPackageName = packageName(debianDir);
|
||||
|
||||
Utils::FileName controlPath = controlFilePath(debianDir);
|
||||
if (!setControlFieldValue(controlPath, NameFieldName, newName.toUtf8()))
|
||||
return false;
|
||||
if (!setControlFieldValue(controlPath, "Source", newName.toUtf8()))
|
||||
return false;
|
||||
|
||||
Utils::FileName changelogPath = changelogFilePath(debianDir);
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(changelogPath.toString()))
|
||||
return false;
|
||||
QString changelogContents = QString::fromUtf8(reader.data());
|
||||
QRegExp pattern(QLatin1String("[^\\s]+( \\(\\d\\.\\d\\.\\d\\))"));
|
||||
changelogContents.replace(pattern, newName + QLatin1String("\\1"));
|
||||
Core::FileChangeBlocker updateChangelog(changelogPath.toString());
|
||||
Utils::FileSaver saver(changelogPath.toString());
|
||||
saver.write(changelogContents.toUtf8());
|
||||
if (!saver.finalize())
|
||||
return false;
|
||||
|
||||
Utils::FileName rulesPath = rulesFilePath(debianDir);
|
||||
if (!reader.fetch(rulesPath.toString()))
|
||||
return false;
|
||||
|
||||
QByteArray rulesContents = reader.data();
|
||||
const QString oldString = QLatin1String("debian/") + oldPackageName;
|
||||
const QString newString = QLatin1String("debian/") + newName;
|
||||
rulesContents.replace(oldString.toUtf8(), newString.toUtf8());
|
||||
|
||||
Core::FileChangeBlocker updateRules(rulesPath.toString());
|
||||
Utils::FileSaver rulesSaver(rulesPath.toString());
|
||||
rulesSaver.write(rulesContents);
|
||||
return rulesSaver.finalize();
|
||||
}
|
||||
|
||||
QString DebianManager::shortDescription(const Utils::FileName &debianDir)
|
||||
{
|
||||
return QString::fromUtf8(controlFileFieldValue(controlFilePath(debianDir), ShortDescriptionFieldName, false));
|
||||
}
|
||||
|
||||
bool DebianManager::setShortDescription(const Utils::FileName &debianDir, const QString &description)
|
||||
{
|
||||
return setControlFieldValue(controlFilePath(debianDir), ShortDescriptionFieldName, description.toUtf8());
|
||||
}
|
||||
|
||||
QString DebianManager::packageManagerName(const Utils::FileName &debianDir, Core::Id deviceType)
|
||||
{
|
||||
return QString::fromUtf8(controlFileFieldValue(controlFilePath(debianDir),
|
||||
packageManagerNameFieldName(deviceType), false));
|
||||
}
|
||||
|
||||
bool DebianManager::setPackageManagerName(const Utils::FileName &debianDir, Core::Id deviceType, const QString &name)
|
||||
{
|
||||
return setControlFieldValue(controlFilePath(debianDir), packageManagerNameFieldName(deviceType),
|
||||
name.toUtf8());
|
||||
}
|
||||
|
||||
QIcon DebianManager::packageManagerIcon(const Utils::FileName &debianDir, QString *error)
|
||||
{
|
||||
const QByteArray &base64Icon = controlFileFieldValue(debianDir, IconFieldName, true);
|
||||
if (base64Icon.isEmpty())
|
||||
return QIcon();
|
||||
QPixmap pixmap;
|
||||
if (!pixmap.loadFromData(QByteArray::fromBase64(base64Icon))) {
|
||||
if (error)
|
||||
*error = tr("Invalid icon data in Debian control file.");
|
||||
return QIcon();
|
||||
}
|
||||
return QIcon(pixmap);
|
||||
}
|
||||
|
||||
bool DebianManager::setPackageManagerIcon(const Utils::FileName &debianDir, Core::Id deviceType,
|
||||
const Utils::FileName &iconPath, QString *error)
|
||||
{
|
||||
const Utils::FileName filePath = controlFilePath(debianDir);
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(filePath.toString(), error))
|
||||
return false;
|
||||
const QPixmap pixmap(iconPath.toString());
|
||||
if (pixmap.isNull()) {
|
||||
if (error)
|
||||
*error = tr("Could not read image file '%1'.").arg(iconPath.toUserOutput());
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray iconAsBase64;
|
||||
QBuffer buffer(&iconAsBase64);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
if (!pixmap.scaled(MaddeDevice::packageManagerIconSize(deviceType))
|
||||
.save(&buffer, iconPath.toFileInfo().suffix().toAscii())) {
|
||||
if (error)
|
||||
*error = tr("Could not export image file '%1'.").arg(iconPath.toUserOutput());
|
||||
return false;
|
||||
}
|
||||
buffer.close();
|
||||
iconAsBase64 = iconAsBase64.toBase64();
|
||||
QByteArray contents = reader.data();
|
||||
const QByteArray iconFieldNameWithColon = IconFieldName + ':';
|
||||
const int iconFieldPos = contents.startsWith(iconFieldNameWithColon)
|
||||
? 0 : contents.indexOf('\n' + iconFieldNameWithColon);
|
||||
if (iconFieldPos == -1) {
|
||||
if (!contents.endsWith('\n'))
|
||||
contents += '\n';
|
||||
contents.append(iconFieldNameWithColon).append(' ').append(iconAsBase64)
|
||||
.append('\n');
|
||||
} else {
|
||||
const int oldIconStartPos = (iconFieldPos != 0) + iconFieldPos
|
||||
+ iconFieldNameWithColon.length();
|
||||
int nextEolPos = contents.indexOf('\n', oldIconStartPos);
|
||||
while (nextEolPos != -1 && nextEolPos != contents.length() - 1
|
||||
&& contents.at(nextEolPos + 1) != '\n'
|
||||
&& (contents.at(nextEolPos + 1) == '#'
|
||||
|| std::isspace(contents.at(nextEolPos + 1))))
|
||||
nextEolPos = contents.indexOf('\n', nextEolPos + 1);
|
||||
if (nextEolPos == -1)
|
||||
nextEolPos = contents.length();
|
||||
contents.replace(oldIconStartPos, nextEolPos - oldIconStartPos,
|
||||
' ' + iconAsBase64);
|
||||
}
|
||||
Core::FileChangeBlocker update(filePath.toString());
|
||||
Utils::FileSaver saver(filePath.toString());
|
||||
saver.write(contents);
|
||||
return saver.finalize(error);
|
||||
}
|
||||
|
||||
bool DebianManager::hasPackageManagerIcon(const Utils::FileName &debianDir)
|
||||
{
|
||||
return !packageManagerIcon(debianDir).isNull();
|
||||
}
|
||||
|
||||
Utils::FileName DebianManager::packageFileName(const Utils::FileName &debianDir)
|
||||
{
|
||||
return Utils::FileName::fromString(packageName(debianDir)
|
||||
+ QLatin1Char('_') + projectVersion(debianDir)
|
||||
+ QLatin1String("_armel.deb"));
|
||||
}
|
||||
|
||||
DebianManager::ActionStatus DebianManager::createTemplate(Qt4ProjectManager::Qt4BuildConfiguration *bc,
|
||||
const Utils::FileName &debianDir)
|
||||
{
|
||||
if (debianDir.toFileInfo().exists())
|
||||
return NoActionRequired;
|
||||
|
||||
Utils::FileName location = debianDir.parentDir();
|
||||
if (!location.toFileInfo().isDir()) {
|
||||
if (!QDir::home().mkpath(location.toString())) {
|
||||
raiseError(tr("Failed to create directory \"%1\".")
|
||||
.arg(location.toUserOutput()));
|
||||
return ActionFailed;
|
||||
}
|
||||
}
|
||||
|
||||
QProcess dh_makeProc;
|
||||
QString error;
|
||||
AbstractMaemoPackageCreationStep::preparePackagingProcess(&dh_makeProc, bc, location.toString());
|
||||
const QString packageName = defaultPackageFileName(bc->target()->project());
|
||||
|
||||
const QStringList dh_makeArgs =
|
||||
QStringList() << QLatin1String("dh_make")
|
||||
<< QLatin1String("-s") << QLatin1String("-n") << QLatin1String("-p")
|
||||
<< (packageName + QLatin1Char('_')
|
||||
+ AbstractMaemoPackageCreationStep::DefaultVersionNumber);
|
||||
|
||||
QtSupport::BaseQtVersion *lqt = QtSupport::QtProfileInformation::qtVersion(bc->target()->profile());
|
||||
if (!lqt) {
|
||||
raiseError(tr("Unable to create Debian templates: No Qt version set."));
|
||||
return ActionFailed;
|
||||
}
|
||||
|
||||
if (!MaemoGlobal::callMad(dh_makeProc, dh_makeArgs, lqt->qmakeCommand().toString(), true)
|
||||
|| !dh_makeProc.waitForStarted()) {
|
||||
raiseError(tr("Unable to create Debian templates: dh_make failed (%1).")
|
||||
.arg(dh_makeProc.errorString()));
|
||||
return ActionFailed;
|
||||
}
|
||||
|
||||
dh_makeProc.write("\n"); // Needs user input.
|
||||
dh_makeProc.waitForFinished(-1);
|
||||
if (dh_makeProc.error() != QProcess::UnknownError
|
||||
|| dh_makeProc.exitCode() != 0) {
|
||||
raiseError(tr("Unable to create debian templates: dh_make failed (%1).")
|
||||
.arg(dh_makeProc.errorString()));
|
||||
return ActionFailed;
|
||||
}
|
||||
|
||||
if (!QFile::rename(location.appendPath(QLatin1String("debian")).toString(), debianDir.toString())) {
|
||||
raiseError(tr("Unable to move new debian directory to '%1'.").arg(debianDir.toUserOutput()));
|
||||
Utils::FileUtils::removeRecursively(location.toString(), &error);
|
||||
return ActionFailed;
|
||||
}
|
||||
|
||||
QDir debian(debianDir.toString());
|
||||
const QStringList &files = debian.entryList(QDir::Files);
|
||||
foreach (const QString &fileName, files) {
|
||||
if (fileName.endsWith(QLatin1String(".ex"), Qt::CaseInsensitive)
|
||||
|| fileName.compare(QLatin1String("README.debian"), Qt::CaseInsensitive) == 0
|
||||
|| fileName.compare(QLatin1String("dirs"), Qt::CaseInsensitive) == 0
|
||||
|| fileName.compare(QLatin1String("docs"), Qt::CaseInsensitive) == 0) {
|
||||
debian.remove(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
setPackageName(debianDir, packageName);
|
||||
|
||||
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(bc->target()->profile());
|
||||
|
||||
const QByteArray sec = section(deviceType);
|
||||
const QByteArray nameField = packageManagerNameFieldName(deviceType);
|
||||
QList<QPair<QByteArray, QByteArray> > fields
|
||||
= additionalFields(deviceType, bc->target()->project()->displayName());
|
||||
|
||||
return adaptRulesFile(rulesFilePath(debianDir))
|
||||
&& adaptControlFile(controlFilePath(debianDir), bc, sec, nameField, fields)
|
||||
? ActionSuccessful : ActionFailed;
|
||||
}
|
||||
|
||||
QStringList DebianManager::debianFiles(const Utils::FileName &debianDir)
|
||||
{
|
||||
return QDir(debianDir.toString()).entryList(QDir::Files, QDir::Name | QDir::IgnoreCase);
|
||||
}
|
||||
|
||||
Utils::FileName DebianManager::debianDirectory(ProjectExplorer::Target *target)
|
||||
{
|
||||
Utils::FileName path = Utils::FileName::fromString(target->project()->projectDirectory());
|
||||
path.appendPath(PackagingDirName);
|
||||
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target->profile());
|
||||
if (deviceType == Core::Id(HarmattanOsType))
|
||||
path.appendPath(QLatin1String("debian_harmattan"));
|
||||
else if (deviceType == Core::Id(Maemo5OsType))
|
||||
path.appendPath(QLatin1String("debian_fremantle"));
|
||||
else
|
||||
path.clear();
|
||||
return path;
|
||||
}
|
||||
|
||||
void DebianManager::directoryWasChanged(const QString &path)
|
||||
{
|
||||
Utils::FileName fn = Utils::FileName::fromString(path);
|
||||
QTC_ASSERT(m_watches.contains(fn), return);
|
||||
emit debianDirectoryChanged(fn);
|
||||
}
|
||||
|
||||
void DebianManager::controlWasChanged()
|
||||
{
|
||||
WatchableFile *file = qobject_cast<WatchableFile *>(sender());
|
||||
if (!file)
|
||||
return;
|
||||
emit controlChanged(Utils::FileName::fromString(file->fileName()));
|
||||
}
|
||||
|
||||
void DebianManager::changelogWasChanged()
|
||||
{
|
||||
WatchableFile *file = qobject_cast<WatchableFile *>(sender());
|
||||
if (!file)
|
||||
return;
|
||||
emit changelogChanged(Utils::FileName::fromString(file->fileName()));
|
||||
}
|
||||
|
||||
Utils::FileName DebianManager::changelogFilePath(const Utils::FileName &debianDir)
|
||||
{
|
||||
Utils::FileName result = debianDir;
|
||||
return result.appendPath("changelog");
|
||||
}
|
||||
|
||||
Utils::FileName DebianManager::controlFilePath(const Utils::FileName &debianDir)
|
||||
{
|
||||
Utils::FileName result = debianDir;
|
||||
return result.appendPath("control");
|
||||
}
|
||||
|
||||
Utils::FileName DebianManager::rulesFilePath(const Utils::FileName &debianDir)
|
||||
{
|
||||
Utils::FileName result = debianDir;
|
||||
return result.appendPath("rules");
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Madde
|
114
src/plugins/madde/debianmanager.h
Normal file
114
src/plugins/madde/debianmanager.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef DEBIANMANAGER_H
|
||||
#define DEBIANMANAGER_H
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QHash>
|
||||
|
||||
namespace Utils { class FileSystemWatcher; }
|
||||
namespace ProjectExplorer { class Target; }
|
||||
namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
|
||||
|
||||
namespace Madde {
|
||||
namespace Internal {
|
||||
class MaddePlugin;
|
||||
|
||||
class DebianManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
~DebianManager();
|
||||
|
||||
static DebianManager *instance();
|
||||
|
||||
// ref counted:
|
||||
void monitor(const Utils::FileName &debianDir);
|
||||
bool isMonitoring(const Utils::FileName &debianDir);
|
||||
void ignore(const Utils::FileName &debianDir);
|
||||
|
||||
static QString projectVersion(const Utils::FileName &debianDir, QString *error = 0);
|
||||
static bool setProjectVersion(const Utils::FileName &debianDir, const QString &version, QString *error = 0);
|
||||
static QString packageName(const Utils::FileName &debianDir);
|
||||
static bool setPackageName(const Utils::FileName &debianDir, const QString &packageName);
|
||||
static QString shortDescription(const Utils::FileName &debianDir);
|
||||
static bool setShortDescription(const Utils::FileName &debianDir, const QString &description);
|
||||
static QString packageManagerName(const Utils::FileName &debianDir, Core::Id deviceType);
|
||||
static bool setPackageManagerName(const Utils::FileName &debianDir, Core::Id deviceType, const QString &name);
|
||||
static QIcon packageManagerIcon(const Utils::FileName &debianDir, QString *error = 0);
|
||||
static bool setPackageManagerIcon(const Utils::FileName &debianDir, Core::Id deviceType,
|
||||
const Utils::FileName &iconPath, QString *error = 0);
|
||||
static bool hasPackageManagerIcon(const Utils::FileName &debianDir);
|
||||
|
||||
static Utils::FileName packageFileName(const Utils::FileName &debianDir);
|
||||
|
||||
enum ActionStatus { NoActionRequired, ActionSuccessful, ActionFailed };
|
||||
// will not start to monitor this new dir!
|
||||
static ActionStatus createTemplate(Qt4ProjectManager::Qt4BuildConfiguration *bc,
|
||||
const Utils::FileName &debianDir);
|
||||
|
||||
static QStringList debianFiles(const Utils::FileName &debianDir);
|
||||
|
||||
static Utils::FileName debianDirectory(ProjectExplorer::Target *target);
|
||||
|
||||
signals:
|
||||
void debianDirectoryChanged(const Utils::FileName &dir);
|
||||
void changelogChanged(const Utils::FileName &dir);
|
||||
void controlChanged(const Utils::FileName &dir);
|
||||
|
||||
private slots:
|
||||
void directoryWasChanged(const QString &path);
|
||||
void controlWasChanged();
|
||||
void changelogWasChanged();
|
||||
|
||||
private:
|
||||
explicit DebianManager(QObject *parent = 0);
|
||||
|
||||
static Utils::FileName changelogFilePath(const Utils::FileName &debianDir);
|
||||
static Utils::FileName controlFilePath(const Utils::FileName &debianDir);
|
||||
static Utils::FileName rulesFilePath(const Utils::FileName &debianDir);
|
||||
|
||||
Utils::FileSystemWatcher *m_watcher;
|
||||
QHash<Utils::FileName, int> m_watches;
|
||||
static DebianManager *m_instance;
|
||||
|
||||
friend class MaddePlugin;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Madde
|
||||
|
||||
#endif // DEBIANMANAGER_H
|
@@ -8,12 +8,12 @@ include(madde_dependencies.pri)
|
||||
HEADERS += \
|
||||
madde_exports.h \
|
||||
maddeplugin.h \
|
||||
debianmanager.h \
|
||||
maemoconstants.h \
|
||||
maemorunconfigurationwidget.h \
|
||||
maemoruncontrol.h \
|
||||
maemorunfactories.h \
|
||||
maemosettingspages.h \
|
||||
maemotoolchain.h \
|
||||
maemopackagecreationstep.h \
|
||||
maemopackagecreationfactory.h \
|
||||
maemopackagecreationwidget.h \
|
||||
@@ -37,8 +37,6 @@ HEADERS += \
|
||||
maemoqemuruntimeparser.h \
|
||||
maemoqemusettingswidget.h \
|
||||
maemoqemusettings.h \
|
||||
qt4maemotargetfactory.h \
|
||||
qt4maemotarget.h \
|
||||
qt4maemodeployconfiguration.h \
|
||||
maemodeviceconfigwizard.h \
|
||||
maemodeployconfigurationwidget.h \
|
||||
@@ -53,15 +51,16 @@ HEADERS += \
|
||||
maemodeploybymountsteps.h \
|
||||
maddedevicetester.h \
|
||||
maddedeviceconfigurationfactory.h \
|
||||
maddedevice.h
|
||||
maddedevice.h \
|
||||
rpmmanager.h
|
||||
|
||||
SOURCES += \
|
||||
maddeplugin.cpp \
|
||||
debianmanager.cpp \
|
||||
maemorunconfigurationwidget.cpp \
|
||||
maemoruncontrol.cpp \
|
||||
maemorunfactories.cpp \
|
||||
maemosettingspages.cpp \
|
||||
maemotoolchain.cpp \
|
||||
maemopackagecreationstep.cpp \
|
||||
maemopackagecreationfactory.cpp \
|
||||
maemopackagecreationwidget.cpp \
|
||||
@@ -84,8 +83,6 @@ SOURCES += \
|
||||
maemoqemuruntimeparser.cpp \
|
||||
maemoqemusettingswidget.cpp \
|
||||
maemoqemusettings.cpp \
|
||||
qt4maemotargetfactory.cpp \
|
||||
qt4maemotarget.cpp \
|
||||
qt4maemodeployconfiguration.cpp \
|
||||
maemodeviceconfigwizard.cpp \
|
||||
maemodeployconfigurationwidget.cpp \
|
||||
@@ -100,7 +97,8 @@ SOURCES += \
|
||||
maemodeploybymountsteps.cpp \
|
||||
maddedevicetester.cpp \
|
||||
maemorunconfiguration.cpp \
|
||||
maddedevice.cpp
|
||||
maddedevice.cpp \
|
||||
rpmmanager.cpp
|
||||
|
||||
FORMS += \
|
||||
maemopackagecreationwidget.ui \
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user