forked from qt-creator/qt-creator
QmakeAndroid: Replace remaining AndroidQtSupport
This uses the same approach as in the previous patches: Have some generic interface in the base classes (here ProjectNode::targetData() setTargetData()) and implement on the qmake project side. Implementation for Cmake/QBS is architecture-wise possible, but not used right now, and left for later. Change-Id: I3bbf66170020cf9027a894cd66db15ec7ffbf499 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -6,7 +6,6 @@ else:ANDROID_EXPERIMENTAL_STR="false"
|
||||
QT += xml network
|
||||
|
||||
HEADERS += \
|
||||
androidqtsupport.h \
|
||||
androidconstants.h \
|
||||
androidconfigurations.h \
|
||||
androidmanager.h \
|
||||
|
||||
@@ -78,7 +78,6 @@ Project {
|
||||
"androidpotentialkit.h",
|
||||
"androidqmltoolingsupport.cpp",
|
||||
"androidqmltoolingsupport.h",
|
||||
"androidqtsupport.h",
|
||||
"androidqtversion.cpp",
|
||||
"androidqtversion.h",
|
||||
"androidqtversionfactory.cpp",
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "androidconstants.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidsdkmanager.h"
|
||||
#include "androidqtsupport.h"
|
||||
#include "certificatesmodel.h"
|
||||
|
||||
#include "javaparser.h"
|
||||
@@ -43,6 +42,8 @@
|
||||
#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>
|
||||
@@ -182,8 +183,10 @@ bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
parser->setProjectFileList(Utils::transform(target()->project()->files(ProjectExplorer::Project::AllFiles),
|
||||
&Utils::FileName::toString));
|
||||
|
||||
AndroidQtSupport *qtSupport = AndroidManager::androidQtSupport(target());
|
||||
QFileInfo sourceDirInfo(qtSupport->targetData(Constants::AndroidPackageSourceDir, target()).toString());
|
||||
RunConfiguration *rc = target()->activeRunConfiguration();
|
||||
const ProjectNode *node = rc ? target()->project()->findNodeForBuildKey(rc->buildKey()) : nullptr;
|
||||
|
||||
QFileInfo sourceDirInfo(node ? node->targetData(Constants::AndroidPackageSourceDir, target()).toString() : QString());
|
||||
parser->setSourceDirectory(Utils::FileName::fromString(sourceDirInfo.canonicalFilePath()));
|
||||
parser->setBuildDirectory(Utils::FileName::fromString(bc->buildDirectory().appendPath(Constants::ANDROID_BUILDDIRECTORY).toString()));
|
||||
setOutputParser(parser);
|
||||
@@ -204,8 +207,10 @@ bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
|
||||
QString outputDir = bc->buildDirectory().appendPath(Constants::ANDROID_BUILDDIRECTORY).toString();
|
||||
|
||||
QString inputFile = AndroidManager::androidQtSupport(target())
|
||||
->targetData(Constants::AndroidDeploySettingsFile, target()).toString();
|
||||
QString inputFile;
|
||||
if (node)
|
||||
inputFile = node->targetData(Constants::AndroidDeploySettingsFile, target()).toString();
|
||||
|
||||
if (inputFile.isEmpty()) {
|
||||
m_skipBuilding = true;
|
||||
return true;
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "androidbuildapkstep.h"
|
||||
#include "androidextralibrarylistmodel.h"
|
||||
#include "androidqtsupport.h"
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
|
||||
@@ -74,5 +74,11 @@ const char ANDROID_EXTRA_LIBS[] = "AndroidExtraLibs";
|
||||
const char ANDROID_PACKAGENAME[] = "Android.PackageName";
|
||||
const char ANDROID_PACKAGE_INSTALLATION_STEP_ID[] = "Qt4ProjectManager.AndroidPackageInstallationStep";
|
||||
|
||||
const char AndroidPackageSourceDir[] = "AndroidPackageSourceDir"; // QString
|
||||
const char AndroidDeploySettingsFile[] = "AndroidDeploySettingsFile"; // QString
|
||||
const char AndroidExtraLibs[] = "AndroidExtraLibs"; // QStringList
|
||||
const char AndroidArch[] = "AndroidArch"; // QString
|
||||
const char AndroidSoLibPath[] = "AndroidSoLibPath"; // QStringList
|
||||
|
||||
} // namespace Constants;
|
||||
} // namespace Android
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
#include "androiddebugsupport.h"
|
||||
|
||||
#include "androidconstants.h"
|
||||
#include "androidglobal.h"
|
||||
#include "androidrunner.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidqtsupport.h"
|
||||
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
@@ -44,8 +45,9 @@
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QDirIterator>
|
||||
#include <QLoggingCategory>
|
||||
#include <QHostAddress>
|
||||
#include <QJsonDocument>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
namespace {
|
||||
Q_LOGGING_CATEGORY(androidDebugSupportLog, "qtc.android.run.androiddebugsupport", QtWarningMsg)
|
||||
@@ -90,6 +92,44 @@ static QStringList uniquePaths(const QStringList &files)
|
||||
return paths.toList();
|
||||
}
|
||||
|
||||
static QStringList getSoLibSearchPath(const RunConfiguration *rc)
|
||||
{
|
||||
Target *target = rc->target();
|
||||
const ProjectNode *node = target->project()->findNodeForBuildKey(rc->buildKey());
|
||||
if (!node)
|
||||
return {};
|
||||
|
||||
QStringList res;
|
||||
node->forEachProjectNode([&res, target](const ProjectNode *node) {
|
||||
res.append(node->targetData(Constants::AndroidSoLibPath, target).toStringList());
|
||||
});
|
||||
|
||||
const QString jsonFile = node->targetData(Android::Constants::AndroidDeploySettingsFile, target).toString();
|
||||
QFile deploymentSettings(jsonFile);
|
||||
if (deploymentSettings.open(QIODevice::ReadOnly)) {
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(deploymentSettings.readAll(), &error);
|
||||
if (error.error == QJsonParseError::NoError) {
|
||||
auto rootObj = doc.object();
|
||||
auto it = rootObj.find("stdcpp-path");
|
||||
if (it != rootObj.constEnd())
|
||||
res.append(QFileInfo(it.value().toString()).absolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
res.removeDuplicates();
|
||||
return res;
|
||||
}
|
||||
|
||||
static QStringList getExtraLibs(const RunConfiguration *rc)
|
||||
{
|
||||
const ProjectNode *node = rc->target()->project()->findNodeForBuildKey(rc->buildKey());
|
||||
if (!node)
|
||||
return {};
|
||||
|
||||
return node->targetData(Android::Constants::AndroidExtraLibs, rc->target()).toStringList();
|
||||
}
|
||||
|
||||
static QString toNdkArch(const QString &arch)
|
||||
{
|
||||
if (arch == QLatin1String("armeabi-v7a") || arch == QLatin1String("armeabi"))
|
||||
@@ -131,9 +171,8 @@ void AndroidDebugSupport::start()
|
||||
|
||||
if (isCppDebugging()) {
|
||||
qCDebug(androidDebugSupportLog) << "C++ debugging enabled";
|
||||
AndroidQtSupport *qtSupport = AndroidManager::androidQtSupport(target);
|
||||
QStringList solibSearchPath = qtSupport->soLibSearchPath(target);
|
||||
QStringList extraLibs = qtSupport->targetData(Android::Constants::AndroidExtraLibs, target).toStringList();
|
||||
QStringList solibSearchPath = getSoLibSearchPath(runConfig);
|
||||
QStringList extraLibs = getExtraLibs(runConfig);
|
||||
solibSearchPath.append(qtSoPaths(qtVersion));
|
||||
solibSearchPath.append(uniquePaths(extraLibs));
|
||||
setSolibSearchPath(solibSearchPath);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "androidconstants.h"
|
||||
#include "androiddeployqtstep.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidqtsupport.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/project.h>
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "androiddeployqtstep.h"
|
||||
#include "androiddeployqtwidget.h"
|
||||
#include "androidqtsupport.h"
|
||||
#include "certificatesmodel.h"
|
||||
|
||||
#include "javaparser.h"
|
||||
@@ -43,6 +42,7 @@
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
@@ -170,8 +170,7 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
if (m_uninstallPreviousPackageRun)
|
||||
m_manifestName = AndroidManager::manifestPath(target());
|
||||
|
||||
AndroidQtSupport *qtSupport = AndroidManager::androidQtSupport(target());
|
||||
m_useAndroiddeployqt = !deployQtLive && qtSupport &&
|
||||
m_useAndroiddeployqt = !deployQtLive &&
|
||||
version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
|
||||
|
||||
if (m_useAndroiddeployqt) {
|
||||
@@ -192,11 +191,15 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, m_workingDirectory);
|
||||
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("--no-build"));
|
||||
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("--input"));
|
||||
const QString jsonFile = qtSupport->targetData(Constants::AndroidDeploySettingsFile, target()).toString();
|
||||
|
||||
QString jsonFile;
|
||||
if (const ProjectNode *node = target()->project()->findNodeForBuildKey(rc->buildKey()))
|
||||
jsonFile = node->targetData(Constants::AndroidDeploySettingsFile, target()).toString();
|
||||
if (jsonFile.isEmpty()) {
|
||||
emit addOutput(tr("Cannot find the androiddeploy Json file."), OutputFormat::Stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, jsonFile);
|
||||
if (androidBuildApkStep && androidBuildApkStep->useMinistro()) {
|
||||
qCDebug(deployStepLog) << "Using ministro";
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "androidextralibrarylistmodel.h"
|
||||
|
||||
#include <android/androidqtsupport.h>
|
||||
#include <android/androidconstants.h>
|
||||
#include <android/androidmanager.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -91,9 +91,6 @@ void AndroidExtraLibraryListModel::updateModel()
|
||||
const ProjectNode *node = m_target->project()->findNodeForBuildKey(rc->buildKey());
|
||||
QTC_ASSERT(node, return);
|
||||
|
||||
AndroidQtSupport *qtSupport = Android::AndroidManager::androidQtSupport(m_target);
|
||||
QTC_ASSERT(qtSupport, return);
|
||||
|
||||
if (node->parseInProgress()) {
|
||||
emit enabledChanged(false);
|
||||
return;
|
||||
@@ -102,7 +99,7 @@ void AndroidExtraLibraryListModel::updateModel()
|
||||
bool enabled;
|
||||
beginResetModel();
|
||||
if (node->validParse()) {
|
||||
m_entries = qtSupport->targetData(Constants::AndroidExtraLibs, m_target).toStringList();
|
||||
m_entries = node->targetData(Constants::AndroidExtraLibs, m_target).toStringList();
|
||||
enabled = true;
|
||||
} else {
|
||||
// parsing error
|
||||
@@ -116,9 +113,6 @@ void AndroidExtraLibraryListModel::updateModel()
|
||||
|
||||
void AndroidExtraLibraryListModel::addEntries(const QStringList &list)
|
||||
{
|
||||
AndroidQtSupport *qtSupport = Android::AndroidManager::androidQtSupport(m_target);
|
||||
QTC_ASSERT(qtSupport, return);
|
||||
|
||||
RunConfiguration *rc = m_target->activeRunConfiguration();
|
||||
QTC_ASSERT(rc, return);
|
||||
|
||||
@@ -131,7 +125,7 @@ void AndroidExtraLibraryListModel::addEntries(const QStringList &list)
|
||||
for (const QString &path : list)
|
||||
m_entries += "$$PWD/" + dir.relativeFilePath(path);
|
||||
|
||||
qtSupport->setTargetData(Constants::AndroidExtraLibs, m_entries, m_target);
|
||||
node->setTargetData(Constants::AndroidExtraLibs, m_entries, m_target);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
@@ -161,9 +155,11 @@ void AndroidExtraLibraryListModel::removeEntries(QModelIndexList list)
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
AndroidQtSupport *qtSupport = AndroidManager::androidQtSupport(m_target);
|
||||
QTC_ASSERT(qtSupport, return);
|
||||
qtSupport->setTargetData(Constants::AndroidExtraLibs, m_entries, m_target);
|
||||
RunConfiguration *rc = m_target->activeRunConfiguration();
|
||||
QTC_ASSERT(rc, return);
|
||||
const ProjectNode *node = m_target->project()->findNodeForBuildKey(rc->buildKey());
|
||||
QTC_ASSERT(node, return);
|
||||
node->setTargetData(Constants::AndroidExtraLibs, m_entries, m_target);
|
||||
}
|
||||
|
||||
} // Android
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "androidglobal.h"
|
||||
#include "androidtoolchain.h"
|
||||
#include "androiddeployqtstep.h"
|
||||
#include "androidqtsupport.h"
|
||||
#include "androidqtversion.h"
|
||||
#include "androidavdmanager.h"
|
||||
#include "androidsdkmanager.h"
|
||||
@@ -42,6 +41,7 @@
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -89,6 +89,7 @@ namespace {
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Android {
|
||||
@@ -111,16 +112,11 @@ static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName);
|
||||
static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
|
||||
static int parseMinSdk(const QDomElement &manifestElem);
|
||||
|
||||
static QList<AndroidQtSupport *> g_androidQtSupportProviders;
|
||||
|
||||
AndroidQtSupport::AndroidQtSupport()
|
||||
static const ProjectNode *currentProjectNode(Target *target)
|
||||
{
|
||||
g_androidQtSupportProviders.append(this);
|
||||
}
|
||||
|
||||
AndroidQtSupport::~AndroidQtSupport()
|
||||
{
|
||||
g_androidQtSupportProviders.removeOne(this);
|
||||
if (RunConfiguration *rc = target->activeRunConfiguration())
|
||||
return target->project()->findNodeForBuildKey(rc->buildKey());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString AndroidManager::packageName(ProjectExplorer::Target *target)
|
||||
@@ -306,9 +302,9 @@ Utils::FileName AndroidManager::apkPath(const ProjectExplorer::Target *target)
|
||||
|
||||
Utils::FileName AndroidManager::manifestSourcePath(ProjectExplorer::Target *target)
|
||||
{
|
||||
if (AndroidQtSupport *androidQtSupport = AndroidManager::androidQtSupport(target)) {
|
||||
if (const ProjectNode *node = currentProjectNode(target)) {
|
||||
const QString packageSource
|
||||
= androidQtSupport->targetData(Android::Constants::AndroidPackageSourceDir, target).toString();
|
||||
= node->targetData(Android::Constants::AndroidPackageSourceDir, target).toString();
|
||||
if (!packageSource.isEmpty()) {
|
||||
const FileName manifest = FileName::fromUserInput(packageSource + "/AndroidManifest.xml");
|
||||
if (manifest.exists())
|
||||
@@ -559,15 +555,6 @@ bool AndroidManager::checkCertificateExists(const QString &keystorePath,
|
||||
return response.result == Utils::SynchronousProcessResponse::Finished && response.exitCode == 0;
|
||||
}
|
||||
|
||||
AndroidQtSupport *AndroidManager::androidQtSupport(ProjectExplorer::Target *target)
|
||||
{
|
||||
for (AndroidQtSupport *provider : g_androidQtSupportProviders) {
|
||||
if (provider->canHandle(target))
|
||||
return provider;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
using GradleProperties = QMap<QByteArray, QByteArray>;
|
||||
|
||||
static GradleProperties readGradleProperties(const QString &path)
|
||||
@@ -636,11 +623,11 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
|
||||
if (!version)
|
||||
return false;
|
||||
|
||||
AndroidQtSupport *qtSupport = androidQtSupport(target);
|
||||
if (!qtSupport)
|
||||
const ProjectNode *node = currentProjectNode(target);
|
||||
if (!node)
|
||||
return false;
|
||||
|
||||
QFileInfo sourceDirInfo(qtSupport->targetData(Constants::AndroidPackageSourceDir, target).toString());
|
||||
QFileInfo sourceDirInfo(node->targetData(Constants::AndroidPackageSourceDir, target).toString());
|
||||
FileName packageSourceDir = FileName::fromString(sourceDirInfo.canonicalFilePath());
|
||||
if (!packageSourceDir.appendPath("gradlew").exists())
|
||||
return false;
|
||||
|
||||
@@ -44,8 +44,6 @@ namespace Utils { class FileName; }
|
||||
|
||||
namespace Android {
|
||||
|
||||
class AndroidQtSupport;
|
||||
|
||||
class SdkToolResult {
|
||||
public:
|
||||
SdkToolResult() = default;
|
||||
@@ -110,7 +108,6 @@ public:
|
||||
static bool checkCertificatePassword(const QString &keystorePath, const QString &keystorePasswd, const QString &alias, const QString &certificatePasswd);
|
||||
static bool checkCertificateExists(const QString &keystorePath, const QString &keystorePasswd,
|
||||
const QString &alias);
|
||||
static AndroidQtSupport *androidQtSupport(ProjectExplorer::Target *target);
|
||||
static bool updateGradleProperties(ProjectExplorer::Target *target);
|
||||
static int findApiLevel(const Utils::FileName &platformPath);
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "androidconstants.h"
|
||||
#include "androidmanifestdocument.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidqtsupport.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/infobar.h>
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "android_global.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace ProjectExplorer { class Target; }
|
||||
|
||||
namespace Utils { class FileName; }
|
||||
|
||||
namespace Android {
|
||||
namespace Constants {
|
||||
|
||||
const char AndroidPackageSourceDir[] = "AndroidPackageSourceDir"; // QString
|
||||
const char AndroidDeploySettingsFile[] = "AndroidDeploySettingsFile"; // QString
|
||||
const char AndroidExtraLibs[] = "AndroidExtraLibs"; // QStringList
|
||||
const char AndroidArch[] = "AndroidArch"; // QString
|
||||
|
||||
} // namespace Constants
|
||||
|
||||
class ANDROID_EXPORT AndroidQtSupport : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
AndroidQtSupport();
|
||||
~AndroidQtSupport() override;
|
||||
|
||||
public:
|
||||
enum BuildType {
|
||||
DebugBuild,
|
||||
ReleaseBuildUnsigned,
|
||||
ReleaseBuildSigned
|
||||
};
|
||||
|
||||
virtual bool canHandle(const ProjectExplorer::Target *target) const = 0;
|
||||
virtual QStringList soLibSearchPath(const ProjectExplorer::Target *target) const = 0;
|
||||
|
||||
virtual QVariant targetData(Core::Id role, const ProjectExplorer::Target *target) const = 0;
|
||||
virtual bool setTargetData(Core::Id role, const QVariant &value,
|
||||
const ProjectExplorer::Target *target) const = 0;
|
||||
|
||||
virtual void addFiles(const ProjectExplorer::Target *target, const QString &buildKey,
|
||||
const QStringList &addedFiles) const = 0;
|
||||
};
|
||||
|
||||
} // namespace Android
|
||||
@@ -26,11 +26,13 @@
|
||||
#include "createandroidmanifestwizard.h"
|
||||
|
||||
#include <android/androidconfigurations.h>
|
||||
#include <android/androidconstants.h>
|
||||
#include <android/androidmanager.h>
|
||||
#include <android/androidqtsupport.h>
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
@@ -177,13 +179,14 @@ bool ChooseDirectoryPage::isComplete() const
|
||||
|
||||
void ChooseDirectoryPage::initializePage()
|
||||
{
|
||||
const Target *target = m_wizard->target();
|
||||
const QString buildKey = m_wizard->buildKey();
|
||||
const BuildTargetInfo bti = m_wizard->target()->applicationTargets().buildTargetInfo(buildKey);
|
||||
const BuildTargetInfo bti = target->applicationTargets().buildTargetInfo(buildKey);
|
||||
const QString projectDir = bti.projectFilePath.toFileInfo().absolutePath();
|
||||
|
||||
AndroidQtSupport *qtSupport = AndroidManager::androidQtSupport(m_wizard->target());
|
||||
const QString androidPackageDir
|
||||
= qtSupport->targetData(Android::Constants::AndroidPackageSourceDir, m_wizard->target()).toString();
|
||||
QString androidPackageDir;
|
||||
if (const ProjectNode *node = target->project()->findNodeForBuildKey(buildKey))
|
||||
androidPackageDir = node->targetData(Android::Constants::AndroidPackageSourceDir, target).toString();
|
||||
|
||||
if (androidPackageDir.isEmpty()) {
|
||||
m_label->setText(tr("Select the Android package source directory.\n\n"
|
||||
@@ -344,17 +347,19 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
||||
AndroidManager::updateGradleProperties(m_target);
|
||||
}
|
||||
|
||||
AndroidQtSupport *qtSupport = AndroidManager::androidQtSupport(m_target);
|
||||
qtSupport->addFiles(m_target, m_buildKey, addedFiles);
|
||||
|
||||
const QString androidPackageDir
|
||||
= qtSupport->targetData(Android::Constants::AndroidPackageSourceDir, m_target).toString();
|
||||
QString androidPackageDir;
|
||||
ProjectNode *node = m_target->project()->findNodeForBuildKey(m_buildKey);
|
||||
if (node) {
|
||||
node->addFiles(addedFiles);
|
||||
androidPackageDir = node->targetData(Android::Constants::AndroidPackageSourceDir, m_target).toString();
|
||||
}
|
||||
|
||||
if (androidPackageDir.isEmpty()) {
|
||||
// and now time for some magic
|
||||
const BuildTargetInfo bti = m_target->applicationTargets().buildTargetInfo(m_buildKey);
|
||||
const QString value = "$$PWD/" + bti.projectFilePath.toFileInfo().absoluteDir().relativeFilePath(m_directory);
|
||||
bool result = qtSupport->setTargetData(Android::Constants::AndroidPackageSourceDir, value, m_target);
|
||||
bool result = node->setTargetData(Android::Constants::AndroidPackageSourceDir, value, m_target);
|
||||
|
||||
if (!result) {
|
||||
QMessageBox::warning(this, tr("Project File not Updated"),
|
||||
|
||||
Reference in New Issue
Block a user