Commit 4c16632f authored by BogDan Vatra's avatar BogDan Vatra

Android: Add clean step only if the minSDK is changed

Task-number: QTCREATORBUG-15533
Change-Id: If78b5c7f379e590ec7c0bbeb53dd9b45343f64b8
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
parent e22f8e37
......@@ -34,7 +34,10 @@
#include <android/androidmanager.h>
#include <android/androidconfigurations.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qmakeprojectmanager/qmakebuildinfo.h>
......@@ -110,6 +113,27 @@ AndroidQmakeBuildConfiguration::AndroidQmakeBuildConfiguration(ProjectExplorer::
void AndroidQmakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const
{
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
Android::AndroidConfigurations::currentConfig().bestNdkPlatformMatch(Android::AndroidManager::minimumSDK(target())));
m_androidNdkPlatform = Android::AndroidConfigurations::currentConfig().bestNdkPlatformMatch(Android::AndroidManager::minimumSDK(target()));
env.set(QLatin1String("ANDROID_NDK_PLATFORM"), m_androidNdkPlatform);
}
void AndroidQmakeBuildConfiguration::manifestSaved()
{
using QmakeProjectManager::QMakeStep;
QString androidNdkPlatform = Android::AndroidConfigurations::currentConfig().bestNdkPlatformMatch(Android::AndroidManager::minimumSDK(target()));
if (m_androidNdkPlatform == androidNdkPlatform)
return;
emitEnvironmentChanged();
QMakeStep *qs = qmakeStep();
if (!qs)
return;
qs->setForced(true);
ProjectExplorer::BuildManager::buildList(stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN),
ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
ProjectExplorer::BuildManager::appendStep(qs, ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
setSubNodeBuild(0);
}
......@@ -61,8 +61,11 @@ public:
AndroidQmakeBuildConfiguration(ProjectExplorer::Target *target, AndroidQmakeBuildConfiguration *source);
AndroidQmakeBuildConfiguration(ProjectExplorer::Target *target, Core::Id id);
void addToEnvironment(Utils::Environment &env) const;
void manifestSaved();
using BuildConfiguration::emitEnvironmentChanged;
private:
mutable QString m_androidNdkPlatform;
};
} // namespace Internal
......
......@@ -36,17 +36,9 @@
#include <android/androidconstants.h>
#include <android/androidglobal.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtkitinformation.h>
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
#include <qmakeprojectmanager/qmakenodes.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakestep.h>
using namespace QmakeProjectManager;
......@@ -136,20 +128,8 @@ Utils::FileName QmakeAndroidSupport::androiddeployJsonPath(ProjectExplorer::Targ
void QmakeAndroidSupport::manifestSaved(const ProjectExplorer::Target *target)
{
ProjectExplorer::BuildConfiguration *bc = target->activeBuildConfiguration();
if (auto qbc = qobject_cast<AndroidQmakeBuildConfiguration *>(bc)) {
qbc->emitEnvironmentChanged();
QMakeStep *qs = qbc->qmakeStep();
if (!qs)
return;
qs->setForced(true);
ProjectExplorer::BuildManager::buildList(bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN),
ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
ProjectExplorer::BuildManager::appendStep(qs, ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
qbc->setSubNodeBuild(0);
}
if (auto qbc = qobject_cast<AndroidQmakeBuildConfiguration *>(bc))
qbc->manifestSaved();
}
Utils::FileName QmakeAndroidSupport::manifestSourcePath(const ProjectExplorer::Target *target)
......
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