diff options
author | Eike Ziller <eike.ziller@digia.com> | 2014-08-15 14:42:30 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2014-08-15 16:14:34 +0200 |
commit | d9d0aba1c4870eaddd9ec3be1561ed0a39bcc74d (patch) | |
tree | d2d40ffee8d17ae3193064d861894a5661908dd0 /src/plugins/winrt | |
parent | 23536e9b426aba67880a9ef19e9c67517e642df0 (diff) | |
parent | 8c133689be164cfdb8f77078a97dce3c97397afe (diff) | |
download | qt-creator-d9d0aba1c4870eaddd9ec3be1561ed0a39bcc74d.tar.gz |
Merge remote-tracking branch 'origin/3.2'
Conflicts:
qtcreator.pri
qtcreator.qbs
src/plugins/coreplugin/editormanager/editormanager.cpp
src/plugins/projectexplorer/editorconfiguration.cpp
src/plugins/projectexplorer/projectfilewizardextension.cpp
src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp
Change-Id: I8de0f6fcdd8d214fbc14e79f74cb0206e6e2c6c1
Diffstat (limited to 'src/plugins/winrt')
-rw-r--r-- | src/plugins/winrt/winrtdevicefactory.cpp | 8 | ||||
-rw-r--r-- | src/plugins/winrt/winrtpackagedeploymentstep.cpp | 71 | ||||
-rw-r--r-- | src/plugins/winrt/winrtpackagedeploymentstep.h | 2 |
3 files changed, 52 insertions, 29 deletions
diff --git a/src/plugins/winrt/winrtdevicefactory.cpp b/src/plugins/winrt/winrtdevicefactory.cpp index 56578c2168..b3dcce7ecc 100644 --- a/src/plugins/winrt/winrtdevicefactory.cpp +++ b/src/plugins/winrt/winrtdevicefactory.cpp @@ -58,7 +58,7 @@ WinRtDeviceFactory::WinRtDeviceFactory() } else { connect(DeviceManager::instance(), &DeviceManager::devicesLoaded, this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection); - connect(static_cast<QtVersionManager *>(QtVersionManager::instance()), + connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsLoaded, this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection); } @@ -125,12 +125,10 @@ void WinRtDeviceFactory::onPrerequisitesLoaded() m_initialized = true; disconnect(DeviceManager::instance(), &DeviceManager::devicesLoaded, this, &WinRtDeviceFactory::onPrerequisitesLoaded); - QtVersionManager *qtVersionManager - = static_cast<QtVersionManager *>(QtVersionManager::instance()); - disconnect(qtVersionManager, &QtVersionManager::qtVersionsLoaded, + disconnect(QtVersionManager::instance(), &QtVersionManager::qtVersionsLoaded, this, &WinRtDeviceFactory::onPrerequisitesLoaded); autoDetect(); - connect(qtVersionManager, &QtVersionManager::qtVersionsChanged, + connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged, this, &WinRtDeviceFactory::autoDetect); } diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.cpp b/src/plugins/winrt/winrtpackagedeploymentstep.cpp index f5aa28c2e5..d342d9a752 100644 --- a/src/plugins/winrt/winrtpackagedeploymentstep.cpp +++ b/src/plugins/winrt/winrtpackagedeploymentstep.cpp @@ -28,8 +28,10 @@ ****************************************************************************/ #include "winrtpackagedeploymentstep.h" -#include "winrtpackagedeploymentstepwidget.h" + #include "winrtconstants.h" +#include "winrtpackagedeploymentstepwidget.h" +#include "winrtrunconfiguration.h" #include <projectexplorer/project.h> #include <projectexplorer/target.h> @@ -39,6 +41,7 @@ #include <projectexplorer/deploymentdata.h> #include <projectexplorer/projectexplorerconstants.h> #include <qtsupport/qtkitinformation.h> +#include <utils/qtcassert.h> #include <utils/qtcprocess.h> #include <QRegularExpression> @@ -59,19 +62,38 @@ WinRtPackageDeploymentStep::WinRtPackageDeploymentStep(BuildStepList *bsl) bool WinRtPackageDeploymentStep::init() { - Utils::FileName proFile = project()->projectFilePath(); - const QString targetPath - = target()->applicationTargets().targetForProject(proFile).toString() - + QLatin1String(".exe"); - QString targetDir = targetPath.left(targetPath.lastIndexOf(QLatin1Char('/')) + 1); - // ### Actually, targetForProject is supposed to return the file path including the file - // extension. Whenever this will eventually work, we have to remove the .exe suffix here. + WinRtRunConfiguration *rc = qobject_cast<WinRtRunConfiguration *>( + target()->activeRunConfiguration()); + QTC_ASSERT(rc, return false); + + const Utils::FileName activeProjectFilePath = Utils::FileName::fromString(rc->proFilePath()); + Utils::FileName appTargetFilePath; + foreach (const BuildTargetInfo &buildTarget, target()->applicationTargets().list) { + if (buildTarget.projectFilePath == activeProjectFilePath) { + appTargetFilePath = buildTarget.targetFilePath; + break; + } + } + + m_targetFilePath = appTargetFilePath.toString(); + if (m_targetFilePath.isEmpty()) { + // ### raise error in 3.3 + // raiseError(tr("No executable to deploy found in %1.").arg(rc->proFilePath())); + return false; + } + + // ### Ideally, the file paths in applicationTargets() should already have the .exe suffix. + // Whenever this will eventually work, we can drop appending the .exe suffix here. + if (!m_targetFilePath.endsWith(QLatin1String(".exe"), Qt::CaseInsensitive)) + m_targetFilePath.append(QLatin1String(".exe")); + + m_targetDirPath = appTargetFilePath.parentDir().toString(); const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit()); if (!qt) return false; - QString args = QtcProcess::quoteArg(QDir::toNativeSeparators(targetPath)); + QString args = QtcProcess::quoteArg(QDir::toNativeSeparators(m_targetFilePath)); args += QLatin1Char(' ') + m_args; m_manifestFileName = QStringLiteral("AppxManifest"); @@ -84,13 +106,16 @@ bool WinRtPackageDeploymentStep::init() if (m_createMappingFile) { args += QLatin1String(" -list mapping"); - m_mappingFileContent = QLatin1String("[Files]\n\"") + QDir::toNativeSeparators(targetDir) - + m_manifestFileName + QLatin1String(".xml\" \"") + m_manifestFileName + QLatin1String(".xml\"\n"); + m_mappingFileContent = QLatin1String("[Files]\n\"") + + QDir::toNativeSeparators(m_targetDirPath) + + m_manifestFileName + QLatin1String(".xml\" \"") + m_manifestFileName + + QLatin1String(".xml\"\n"); - QDir assetDirectory(targetDir + QLatin1String("assets")); + QDir assetDirectory(m_targetDirPath + QLatin1String("assets")); if (assetDirectory.exists()) { QStringList iconsToDeploy; - const QString fullManifestPath = targetDir + m_manifestFileName + QLatin1String(".xml"); + const QString fullManifestPath = m_targetDirPath + m_manifestFileName + + QLatin1String(".xml"); if (!parseIconsAndExecutableFromManifest(fullManifestPath, &iconsToDeploy, &m_executablePathInManifest)) { raiseError(tr("Cannot parse manifest file %1.").arg(fullManifestPath)); @@ -98,7 +123,7 @@ bool WinRtPackageDeploymentStep::init() } foreach (const QString &icon, iconsToDeploy) { m_mappingFileContent += QLatin1Char('"') - + QDir::toNativeSeparators(targetDir + icon) + QLatin1String("\" \"") + + QDir::toNativeSeparators(m_targetDirPath + icon) + QLatin1String("\" \"") + QDir::toNativeSeparators(icon) + QLatin1String("\"\n"); } } @@ -115,18 +140,14 @@ bool WinRtPackageDeploymentStep::init() bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitStatus status) { if (m_createMappingFile) { - Utils::FileName proFile = project()->projectFilePath(); - QString targetPath - = target()->applicationTargets().targetForProject(proFile).toString(); - QString targetDir = targetPath.left(targetPath.lastIndexOf(QLatin1Char('/')) + 1); QString targetInstallationPath; // The list holds the local file paths and the "remote" file paths QList<QPair<QString, QString> > installableFilesList; foreach (DeployableFile file, target()->deploymentData().allFiles()) { QString remoteFilePath = file.remoteFilePath(); QString localFilePath = file.localFilePath().toString(); - if (localFilePath == targetPath) { - if (!targetPath.endsWith(QLatin1String(".exe"))) { + if (localFilePath == m_targetFilePath) { + if (!m_targetFilePath.endsWith(QLatin1String(".exe"))) { remoteFilePath += QLatin1String(".exe"); localFilePath += QLatin1String(".exe"); } @@ -139,11 +160,12 @@ bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitSt // and the icons referenced in there and the actual build target QString baseDir; if (targetInstallationPath.isEmpty()) { - targetPath += QLatin1String(".exe"); + m_targetFilePath += QLatin1String(".exe"); m_mappingFileContent - += QLatin1Char('"') + QDir::toNativeSeparators(targetPath) + QLatin1String("\" \"") + += QLatin1Char('"') + QDir::toNativeSeparators(m_targetFilePath) + + QLatin1String("\" \"") + QDir::toNativeSeparators(m_executablePathInManifest) + QLatin1String("\"\n"); - baseDir = targetDir; + baseDir = m_targetDirPath; } else { baseDir = targetInstallationPath.left(targetInstallationPath.lastIndexOf(QLatin1Char('/')) + 1); } @@ -161,7 +183,8 @@ bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitSt + QLatin1String("\"\n"); } - const QString mappingFilePath = targetDir + m_manifestFileName + QLatin1String(".map"); + const QString mappingFilePath = m_targetDirPath + m_manifestFileName + + QLatin1String(".map"); QFile mappingFile(mappingFilePath); if (!mappingFile.open(QFile::WriteOnly | QFile::Text)) { raiseError(tr("Cannot open mapping file %1 for writing.").arg(mappingFilePath)); diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.h b/src/plugins/winrt/winrtpackagedeploymentstep.h index 224f8b4676..17d597bfdc 100644 --- a/src/plugins/winrt/winrtpackagedeploymentstep.h +++ b/src/plugins/winrt/winrtpackagedeploymentstep.h @@ -58,6 +58,8 @@ private: bool parseIconsAndExecutableFromManifest(QString manifestFileName, QStringList *items, QString *executable); QString m_args; + QString m_targetFilePath; + QString m_targetDirPath; QString m_executablePathInManifest; QString m_mappingFileContent; QString m_manifestFileName; |