Commit 0a600e04 authored by Daniel Teske's avatar Daniel Teske

Android: Rework AndroidPacakgeInstallationStep

It derived from MakeStep which is a rather odd base class for it, make
it derive from AbstractProcessStep instead. Also implement a config
widget for it. That one does nothing, but the old one didn't do
anything interesting either.

Change-Id: I76c2311580dbb62d08524fe0f77e803fd52ffbf4
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: default avatarBogDan Vatra <bogdan@kde.org>
parent 4f82c36a
......@@ -33,7 +33,11 @@
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/gnumakeparser.h>
#include <utils/hostosinfo.h>
#include <qt4projectmanager/qmakeparser.h>
#include <QDir>
......@@ -45,7 +49,7 @@ const char ANDROIDDIRECTORY[] = "Android.AndroidPackageInstallationStep.AndroidD
}
AndroidPackageInstallationStep::AndroidPackageInstallationStep(AndroidDirectory mode,ProjectExplorer::BuildStepList *bsl)
: MakeStep(bsl, Id), m_androidDirectory(mode)
: AbstractProcessStep(bsl, Id), m_androidDirectory(mode)
{
const QString name = tr("Copy application data");
setDefaultDisplayName(name);
......@@ -53,7 +57,7 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(AndroidDirectory
}
AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bc, AndroidPackageInstallationStep *other)
: MakeStep(bc, other)
: AbstractProcessStep(bc, other)
{ }
bool AndroidPackageInstallationStep::init()
......@@ -69,14 +73,33 @@ bool AndroidPackageInstallationStep::init()
if (Utils::HostOsInfo::isWindowsHost())
if (bc->environment().searchInPath(QLatin1String("sh.exe")).isEmpty())
dirPath = QDir::toNativeSeparators(dirPath);
setUserArguments(QString::fromLatin1("INSTALL_ROOT=\"%1\" install").arg(dirPath));
return MakeStep::init();
ProjectExplorer::ToolChain *tc
= ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
ProjectExplorer::ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
pp->setCommand(tc->makeCommand(bc->environment()));
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setArguments(QString::fromLatin1("INSTALL_ROOT=\"%1\" install").arg(dirPath));
pp->resolveAll();
setOutputParser(new ProjectExplorer::GnuMakeParser());
ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser();
if (parser)
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
}
bool AndroidPackageInstallationStep::fromMap(const QVariantMap &map)
{
if (!MakeStep::fromMap(map))
if (!AbstractProcessStep::fromMap(map))
return false;
m_androidDirectory = AndroidDirectory(map.value(QLatin1String(ANDROIDDIRECTORY)).toInt());
return true;
......@@ -84,7 +107,43 @@ bool AndroidPackageInstallationStep::fromMap(const QVariantMap &map)
QVariantMap AndroidPackageInstallationStep::toMap() const
{
QVariantMap map = MakeStep::toMap();
QVariantMap map = AbstractProcessStep::toMap();
map.insert(QLatin1String(ANDROIDDIRECTORY), m_androidDirectory);
return map;
}
ProjectExplorer::BuildStepConfigWidget *AndroidPackageInstallationStep::createConfigWidget()
{
return new AndroidPackageInstallationStepWidget(this);
}
bool AndroidPackageInstallationStep::immutable() const
{
return true;
}
//
// AndroidPackageInstallationStepWidget
//
AndroidPackageInstallationStepWidget::AndroidPackageInstallationStepWidget(AndroidPackageInstallationStep *step)
: m_step(step)
{
}
QString AndroidPackageInstallationStepWidget::summaryText() const
{
return tr("<b>Make install</b>");
}
QString AndroidPackageInstallationStepWidget::displayName() const
{
return tr("Make install");
}
bool AndroidPackageInstallationStepWidget::showWidget() const
{
return false;
}
......@@ -30,12 +30,13 @@
#ifndef ANDROIDPACKAGEINSTALLATIONSTEP_H
#define ANDROIDPACKAGEINSTALLATIONSTEP_H
#include <qt4projectmanager/makestep.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/abstractprocessstep.h>
namespace Android {
namespace Internal {
class AndroidPackageInstallationStep : public Qt4ProjectManager::MakeStep
class AndroidPackageInstallationStep : public ProjectExplorer::AbstractProcessStep
{
Q_OBJECT
friend class AndroidPackageInstallationFactory;
......@@ -48,6 +49,9 @@ public:
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
bool immutable() const;
private:
AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bc,
AndroidPackageInstallationStep *other);
......@@ -55,6 +59,18 @@ private:
static const Core::Id Id;
};
class AndroidPackageInstallationStepWidget : public ProjectExplorer::BuildStepConfigWidget
{
public:
AndroidPackageInstallationStepWidget(AndroidPackageInstallationStep *step);
QString summaryText() const;
QString displayName() const;
bool showWidget() const;
private:
AndroidPackageInstallationStep *m_step;
};
} // namespace Internal
} // namespace Android
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment