forked from qt-creator/qt-creator
Android: Use less direct access to the qmake build step
Instead of qobject_cast use the reacently introduced virtual function BuildConfiguration::regenerateBuildFiles() to trigger the necessary work in the qmake case. Change-Id: Ie5fd36550b5bad8c5f3f8bb1e2a3a16843f8f5b7 Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "androidmanifesteditorwidget.h"
|
||||
#include "androidmanifesteditor.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androidmanifestdocument.h"
|
||||
#include "androidmanager.h"
|
||||
@@ -34,6 +35,7 @@
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectwindow.h>
|
||||
#include <projectexplorer/session.h>
|
||||
@@ -605,9 +607,15 @@ void AndroidManifestEditorWidget::postSave()
|
||||
ProjectExplorer::Project *project = androidProject(docPath);
|
||||
if (project) {
|
||||
if (Target *target = project->activeTarget()) {
|
||||
AndroidQtSupport *androidQtSupport = AndroidManager::androidQtSupport(target);
|
||||
if (androidQtSupport)
|
||||
androidQtSupport->manifestSaved(target);
|
||||
if (BuildConfiguration *bc = target->activeBuildConfiguration()) {
|
||||
QString androidNdkPlatform = AndroidConfigurations::currentConfig()
|
||||
.bestNdkPlatformMatch(AndroidManager::minimumSDK(target));
|
||||
if (m_androidNdkPlatform != androidNdkPlatform) {
|
||||
m_androidNdkPlatform = androidNdkPlatform;
|
||||
bc->updateCacheAndEmitEnvironmentChanged();
|
||||
bc->regenerateBuildFiles(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -191,6 +191,7 @@ private:
|
||||
QTimer m_timerParseCheck;
|
||||
TextEditor::TextEditorWidget *m_textEditorWidget;
|
||||
AndroidManifestEditor *m_editor;
|
||||
QString m_androidNdkPlatform;
|
||||
};
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
@@ -70,7 +70,6 @@ public:
|
||||
virtual QStringList soLibSearchPath(const ProjectExplorer::Target *target) const = 0;
|
||||
virtual QStringList projectTargetApplications(const ProjectExplorer::Target *target) const = 0;
|
||||
virtual Utils::FileName apkPath(const ProjectExplorer::Target *target) const;
|
||||
virtual void manifestSaved(const ProjectExplorer::Target *target) = 0;
|
||||
|
||||
virtual QString targetDataItem(Core::Id role, const ProjectExplorer::Target *target) const = 0;
|
||||
virtual QStringList targetData(Core::Id role, const ProjectExplorer::Target *target) const = 0;
|
||||
|
@@ -96,6 +96,7 @@ public:
|
||||
|
||||
void prependCompilerPathToEnvironment(Utils::Environment &env) const;
|
||||
static void prependCompilerPathToEnvironment(Kit *k, Utils::Environment &env);
|
||||
void updateCacheAndEmitEnvironmentChanged();
|
||||
|
||||
signals:
|
||||
void environmentChanged();
|
||||
@@ -105,7 +106,6 @@ signals:
|
||||
|
||||
protected:
|
||||
virtual void initialize(const BuildInfo *info);
|
||||
void updateCacheAndEmitEnvironmentChanged();
|
||||
|
||||
private:
|
||||
void emitBuildDirectoryChanged();
|
||||
|
@@ -32,11 +32,10 @@
|
||||
#include <android/androidpackageinstallationstep.h>
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qmakeprojectmanager/qmakebuildinfo.h>
|
||||
#include <qmakeprojectmanager/qmakeproject.h>
|
||||
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||
|
||||
using namespace Android;
|
||||
@@ -77,20 +76,9 @@ void AndroidQmakeBuildConfiguration::initialize(const BuildInfo *info)
|
||||
}
|
||||
|
||||
void AndroidQmakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const
|
||||
{
|
||||
m_androidNdkPlatform = AndroidConfigurations::currentConfig().bestNdkPlatformMatch(AndroidManager::minimumSDK(target()));
|
||||
env.set(QLatin1String("ANDROID_NDK_PLATFORM"), m_androidNdkPlatform);
|
||||
}
|
||||
|
||||
void AndroidQmakeBuildConfiguration::manifestSaved()
|
||||
{
|
||||
QString androidNdkPlatform = AndroidConfigurations::currentConfig().bestNdkPlatformMatch(AndroidManager::minimumSDK(target()));
|
||||
if (m_androidNdkPlatform == androidNdkPlatform)
|
||||
return;
|
||||
|
||||
updateCacheAndEmitEnvironmentChanged();
|
||||
|
||||
regenerateBuildFiles();
|
||||
env.set(QLatin1String("ANDROID_NDK_PLATFORM"), androidNdkPlatform);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -45,10 +45,6 @@ public:
|
||||
|
||||
void initialize(const ProjectExplorer::BuildInfo *info) override;
|
||||
void addToEnvironment(Utils::Environment &env) const override;
|
||||
void manifestSaved();
|
||||
|
||||
private:
|
||||
mutable QString m_androidNdkPlatform;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -198,13 +198,6 @@ QStringList QmakeAndroidSupport::projectTargetApplications(const ProjectExplorer
|
||||
return apps;
|
||||
}
|
||||
|
||||
void QmakeAndroidSupport::manifestSaved(const ProjectExplorer::Target *target)
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = target->activeBuildConfiguration();
|
||||
if (auto qbc = qobject_cast<AndroidQmakeBuildConfiguration *>(bc))
|
||||
qbc->manifestSaved();
|
||||
}
|
||||
|
||||
void QmakeAndroidSupport::addFiles(const ProjectExplorer::Target *target,
|
||||
const QString &buildKey,
|
||||
const QStringList &addedFiles) const
|
||||
|
@@ -38,7 +38,6 @@ public:
|
||||
bool canHandle(const ProjectExplorer::Target *target) const override;
|
||||
QStringList soLibSearchPath(const ProjectExplorer::Target *target) const override;
|
||||
QStringList projectTargetApplications(const ProjectExplorer::Target *target) const override;
|
||||
void manifestSaved(const ProjectExplorer::Target *target) override;
|
||||
|
||||
QString targetDataItem(Core::Id role, const ProjectExplorer::Target *target) const override;
|
||||
QStringList targetData(Core::Id role, const ProjectExplorer::Target *target) const override;
|
||||
|
Reference in New Issue
Block a user