diff options
author | hjk <[email protected]> | 2019-06-05 10:47:30 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2019-06-05 09:58:33 +0000 |
commit | 8e7138f06a165b49bf3feaa5320f86204597c093 (patch) | |
tree | a221284ae4c3877124cf0b38bbfddad239d64f89 | |
parent | 0439eea6bcbff70a4aacfee3d0dc048f9c402131 (diff) |
Android: Use Util::FilePath for working directory in deploy step
Change-Id: I37e716f267cbcc39bc0bddc8b37e84613e048721
Reviewed-by: Vikas Pachdha <[email protected]>
-rw-r--r-- | src/plugins/android/androiddeployqtstep.cpp | 34 | ||||
-rw-r--r-- | src/plugins/android/androiddeployqtstep.h | 6 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index 61c2bfcfa98..7994c85b6ac 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -237,7 +237,7 @@ bool AndroidDeployQtStep::init() m_apkPath = Utils::FilePath::fromString(node->data(Constants::AndroidApk).toString()); if (!m_apkPath.isEmpty()) { m_manifestName = Utils::FilePath::fromString(node->data(Constants::AndroidManifest).toString()); - m_command = AndroidConfigurations::currentConfig().adbToolPath().toString(); + m_command = AndroidConfigurations::currentConfig().adbToolPath(); AndroidManager::setManifestPath(target(), m_manifestName); } else { QString jsonFile; @@ -246,20 +246,19 @@ bool AndroidDeployQtStep::init() if (jsonFile.isEmpty()) { emit addOutput(tr("Cannot find the androiddeploy Json file."), OutputFormat::Stderr); return false; - } m_command = version->qmakeProperty("QT_HOST_BINS"); + } + m_command = FilePath::fromString(version->qmakeProperty("QT_HOST_BINS")); if (m_command.isEmpty()) { emit addOutput(tr("Cannot find the androiddeployqt tool."), OutputFormat::Stderr); return false; } qCDebug(deployStepLog) << "Using androiddeployqt"; - if (!m_command.endsWith(QLatin1Char('/'))) - m_command += QLatin1Char('/'); - m_command += Utils::HostOsInfo::withExecutableSuffix(QLatin1String("androiddeployqt")); + m_command = m_command.pathAppended(HostOsInfo::withExecutableSuffix("androiddeployqt")); - m_workingDirectory = bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY).toString(); + m_workingDirectory = bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY); m_androiddeployqtArgs.addArgs({"--verbose", - "--output", m_workingDirectory, + "--output", m_workingDirectory.toString(), "--no-build", "--input", jsonFile}); @@ -280,14 +279,14 @@ bool AndroidDeployQtStep::init() } } else { m_uninstallPreviousPackageRun = true; - m_command = AndroidConfigurations::currentConfig().adbToolPath().toString(); + m_command = AndroidConfigurations::currentConfig().adbToolPath(); const AndroidConfig &config = AndroidConfigurations::currentConfig(); m_apkPath = deployQtLive ? config.qtLiveApkPath() : AndroidManager::apkPath(target()); - m_workingDirectory = bc ? bc->buildDirectory().toString() : QString(); + m_workingDirectory = bc ? bc->buildDirectory() : FilePath(); } m_environment = bc ? bc->environment() : Utils::Environment(); - m_adbPath = AndroidConfigurations::currentConfig().adbToolPath().toString(); + m_adbPath = AndroidConfigurations::currentConfig().adbToolPath(); AndroidAvdManager avdManager; // Start the AVD if not running. @@ -298,7 +297,7 @@ bool AndroidDeployQtStep::init() AndroidDeployQtStep::DeployErrorCode AndroidDeployQtStep::runDeploy() { - CommandLine cmd(Utils::FilePath::fromString(m_command), {}); + CommandLine cmd(m_command, {}); if (m_useAndroiddeployqt && m_apkPath.isEmpty()) { cmd.addArgs(m_androiddeployqtArgs.arguments()); if (m_uninstallPreviousPackageRun) @@ -346,7 +345,7 @@ AndroidDeployQtStep::DeployErrorCode AndroidDeployQtStep::runDeploy() } qCDebug(deployStepLog) << "Uninstalling previous package"; emit addOutput(tr("Uninstall previous package %1.").arg(packageName), OutputFormat::NormalMessage); - runCommand(m_adbPath, + runCommand(m_adbPath.toString(), AndroidDeviceInfo::adbSelector(m_serialNumber) << QLatin1String("uninstall") << packageName); } @@ -357,7 +356,7 @@ AndroidDeployQtStep::DeployErrorCode AndroidDeployQtStep::runDeploy() m_process = new Utils::QtcProcess; m_process->setCommand(cmd); - m_process->setWorkingDirectory(m_workingDirectory); + m_process->setWorkingDirectory(m_workingDirectory.toString()); m_process->setEnvironment(m_environment); if (Utils::HostOsInfo::isWindowsHost()) @@ -402,14 +401,15 @@ AndroidDeployQtStep::DeployErrorCode AndroidDeployQtStep::runDeploy() m_process = nullptr; if (exitStatus == QProcess::NormalExit && exitCode == 0) { - emit addOutput(tr("The process \"%1\" exited normally.").arg(m_command), + emit addOutput(tr("The process \"%1\" exited normally.").arg(m_command.toUserOutput()), BuildStep::OutputFormat::NormalMessage); } else if (exitStatus == QProcess::NormalExit) { emit addOutput(tr("The process \"%1\" exited with code %2.") - .arg(m_command, QString::number(exitCode)), + .arg(m_command.toUserOutput(), QString::number(exitCode)), BuildStep::OutputFormat::ErrorMessage); } else { - emit addOutput(tr("The process \"%1\" crashed.").arg(m_command), BuildStep::OutputFormat::ErrorMessage); + emit addOutput(tr("The process \"%1\" crashed.").arg(m_command.toUserOutput()), + BuildStep::OutputFormat::ErrorMessage); } if (deployError != NoError) { @@ -489,7 +489,7 @@ bool AndroidDeployQtStep::runImpl() for (auto itr = m_filesToPull.constBegin(); itr != m_filesToPull.constEnd(); ++itr) { QFile::remove(itr.value()); - runCommand(m_adbPath, + runCommand(m_adbPath.toString(), AndroidDeviceInfo::adbSelector(m_serialNumber) << "pull" << itr.key() << itr.value()); if (!QFileInfo::exists(itr.value())) { diff --git a/src/plugins/android/androiddeployqtstep.h b/src/plugins/android/androiddeployqtstep.h index da2a96e2a0b..48faf2abf51 100644 --- a/src/plugins/android/androiddeployqtstep.h +++ b/src/plugins/android/androiddeployqtstep.h @@ -118,9 +118,9 @@ private: bool m_askForUninstall = false; static const Core::Id Id; Utils::CommandLine m_androiddeployqtArgs; - QString m_adbPath; - QString m_command; - QString m_workingDirectory; + Utils::FilePath m_adbPath; + Utils::FilePath m_command; + Utils::FilePath m_workingDirectory; Utils::Environment m_environment; Utils::QtcProcess *m_process = nullptr; AndroidDeviceInfo m_deviceInfo; |