forked from qt-creator/qt-creator
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:
@@ -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";
|
||||
|
@@ -67,10 +67,6 @@ public:
|
||||
AndroidPackageInstallationStep(BuildStepList *bsl, Id id);
|
||||
|
||||
QString nativeAndroidBuildPath() const;
|
||||
|
||||
Utils::FilePath androidBuildDirectory() const;
|
||||
Utils::FilePath buildDirectory() const;
|
||||
|
||||
private:
|
||||
bool init() final;
|
||||
void setupOutputFormatter(OutputFormatter *formatter) final;
|
||||
@@ -108,7 +104,7 @@ bool AndroidPackageInstallationStep::init()
|
||||
|
||||
processParameters()->setCommandLine(cmd);
|
||||
// This is useful when running an example target from a Qt module project.
|
||||
processParameters()->setWorkingDirectory(buildDirectory());
|
||||
processParameters()->setWorkingDirectory(AndroidManager::buildDirectory(target()));
|
||||
|
||||
m_androidDirsToClean.clear();
|
||||
// don't remove gradle's cache, it takes ages to rebuild it.
|
||||
@@ -120,7 +116,7 @@ bool AndroidPackageInstallationStep::init()
|
||||
|
||||
QString AndroidPackageInstallationStep::nativeAndroidBuildPath() const
|
||||
{
|
||||
QString buildPath = androidBuildDirectory().toString();
|
||||
QString buildPath = AndroidManager::androidBuildDirectory(target()).toString();
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
if (buildEnvironment().searchInPath("sh.exe").isEmpty())
|
||||
buildPath = QDir::toNativeSeparators(buildPath);
|
||||
@@ -128,18 +124,6 @@ QString AndroidPackageInstallationStep::nativeAndroidBuildPath() const
|
||||
return buildPath;
|
||||
}
|
||||
|
||||
FilePath AndroidPackageInstallationStep::androidBuildDirectory() const
|
||||
{
|
||||
return buildDirectory() / Constants::ANDROID_BUILD_DIRECTORY;
|
||||
}
|
||||
|
||||
FilePath AndroidPackageInstallationStep::buildDirectory() const
|
||||
{
|
||||
if (const BuildSystem *bs = buildSystem())
|
||||
return buildSystem()->buildTarget(target()->activeBuildKey()).workingDirectory;
|
||||
return {};
|
||||
}
|
||||
|
||||
void AndroidPackageInstallationStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParser(new GnuMakeParser);
|
||||
|
Reference in New Issue
Block a user