AppMan: Various small fixes

* Always use the correct symbol when debugging
* Fix the TargetInformation::isValid() function
* Optimize RunConfigurationFactory::supportsBuildKey()

Change-Id: I5f007d5c216ff9808adf9f8b878c9cbc9f47e3eb
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Dominik Holland
2024-01-25 10:12:26 +01:00
parent 53de44444e
commit e0088357d0
3 changed files with 10 additions and 12 deletions

View File

@@ -86,10 +86,8 @@ public:
virtual bool supportsBuildKey(Target *target, const QString &key) const final virtual bool supportsBuildKey(Target *target, const QString &key) const final
{ {
QList<TargetInformation> tis = TargetInformation::readFromProject(target); QList<TargetInformation> tis = TargetInformation::readFromProject(target, key);
return Utils::anyOf(tis, [key](const TargetInformation &ti) { return !tis.isEmpty();
return ti.buildKey == key;
});
} }
virtual bool filterTarget(const TargetInformation &ti) const virtual bool filterTarget(const TargetInformation &ti) const

View File

@@ -193,7 +193,7 @@ private:
class AppManagerDebugSupport final : public Debugger::DebuggerRunTool class AppManagerDebugSupport final : public Debugger::DebuggerRunTool
{ {
private: private:
QString m_symbolFile; FilePath m_symbolFile;
AppManInferiorRunner *m_debuggee = nullptr; AppManInferiorRunner *m_debuggee = nullptr;
public: public:
@@ -217,14 +217,13 @@ public:
return; return;
if (targetInformation.manifest.isQmlRuntime()) { if (targetInformation.manifest.isQmlRuntime()) {
const Utils::FilePath dir = SysRootKitAspect::sysRoot(target->kit()); m_symbolFile = getToolFilePath(Constants::APPMAN_LAUNCHER_QML,
// TODO: get real aspect from deploy configuration target->kit(),
QString amfolder = Constants::REMOTE_DEFAULT_BIN_PATH; DeviceKitAspect::device(target->kit()));
m_symbolFile = dir.toString() + amfolder + QDir::separator() + Constants::APPMAN_LAUNCHER_QML;
} else if (targetInformation.manifest.isNativeRuntime()) { } else if (targetInformation.manifest.isNativeRuntime()) {
m_symbolFile = Utils::findOrDefault(target->buildSystem()->applicationTargets(), [&](const BuildTargetInfo &ti) { m_symbolFile = Utils::findOrDefault(target->buildSystem()->applicationTargets(), [&](const BuildTargetInfo &ti) {
return ti.buildKey == targetInformation.manifest.code || ti.projectFilePath.toString() == targetInformation.manifest.code; return ti.buildKey == targetInformation.manifest.code || ti.projectFilePath.toString() == targetInformation.manifest.code;
}).targetFilePath.toString(); }).targetFilePath;
} else { } else {
reportFailure(Tr::tr("Cannot debug: Only QML and native applications are supported.")); reportFailure(Tr::tr("Cannot debug: Only QML and native applications are supported."));
} }
@@ -249,7 +248,7 @@ private:
setUseContinueInsteadOfRun(true); setUseContinueInsteadOfRun(true);
setContinueAfterAttach(true); setContinueAfterAttach(true);
setRemoteChannel(m_debuggee->gdbServer()); setRemoteChannel(m_debuggee->gdbServer());
setSymbolFile(FilePath::fromString(m_symbolFile)); setSymbolFile(m_symbolFile);
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(runControl()->kit()); QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(runControl()->kit());
if (version) { if (version) {

View File

@@ -48,6 +48,7 @@ QList<TargetInformation> TargetInformation::readFromProject(const Target *target
const Utils::expected_str<QByteArray> localFileContents = manifestFilePath.fileContents(); const Utils::expected_str<QByteArray> localFileContents = manifestFilePath.fileContents();
if (!localFileContents.has_value()) { if (!localFileContents.has_value()) {
qWarning() << "NOPE:" << localFileContents.error(); qWarning() << "NOPE:" << localFileContents.error();
continue;
} }
auto createTargetInformation = [buildKey, manifestFilePath, cmakeTarget, packageFilePath, isBuiltinPackage, &result](const YAML::Node &document) { auto createTargetInformation = [buildKey, manifestFilePath, cmakeTarget, packageFilePath, isBuiltinPackage, &result](const YAML::Node &document) {
@@ -131,7 +132,7 @@ TargetInformation::TargetInformation(const Target *target)
bool TargetInformation::isValid() const bool TargetInformation::isValid() const
{ {
return !manifest.filePath.isEmpty() && packageFilePath.isFile(); return !manifest.filePath.isEmpty() && manifest.filePath.isFile();
} }
} // namespace Internal } // namespace Internal