Android: Move logic to trigger AndroidManager::updateGradleProperties

Previously, AndroidManager::updateGradleProperties operated always
on a project node found using target->activeRunConfiguration()
which might or might not be the one that will actually be used
after the build.

This here still does not address the problem that the activeRunConfiguration
may change but introduces a way to specify the relevant node, and tries
to use the right one when available.

At some time, this could be developed into a real solution, e.g.
by invalidating the cache on build key changes.

Change-Id: I37a3d73e9ad3615025e4def2493f683d11add3c6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
hjk
2019-08-01 10:12:34 +02:00
parent e90081cd88
commit fc2e22dad2
7 changed files with 15 additions and 33 deletions

View File

@@ -683,13 +683,22 @@ static bool mergeGradleProperties(const QString &path, GradleProperties properti
}
bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target, const QString &buildKey)
{
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target->kit());
if (!version)
return false;
const ProjectNode *node = currentProjectNode(target);
QString key = buildKey;
if (key.isEmpty()) {
// FIXME: This case is triggered from AndroidBuildApkWidget::createApplicationGroup
// and should be avoided.
if (RunConfiguration *rc = target->activeRunConfiguration())
key = rc->buildKey();
}
QTC_ASSERT(!key.isEmpty(), return false);
const ProjectNode *node = target->project()->findNodeForBuildKey(key);
if (!node)
return false;