forked from qt-creator/qt-creator
Android: Use the new Target::activeBuildKey() function
Change-Id: I051874a2b44129740b2ecc19f7ff401663d8bf0a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -40,11 +40,11 @@
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
@@ -181,9 +181,8 @@ bool AndroidBuildApkStep::init()
|
||||
parser->setProjectFileList(Utils::transform(target()->project()->files(ProjectExplorer::Project::AllFiles),
|
||||
&Utils::FilePath::toString));
|
||||
|
||||
RunConfiguration *rc = target()->activeRunConfiguration();
|
||||
const QString buildKey = rc ? rc->buildKey() : QString();
|
||||
const ProjectNode *node = rc ? target()->project()->findNodeForBuildKey(buildKey) : nullptr;
|
||||
const QString buildKey = target()->activeBuildKey();
|
||||
const ProjectNode *node = target()->project()->findNodeForBuildKey(buildKey);
|
||||
|
||||
QString sourceDirName;
|
||||
if (node)
|
||||
@@ -222,7 +221,7 @@ bool AndroidBuildApkStep::init()
|
||||
m_inputFile = node->data(Constants::AndroidDeploySettingsFile).toString();
|
||||
|
||||
if (m_inputFile.isEmpty()) {
|
||||
qCDebug(buildapkstepLog) << "no input file" << rc << node << buildKey;
|
||||
qCDebug(buildapkstepLog) << "no input file" << node << buildKey;
|
||||
m_skipBuilding = true;
|
||||
return true;
|
||||
}
|
||||
@@ -384,9 +383,8 @@ void AndroidBuildApkStep::doRun()
|
||||
return false;
|
||||
}
|
||||
|
||||
RunConfiguration *rc = target()->activeRunConfiguration();
|
||||
const QString buildKey = rc ? rc->buildKey() : QString();
|
||||
const ProjectNode *node = rc ? target()->project()->findNodeForBuildKey(buildKey) : nullptr;
|
||||
const QString buildKey = target()->activeBuildKey();
|
||||
const ProjectNode *node = target()->project()->findNodeForBuildKey(buildKey);
|
||||
|
||||
if (!node)
|
||||
return false;
|
||||
@@ -408,7 +406,7 @@ void AndroidBuildApkStep::doRun()
|
||||
QString applicationBinary;
|
||||
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 14, 0)) {
|
||||
QTC_ASSERT(androidAbis.size() == 1, return false);
|
||||
applicationBinary = target()->activeRunConfiguration()->buildTargetInfo().targetFilePath.toString();
|
||||
applicationBinary = buildSystem()->buildTarget(buildKey).targetFilePath.toString();
|
||||
Utils::FilePath androidLibsDir = buildDirectory().pathAppended("android-build/libs").pathAppended(androidAbis.first());
|
||||
for (const auto &target : targets) {
|
||||
if (!copyFileIfNewer(target, androidLibsDir.pathAppended(QFileInfo{target}.fileName()).toString()))
|
||||
@@ -416,7 +414,7 @@ void AndroidBuildApkStep::doRun()
|
||||
}
|
||||
deploySettings["target-architecture"] = androidAbis.first();
|
||||
} else {
|
||||
applicationBinary = target()->activeRunConfiguration()->buildTargetInfo().targetFilePath.toFileInfo().fileName();
|
||||
applicationBinary = buildSystem()->buildTarget(buildKey).targetFilePath.toFileInfo().fileName();
|
||||
QJsonObject architectures;
|
||||
|
||||
// Copy targets to android build folder
|
||||
|
@@ -38,7 +38,6 @@
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
@@ -329,8 +328,8 @@ QWidget *AndroidBuildApkWidget::createAdditionalLibrariesGroup()
|
||||
});
|
||||
|
||||
Target *target = m_step->target();
|
||||
RunConfiguration *rc = target->activeRunConfiguration();
|
||||
const ProjectNode *node = rc ? target->project()->findNodeForBuildKey(rc->buildKey()) : nullptr;
|
||||
const QString buildKey = target->activeBuildKey();
|
||||
const ProjectNode *node = target->project()->findNodeForBuildKey(buildKey);
|
||||
group->setEnabled(node && !node->parseInProgress());
|
||||
|
||||
return group;
|
||||
|
@@ -222,7 +222,8 @@ bool AndroidDeployQtStep::init()
|
||||
m_useAndroiddeployqt = version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
|
||||
|
||||
if (m_useAndroiddeployqt) {
|
||||
const ProjectNode *node = target()->project()->findNodeForBuildKey(rc->buildKey());
|
||||
const QString buildKey = target()->activeBuildKey();
|
||||
const ProjectNode *node = target()->project()->findNodeForBuildKey(buildKey);
|
||||
if (!node)
|
||||
return false;
|
||||
m_apkPath = Utils::FilePath::fromString(node->data(Constants::AndroidApk).toString());
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Android {
|
||||
@@ -49,6 +51,7 @@ AndroidExtraLibraryListModel::AndroidExtraLibraryListModel(ProjectExplorer::Targ
|
||||
this, &AndroidExtraLibraryListModel::updateModel);
|
||||
connect(target, &Target::parsingFinished,
|
||||
this, &AndroidExtraLibraryListModel::updateModel);
|
||||
// Causes target()->activeBuildKey() result to change.
|
||||
connect(target, &Target::activeRunConfigurationChanged,
|
||||
this, &AndroidExtraLibraryListModel::updateModel);
|
||||
}
|
||||
@@ -83,10 +86,8 @@ QVariant AndroidExtraLibraryListModel::data(const QModelIndex &index, int role)
|
||||
|
||||
void AndroidExtraLibraryListModel::updateModel()
|
||||
{
|
||||
RunConfiguration *rc = m_target->activeRunConfiguration();
|
||||
QTC_ASSERT(rc, return);
|
||||
|
||||
const ProjectNode *node = m_target->project()->findNodeForBuildKey(rc->buildKey());
|
||||
const QString buildKey = m_target->activeBuildKey();
|
||||
const ProjectNode *node = m_target->project()->findNodeForBuildKey(buildKey);
|
||||
QTC_ASSERT(node, return);
|
||||
|
||||
if (node->parseInProgress()) {
|
||||
@@ -111,10 +112,8 @@ void AndroidExtraLibraryListModel::updateModel()
|
||||
|
||||
void AndroidExtraLibraryListModel::addEntries(const QStringList &list)
|
||||
{
|
||||
RunConfiguration *rc = m_target->activeRunConfiguration();
|
||||
QTC_ASSERT(rc, return);
|
||||
|
||||
const ProjectNode *node = m_target->project()->findNodeForBuildKey(rc->buildKey());
|
||||
const QString buildKey = m_target->activeBuildKey();
|
||||
const ProjectNode *node = m_target->project()->findNodeForBuildKey(buildKey);
|
||||
QTC_ASSERT(node, return);
|
||||
|
||||
beginInsertRows(QModelIndex(), m_entries.size(), m_entries.size() + list.size());
|
||||
@@ -153,9 +152,8 @@ void AndroidExtraLibraryListModel::removeEntries(QModelIndexList list)
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
RunConfiguration *rc = m_target->activeRunConfiguration();
|
||||
QTC_ASSERT(rc, return);
|
||||
const ProjectNode *node = m_target->project()->findNodeForBuildKey(rc->buildKey());
|
||||
const QString buildKey = m_target->activeBuildKey();
|
||||
const ProjectNode *node = m_target->project()->findNodeForBuildKey(buildKey);
|
||||
QTC_ASSERT(node, return);
|
||||
node->setData(Constants::AndroidExtraLibs, m_entries);
|
||||
}
|
||||
|
@@ -108,15 +108,13 @@ ChooseProFilePage::ChooseProFilePage(CreateAndroidManifestWizard *wizard)
|
||||
fl->addRow(label);
|
||||
|
||||
BuildSystem *buildSystem = wizard->buildSystem();
|
||||
QString currentBuildTarget;
|
||||
if (RunConfiguration *rc = buildSystem->target()->activeRunConfiguration())
|
||||
currentBuildTarget = rc->buildKey();
|
||||
QString currentBuildKey = buildSystem->target()->activeBuildKey();
|
||||
|
||||
m_comboBox = new QComboBox(this);
|
||||
for (const BuildTargetInfo &bti : buildSystem->applicationTargets()) {
|
||||
const QString displayName = bti.buildKey;
|
||||
m_comboBox->addItem(displayName, QVariant(bti.buildKey)); // TODO something more?
|
||||
if (bti.buildKey == currentBuildTarget)
|
||||
if (bti.buildKey == currentBuildKey)
|
||||
m_comboBox->setCurrentIndex(m_comboBox->count() - 1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user