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:
Dominik Holland
2024-01-12 15:34:59 +01:00
parent 1d4d9703a8
commit 03acd8f109
7 changed files with 59 additions and 19 deletions

View File

@@ -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";

View File

@@ -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)

View File

@@ -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);

View File

@@ -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

View File

@@ -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);
}
};

View File

@@ -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();

View File

@@ -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"; }