Android: Handle library building in a more user friendly way

Task-number: QTCREATORBUG-13566
Change-Id: I47bf76d1f559bf1addae0e3d577e0207b4de4150
Reviewed-by: BogDan Vatra <bogdan@kde.org>
This commit is contained in:
Daniel Teske
2014-12-05 16:45:11 +01:00
parent 6339ddfc43
commit 21a5766cee
2 changed files with 18 additions and 0 deletions

View File

@@ -205,6 +205,10 @@ bool QmakeAndroidBuildApkStep::init()
QString outputDir = bc->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY)).toString(); QString outputDir = bc->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY)).toString();
const auto *pro = static_cast<QmakeProjectManager::QmakeProject *>(project()); const auto *pro = static_cast<QmakeProjectManager::QmakeProject *>(project());
m_skipBuilding = m_proFilePathForInputFile.isEmpty();
if (m_skipBuilding)
return true;
const QmakeProjectManager::QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile); const QmakeProjectManager::QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile);
if (!node) { // should never happen if (!node) { // should never happen
emit addOutput(tr("Internal Error: Could not find .pro file."), BuildStep::ErrorMessageOutput); emit addOutput(tr("Internal Error: Could not find .pro file."), BuildStep::ErrorMessageOutput);
@@ -270,6 +274,17 @@ bool QmakeAndroidBuildApkStep::init()
return true; return true;
} }
void QmakeAndroidBuildApkStep::run(QFutureInterface<bool> &fi)
{
if (m_skipBuilding) {
emit addOutput(tr("No application .pro file found, not building an APK."), BuildStep::ErrorMessageOutput);
fi.reportResult(true);
emit finished();
return;
}
AndroidBuildApkStep::run(fi);
}
void QmakeAndroidBuildApkStep::setupProcessParameters(ProjectExplorer::ProcessParameters *pp, void QmakeAndroidBuildApkStep::setupProcessParameters(ProjectExplorer::ProcessParameters *pp,
ProjectExplorer::BuildConfiguration *bc, ProjectExplorer::BuildConfiguration *bc,
const QStringList &arguments, const QStringList &arguments,

View File

@@ -69,6 +69,7 @@ public:
QString proFilePathForInputFile() const; QString proFilePathForInputFile() const;
void setProFilePathForInputFile(const QString &path); void setProFilePathForInputFile(const QString &path);
protected: protected:
friend class QmakeAndroidBuildApkStepFactory; friend class QmakeAndroidBuildApkStepFactory;
QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc,
@@ -79,6 +80,7 @@ protected:
protected: protected:
void ctor(); void ctor();
bool init(); bool init();
void run(QFutureInterface<bool> &fi);
void processStarted(); void processStarted();
ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
bool fromMap(const QVariantMap &map); bool fromMap(const QVariantMap &map);
@@ -98,6 +100,7 @@ private:
QString m_proFilePathForInputFile; QString m_proFilePathForInputFile;
QString m_command; QString m_command;
QString m_argumentsPasswordConcealed; QString m_argumentsPasswordConcealed;
bool m_skipBuilding;
}; };
} // namespace Internal } // namespace Internal