Android: get build dir based on settings file path for qmake projects

Check Constants::AndroidDeploySettingsFile path first, and use
the buildTarget's workingDir only if that former value is empty.

Fixes: QTCREATORBUG-26357
Change-Id: I726a4b5cd60042845988b4428eea03ef0adb9920
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Assam Boudjelthia
2021-10-07 18:50:35 +03:00
parent 2085e2ad0b
commit fbcb45c105
2 changed files with 16 additions and 19 deletions

View File

@@ -269,7 +269,20 @@ FilePath AndroidManager::buildDirectory(const Target *target)
{
if (const BuildSystem *bs = target->buildSystem()) {
const QString buildKey = target->activeBuildKey();
const FilePath buildDir = bs->buildTarget(target->activeBuildKey()).workingDirectory;
// Get the target build dir based on the settings file path
FilePath buildDir;
const ProjectNode *node = target->project()->findNodeForBuildKey(buildKey);
if (node) {
const QString settingsFile = node->data(Constants::AndroidDeploySettingsFile).toString();
buildDir = FilePath::fromUserInput(settingsFile).parentDir();
}
if (!buildDir.isEmpty())
return buildDir;
// Otherwise fallback to target working dir
buildDir = bs->buildTarget(target->activeBuildKey()).workingDirectory;
if (isQt5CmakeProject(target)) {
// Return the main build dir and not the android libs dir
const QString libsDir = QString(Constants::ANDROID_BUILD_DIRECTORY) + "/libs";