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