From 3a294f670dae21d3ee284c054e335d2776182998 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 29 Jan 2021 17:01:10 +0100 Subject: [PATCH] iOS/CMake: Pass correct bundle name Task-number: QTCREATORBUG-23574 Change-Id: Ifb4b6d25a8542796af92c0d35523acd104daf2aa Reviewed-by: Cristian Adam --- .../cmakeprojectmanager/cmakeprojectnodes.cpp | 14 +++++++++++++- .../cmakeprojectmanager/cmakeprojectnodes.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp index b505de7eb4d..d75f75076d7 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -148,7 +149,17 @@ QVariant CMakeTargetNode::data(Utils::Id role) const if (role == Android::Constants::AndroidTargets) return values("TARGETS_BUILD_PATH"); - QTC_CHECK(false); + if (role == Ios::Constants::IosTarget) { + // For some reason the artifact is e.g. "Debug/untitled.app/untitled" which is wrong. + // It actually is e.g. "Debug-iphonesimulator/untitled.app/untitled". + // Anyway, the iOS plugin is only interested in the app bundle name without .app. + return m_artifact.fileName(); + } + + if (role == Ios::Constants::IosBuildDir) + return {}; // defaults to build configuration build directory + + QTC_ASSERT(false, qDebug() << "Unknown role" << role.toString()); // Better guess than "not present". return value(role.toString().toUtf8()); } @@ -181,6 +192,7 @@ void CMakeTargetNode::setTargetInformation(const QList &artifac const QStringList tmp = Utils::transform(artifacts, &Utils::FilePath::toUserOutput); m_tooltip += QCoreApplication::translate("CMakeTargetNode", "Build artifacts:") + "
" + tmp.join("
"); + m_artifact = artifacts.first(); } } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h index 34dc5f1e95f..21e1296f43b 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h @@ -77,6 +77,7 @@ public: private: QString m_tooltip; Utils::FilePath m_buildDirectory; + Utils::FilePath m_artifact; CMakeConfig m_config; };