forked from qt-creator/qt-creator
AppMan: Enable debug support only for the "qml" and the "native" runtimes
Change-Id: I6858bebe172a8a4b0694b335eeaeb03e1404e8b0 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -22,6 +22,7 @@ const char DEPLOY_PACKAGE_STEP_ID[] = "ApplicationManagerPlugin.Deploy.DeployPac
|
||||
const char INSTALL_PACKAGE_STEP_ID[] = "ApplicationManagerPlugin.Deploy.InstallPackageStep";
|
||||
const char REMOTE_INSTALL_PACKAGE_STEP_ID[] = "ApplicationManagerPlugin.Deploy.RemoteInstallPackageStep";
|
||||
const char RUNCONFIGURATION_ID[] = "ApplicationManagerPlugin.Run.Configuration";
|
||||
const char RUNANDDEBUGCONFIGURATION_ID[] = "ApplicationManagerPlugin.RunAndDebug.Configuration";
|
||||
|
||||
const char EXTRADATA_TARGET_ID[] = "ApplicationManagerPlugin.ExtraData.Target";
|
||||
|
||||
|
@@ -61,7 +61,8 @@ void AppManagerDeployConfigurationAutoSwitcher::onActiveDeployConfigurationChang
|
||||
|
||||
static bool isApplicationManagerRunConfiguration(const RunConfiguration *runConfiguration)
|
||||
{
|
||||
return runConfiguration && runConfiguration->id() == Constants::RUNCONFIGURATION_ID;
|
||||
return runConfiguration && (runConfiguration->id() == Constants::RUNCONFIGURATION_ID ||
|
||||
runConfiguration->id() == Constants::RUNANDDEBUGCONFIGURATION_ID);
|
||||
}
|
||||
|
||||
static bool isApplicationManagerDeployConfiguration(const DeployConfiguration *deployConfiguration)
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
AppManagerDeployConfigurationFactory()
|
||||
{
|
||||
setConfigBaseId(Constants::DEPLOYCONFIGURATION_ID);
|
||||
setDefaultDisplayName(Tr::tr("AppManager", "Deploy Application Manager Package"));
|
||||
setDefaultDisplayName(Tr::tr("Deploy Application Manager Package"));
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||
|
||||
|
@@ -22,26 +22,27 @@ using namespace Utils;
|
||||
|
||||
namespace AppManager::Internal {
|
||||
|
||||
class AppManagerRunConfiguration final : public RunConfiguration
|
||||
class AppManagerRunConfiguration : public RunConfiguration
|
||||
{
|
||||
public:
|
||||
AppManagerRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
setDefaultDisplayName(Tr::tr("Run on AM Device"));
|
||||
}
|
||||
|
||||
QString disabledReason() const override
|
||||
{
|
||||
if (activeBuildSystem()->isParsing()) {
|
||||
return Tr::tr("The project file \"%1\" is currently being parsed.")
|
||||
.arg(project()->projectFilePath().toString());
|
||||
}
|
||||
return QString();
|
||||
setDefaultDisplayName(Tr::tr("Run an Appman Package"));
|
||||
}
|
||||
};
|
||||
|
||||
class AppManagerRunConfigurationFactory final : public RunConfigurationFactory
|
||||
class AppManagerRunAndDebugConfiguration final : public AppManagerRunConfiguration
|
||||
{
|
||||
public:
|
||||
AppManagerRunAndDebugConfiguration(Target *target, Id id)
|
||||
: AppManagerRunConfiguration(target, id)
|
||||
{
|
||||
setDefaultDisplayName(Tr::tr("Run and Debug an Appman Package"));
|
||||
}
|
||||
};
|
||||
|
||||
class AppManagerRunConfigurationFactory : public RunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
AppManagerRunConfigurationFactory()
|
||||
@@ -51,14 +52,30 @@ public:
|
||||
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||
}
|
||||
|
||||
QList<RunConfigurationCreationInfo> availableCreators(Target *target) const final
|
||||
virtual bool supportsBuildKey(Target *target, const QString &key) const final
|
||||
{
|
||||
QList<TargetInformation> tis = TargetInformation::readFromProject(target);
|
||||
return Utils::anyOf(tis, [key](const TargetInformation &ti) {
|
||||
return ti.buildKey == key;
|
||||
});
|
||||
}
|
||||
|
||||
virtual bool filterTarget(const TargetInformation &ti) const
|
||||
{
|
||||
return !ti.manifest.supportsDebugging();
|
||||
}
|
||||
|
||||
QList<RunConfigurationCreationInfo> availableCreators(Target *target) const
|
||||
{
|
||||
QObject::connect(&m_fileSystemWatcher, &FileSystemWatcher::fileChanged,
|
||||
target->project(), &Project::displayNameChanged,
|
||||
Qt::UniqueConnection);
|
||||
|
||||
const auto buildTargets = TargetInformation::readFromProject(target);
|
||||
auto result = Utils::transform(buildTargets, [this, target](const TargetInformation &ti) {
|
||||
const auto filteredTargets = Utils::filtered(buildTargets, [this](const TargetInformation &ti){
|
||||
return filterTarget(ti);
|
||||
});
|
||||
auto result = Utils::transform(filteredTargets, [this, target](const TargetInformation &ti) {
|
||||
|
||||
QVariantMap settings;
|
||||
// ti.buildKey is currently our app id
|
||||
@@ -71,6 +88,7 @@ public:
|
||||
rci.displayName = ti.displayName;
|
||||
rci.displayNameUniquifier = ti.displayNameUniquifier;
|
||||
rci.creationMode = RunConfigurationCreationInfo::AlwaysCreate;
|
||||
rci.projectFilePath = Utils::FilePath::fromString(ti.manifest.fileName);
|
||||
rci.useTerminal = false;
|
||||
if (!m_fileSystemWatcher.files().contains(ti.manifest.fileName)) {
|
||||
m_fileSystemWatcher.addFile(ti.manifest.fileName, FileSystemWatcher::WatchAllChanges);
|
||||
@@ -84,9 +102,26 @@ public:
|
||||
mutable FileSystemWatcher m_fileSystemWatcher;
|
||||
};
|
||||
|
||||
class AppManagerRunAndDebugConfigurationFactory final : public AppManagerRunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
AppManagerRunAndDebugConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<AppManagerRunAndDebugConfiguration>(Constants::RUNANDDEBUGCONFIGURATION_ID);
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||
}
|
||||
|
||||
virtual bool filterTarget(const TargetInformation &ti) const final
|
||||
{
|
||||
return ti.manifest.supportsDebugging();
|
||||
}
|
||||
};
|
||||
|
||||
void setupAppManagerRunConfiguration()
|
||||
{
|
||||
static AppManagerRunConfigurationFactory theAppManagerRunConfigurationFactory;
|
||||
static AppManagerRunAndDebugConfigurationFactory theAppManagerRunAndDebugConfigurationFactory;
|
||||
}
|
||||
|
||||
} // AppManager::Internal
|
||||
|
@@ -285,6 +285,7 @@ public:
|
||||
setProduct<AppManagerRunner>();
|
||||
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
|
||||
addSupportedRunConfig(Constants::RUNCONFIGURATION_ID);
|
||||
addSupportedRunConfig(Constants::RUNANDDEBUGCONFIGURATION_ID);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -295,7 +296,7 @@ public:
|
||||
{
|
||||
setProduct<AppManagerDebugSupport>();
|
||||
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||
addSupportedRunConfig(Constants::RUNCONFIGURATION_ID);
|
||||
addSupportedRunConfig(Constants::RUNANDDEBUGCONFIGURATION_ID);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -307,7 +308,7 @@ public:
|
||||
setProduct<AppManagerQmlToolingSupport>();
|
||||
addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE);
|
||||
addSupportedRunConfig(Constants::RUNCONFIGURATION_ID);
|
||||
addSupportedRunConfig(Constants::RUNANDDEBUGCONFIGURATION_ID);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -112,7 +112,8 @@ TargetInformation::TargetInformation(const Target *target)
|
||||
const RunConfiguration *rc = target->activeRunConfiguration();
|
||||
if (!rc)
|
||||
return;
|
||||
if (rc->id() != Constants::RUNCONFIGURATION_ID)
|
||||
if (rc->id() != Constants::RUNCONFIGURATION_ID &&
|
||||
rc->id() != Constants::RUNANDDEBUGCONFIGURATION_ID)
|
||||
return;
|
||||
|
||||
const auto buildKey = rc->buildKey();
|
||||
|
@@ -27,6 +27,7 @@ public:
|
||||
QString code;
|
||||
QString runtime;
|
||||
|
||||
bool supportsDebugging() const { return isQmlRuntime() || isNativeRuntime(); }
|
||||
bool isQmlRuntime() const { return runtime.toLower() == "qml"; }
|
||||
bool isNativeRuntime() const { return runtime.toLower() == "native"; }
|
||||
|
||||
|
Reference in New Issue
Block a user