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