forked from qt-creator/qt-creator
Android: Use device types as restrictions on project configurations
Change-Id: I3f7ff05f27c76dadec9a9ff0ae02848830655472 Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
@@ -77,11 +77,5 @@ QList<QString> AndroidDeployConfigurationFactory::availableBuildTargets(Target *
|
||||
return {QString()};
|
||||
}
|
||||
|
||||
bool AndroidDeployConfigurationFactory::canHandle(Target *parent) const
|
||||
{
|
||||
return DeployConfigurationFactory::canHandle(parent)
|
||||
&& AndroidManager::supportsAndroid(parent->kit());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
@@ -46,7 +46,6 @@ class AndroidDeployConfigurationFactory : public ProjectExplorer::DeployConfigur
|
||||
public:
|
||||
AndroidDeployConfigurationFactory();
|
||||
|
||||
bool canHandle(ProjectExplorer::Target *target) const override;
|
||||
QList<QString> availableBuildTargets(ProjectExplorer::Target *parent) const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -75,17 +75,11 @@ AndroidDeployQtStepFactory::AndroidDeployQtStepFactory()
|
||||
{
|
||||
registerStep<AndroidDeployQtStep>(AndroidDeployQtStep::Id);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
|
||||
setRepeatable(false);
|
||||
setDisplayName(tr("Deploy to Android device or emulator"));
|
||||
}
|
||||
|
||||
bool AndroidDeployQtStepFactory::canHandle(BuildStepList *parent) const
|
||||
{
|
||||
return BuildStepFactory::canHandle(parent)
|
||||
&& AndroidManager::supportsAndroid(parent->target());
|
||||
}
|
||||
|
||||
|
||||
// AndroidDeployQtStep
|
||||
|
||||
AndroidDeployQtStep::AndroidDeployQtStep(ProjectExplorer::BuildStepList *parent)
|
||||
|
||||
@@ -46,7 +46,6 @@ class AndroidDeployQtStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
Q_OBJECT
|
||||
public:
|
||||
AndroidDeployQtStepFactory();
|
||||
bool canHandle(ProjectExplorer::BuildStepList *bsl) const;
|
||||
};
|
||||
|
||||
class AndroidDeployQtStep : public ProjectExplorer::BuildStep
|
||||
|
||||
@@ -102,17 +102,6 @@ AndroidQtSupport::~AndroidQtSupport()
|
||||
g_androidQtSupportProviders.removeOne(this);
|
||||
}
|
||||
|
||||
bool AndroidManager::supportsAndroid(const ProjectExplorer::Kit *kit)
|
||||
{
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
|
||||
return version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
bool AndroidManager::supportsAndroid(const ProjectExplorer::Target *target)
|
||||
{
|
||||
return supportsAndroid(target->kit());
|
||||
}
|
||||
|
||||
QString AndroidManager::packageName(ProjectExplorer::Target *target)
|
||||
{
|
||||
QDomDocument doc;
|
||||
@@ -165,8 +154,8 @@ int AndroidManager::minimumSDK(ProjectExplorer::Target *target)
|
||||
int AndroidManager::minimumSDK(const ProjectExplorer::Kit *kit)
|
||||
{
|
||||
int minSDKVersion = -1;
|
||||
if (supportsAndroid(kit)) {
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
|
||||
if (version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE)) {
|
||||
Utils::FileName stockManifestFilePath =
|
||||
Utils::FileName::fromUserInput(version->qmakeProperty("QT_INSTALL_PREFIX") +
|
||||
QLatin1String("/src/android/templates/AndroidManifest.xml"));
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <QPair>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Kit;
|
||||
@@ -47,10 +46,6 @@ class ANDROID_EXPORT AndroidManager : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
static bool supportsAndroid(const ProjectExplorer::Kit *kit);
|
||||
static bool supportsAndroid(const ProjectExplorer::Target *target);
|
||||
|
||||
static QString packageName(ProjectExplorer::Target *target);
|
||||
static QString packageName(const Utils::FileName &manifestFile);
|
||||
|
||||
|
||||
@@ -153,14 +153,10 @@ AndroidPackageInstallationFactory::AndroidPackageInstallationFactory()
|
||||
{
|
||||
registerStep<AndroidPackageInstallationStep>(Constants::ANDROID_PACKAGE_INSTALLATION_STEP_ID);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
setSupportedDeviceType(Android::Constants::ANDROID_DEVICE_TYPE);
|
||||
setRepeatable(false);
|
||||
setDisplayName(tr("Deploy to device"));
|
||||
}
|
||||
|
||||
bool AndroidPackageInstallationFactory::canHandle(BuildStepList *bsl) const
|
||||
{
|
||||
return BuildStepFactory::canHandle(bsl) && AndroidManager::supportsAndroid(bsl->target());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
@@ -71,8 +71,6 @@ class AndroidPackageInstallationFactory: public ProjectExplorer::BuildStepFactor
|
||||
|
||||
public:
|
||||
AndroidPackageInstallationFactory();
|
||||
|
||||
bool canHandle(ProjectExplorer::BuildStepList *bsl) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "androidpackageinstallationfactory.h"
|
||||
#include "androidpackageinstallationstep.h"
|
||||
|
||||
#include <android/androidconstants.h>
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QmakeAndroidSupport {
|
||||
namespace Internal {
|
||||
|
||||
AndroidPackageInstallationFactory::AndroidPackageInstallationFactory()
|
||||
{
|
||||
registerStep<AndroidPackageInstallationStep>(AndroidPackageInstallationStep::Id);
|
||||
setSupportedDeviceType(Android::Constants::ANDROID_DEVICE_TYPE);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
setRepeatable(false);
|
||||
setDisplayName(tr("Deploy to device"));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "qmakeandroidbuildapkstep.h"
|
||||
|
||||
#include <android/androidconfigurations.h>
|
||||
#include <android/androidconstants.h>
|
||||
#include <android/androidmanager.h>
|
||||
#include <android/androidpackageinstallationstep.h>
|
||||
|
||||
@@ -52,22 +53,8 @@ namespace Internal {
|
||||
AndroidQmakeBuildConfigurationFactory::AndroidQmakeBuildConfigurationFactory()
|
||||
{
|
||||
registerBuildConfiguration<AndroidQmakeBuildConfiguration>(QmakeProjectManager::Constants::QMAKE_BC_ID);
|
||||
}
|
||||
|
||||
int AndroidQmakeBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
||||
{
|
||||
if (IBuildConfigurationFactory::priority(k, projectPath) >= 0
|
||||
&& Android::AndroidManager::supportsAndroid(k))
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AndroidQmakeBuildConfigurationFactory::priority(const Target *parent) const
|
||||
{
|
||||
if (IBuildConfigurationFactory::priority(parent) >= 0
|
||||
&& Android::AndroidManager::supportsAndroid(parent))
|
||||
return 1;
|
||||
return -1;
|
||||
setSupportedTargetDeviceTypes({Android::Constants::ANDROID_DEVICE_TYPE});
|
||||
setBasePriority(1);
|
||||
}
|
||||
|
||||
// AndroidQmakeBuildConfiguration
|
||||
|
||||
@@ -34,9 +34,6 @@ class AndroidQmakeBuildConfigurationFactory : public QmakeProjectManager::QmakeB
|
||||
{
|
||||
public:
|
||||
AndroidQmakeBuildConfigurationFactory();
|
||||
|
||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
||||
int priority(const ProjectExplorer::Target *parent) const override;
|
||||
};
|
||||
|
||||
class AndroidQmakeBuildConfiguration : public QmakeProjectManager::QmakeBuildConfiguration
|
||||
|
||||
@@ -64,18 +64,12 @@ QmakeAndroidBuildApkStepFactory::QmakeAndroidBuildApkStepFactory()
|
||||
{
|
||||
registerStep<QmakeAndroidBuildApkStep>(ANDROID_BUILD_APK_ID);
|
||||
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
setDisplayName(tr("Build Android APK"));
|
||||
setRepeatable(false);
|
||||
}
|
||||
|
||||
bool QmakeAndroidBuildApkStepFactory::canHandle(ProjectExplorer::BuildStepList *bsl) const
|
||||
{
|
||||
return BuildStepFactory::canHandle(bsl)
|
||||
&& AndroidManager::supportsAndroid(bsl->target());
|
||||
}
|
||||
|
||||
|
||||
// QmakeAndroidBuildApkStep
|
||||
|
||||
QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc)
|
||||
|
||||
@@ -37,7 +37,6 @@ class QmakeAndroidBuildApkStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
|
||||
public:
|
||||
QmakeAndroidBuildApkStepFactory();
|
||||
bool canHandle(ProjectExplorer::BuildStepList *bsl) const;
|
||||
};
|
||||
|
||||
class QmakeAndroidBuildApkStep : public Android::AndroidBuildApkStep
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "qmakeandroidrunfactories.h"
|
||||
#include "qmakeandroidrunconfiguration.h"
|
||||
|
||||
#include <android/androidmanager.h>
|
||||
#include <android/androidconstants.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -53,6 +53,7 @@ QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject
|
||||
{
|
||||
registerRunConfiguration<QmakeAndroidRunConfiguration>(ANDROID_RC_ID_PREFIX);
|
||||
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||
setSupportedTargetDeviceTypes({Android::Constants::ANDROID_DEVICE_TYPE});
|
||||
}
|
||||
|
||||
QString QmakeAndroidRunConfigurationFactory::displayNameForBuildTarget(const QString &buildTarget) const
|
||||
@@ -66,10 +67,5 @@ QList<QString> QmakeAndroidRunConfigurationFactory::availableBuildTargets(Target
|
||||
return project->buildTargets(mode, {ProjectType::ApplicationTemplate, ProjectType::SharedLibraryTemplate});
|
||||
}
|
||||
|
||||
bool QmakeAndroidRunConfigurationFactory::canHandle(Target *t) const
|
||||
{
|
||||
return IRunConfigurationFactory::canHandle(t) && AndroidManager::supportsAndroid(t);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
@@ -26,12 +26,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <qmakeprojectmanager/qmakerunconfigurationfactory.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Target;
|
||||
class Node;
|
||||
} // namespace ProjectExplorer
|
||||
namespace ProjectExplorer { class Target; }
|
||||
|
||||
namespace QmakeAndroidSupport {
|
||||
namespace Internal {
|
||||
@@ -45,8 +41,6 @@ public:
|
||||
|
||||
QList<QString> availableBuildTargets(ProjectExplorer::Target *parent, CreationMode mode) const override;
|
||||
QString displayNameForBuildTarget(const QString &buildTarget) const override;
|
||||
|
||||
bool canHandle(ProjectExplorer::Target *t) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user