diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2023-06-28 19:17:24 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2023-06-29 11:41:02 +0000 |
commit | 1e81f206b039802df3fa59702dca36b07b0c7f80 (patch) | |
tree | 7ca005839a5622ba4b22b4a1278c0c4ebb2a5719 /src/plugins/android/androiddeployqtstep.cpp | |
parent | 627cb353f6af416df19c7cecbe4214c225dd202c (diff) |
Android: Pull android debugging related files to a subdirectory
When building the project in QtCreator using the Debug configuration,
android deployment procedure pulls app_process from the device to
establish the debug environment. This operation litters the project
build directory with the libraries and executables that don't belong
to it. Instead of pulling the files to the root build directory, it's
better to isolate these files using subdirectory.
Fixes: QTCREATORBUG-29336
Fixes: QTBUG-113851
Fixes: QTBUG-111284
Change-Id: I32c3403dc5f79c42b1ff2bd676c2cf3ae8d43ec3
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/plugins/android/androiddeployqtstep.cpp')
-rw-r--r-- | src/plugins/android/androiddeployqtstep.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index a9e9596e77..db877b4e97 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -512,6 +512,13 @@ void AndroidDeployQtStep::runImpl(QPromise<bool> &promise) itr.value().removeFile(); for (auto itr = m_filesToPull.constBegin(); itr != m_filesToPull.constEnd(); ++itr) { + const FilePath parentDir = itr.value().parentDir(); + if (!parentDir.ensureWritableDir()) { + const QString error = QString("Package deploy: Unable to create directory %1.") + .arg(parentDir.nativePath()); + reportWarningOrError(error, Task::Error); + } + runCommand({m_adbPath, AndroidDeviceInfo::adbSelector(m_serialNumber) << "pull" << itr.key() << itr.value().nativePath()}); @@ -528,7 +535,7 @@ void AndroidDeployQtStep::runImpl(QPromise<bool> &promise) void AndroidDeployQtStep::gatherFilesToPull() { m_filesToPull.clear(); - const FilePath buildDir = AndroidManager::buildDirectory(target()); + const FilePath appProcessDir = AndroidManager::androidAppProcessDir(target()); if (!m_deviceInfo.isValid()) return; @@ -538,16 +545,16 @@ void AndroidDeployQtStep::gatherFilesToPull() const QString preferredAbi = AndroidManager::apkDevicePreferredAbi(target()); if (preferredAbi == ProjectExplorer::Constants::ANDROID_ABI_ARM64_V8A || preferredAbi == ProjectExplorer::Constants::ANDROID_ABI_X86_64) { - m_filesToPull["/system/bin/app_process64"] = buildDir / "app_process"; + m_filesToPull["/system/bin/app_process64"] = appProcessDir / "app_process"; libDirName = "lib64"; linkerName = "linker64"; } else { - m_filesToPull["/system/bin/app_process32"] = buildDir / "app_process"; - m_filesToPull["/system/bin/app_process"] = buildDir / "app_process"; + m_filesToPull["/system/bin/app_process32"] = appProcessDir / "app_process"; + m_filesToPull["/system/bin/app_process"] = appProcessDir / "app_process"; } - m_filesToPull["/system/bin/" + linkerName] = buildDir / linkerName; - m_filesToPull["/system/" + libDirName + "/libc.so"] = buildDir / "libc.so"; + m_filesToPull["/system/bin/" + linkerName] = appProcessDir / linkerName; + m_filesToPull["/system/" + libDirName + "/libc.so"] = appProcessDir / "libc.so"; for (auto itr = m_filesToPull.constBegin(); itr != m_filesToPull.constEnd(); ++itr) qCDebug(deployStepLog).noquote() << "Pulling file from device:" << itr.key() |