summaryrefslogtreecommitdiff
path: root/src/plugins/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/android')
-rw-r--r--src/plugins/android/androidconfigurations.cpp10
-rw-r--r--src/plugins/android/androidsettingswidget.cpp20
-rw-r--r--src/plugins/android/androidsettingswidget.h1
3 files changed, 31 insertions, 0 deletions
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp
index 29516171e4..c5106c7313 100644
--- a/src/plugins/android/androidconfigurations.cpp
+++ b/src/plugins/android/androidconfigurations.cpp
@@ -45,6 +45,7 @@
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtversionmanager.h>
+#include <utils/environment.h>
#include <QDateTime>
#include <QSettings>
@@ -734,6 +735,15 @@ void AndroidConfigurations::load()
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(SettingsGroup);
m_config = AndroidConfig(*settings);
+
+ if (m_config.antLocation.isEmpty()) {
+ Utils::Environment env = Utils::Environment::systemEnvironment();
+ QString location = env.searchInPath(QLatin1String("ant"));
+ QFileInfo fi(location);
+ if (fi.exists() && fi.isExecutable() && !fi.isDir())
+ m_config.antLocation = Utils::FileName::fromString(location);
+ }
+
settings->endGroup();
}
diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp
index 8a0163df7d..2cbbbdc6fa 100644
--- a/src/plugins/android/androidsettingswidget.cpp
+++ b/src/plugins/android/androidsettingswidget.cpp
@@ -278,6 +278,7 @@ void AndroidSettingsWidget::sdkLocationEditingFinished()
return;
}
m_androidConfig.sdkLocation = location;
+ searchForAnt(location.toString());
saveSettings(true);
m_AVDModel.setAvdList(AndroidConfigurations::instance().androidVirtualDevices());
m_ui->AVDManagerFrame->setEnabled(true);
@@ -289,9 +290,28 @@ void AndroidSettingsWidget::ndkLocationEditingFinished()
m_androidConfig.toolchainHost.clear(); // force toolchain host detection
if (!checkNDK(location))
return;
+ searchForAnt(location.toString());
saveSettings(true);
}
+void AndroidSettingsWidget::searchForAnt(const QString &location)
+{
+ if (!m_androidConfig.antLocation.isEmpty())
+ return;
+ if (location.isEmpty())
+ return;
+ QDir parentFolder = QFileInfo(location).absoluteDir();
+ foreach (const QString &file, parentFolder.entryList()) {
+ if (file.startsWith(QLatin1String("apache-ant"))) {
+ QString ant = parentFolder.absolutePath() + QLatin1Char('/') + file + QLatin1String("/bin/ant.bat");
+ if (QFileInfo(ant).exists()) {
+ m_androidConfig.antLocation = Utils::FileName::fromString(ant);
+ m_ui->AntLocationLineEdit->setText(ant);
+ }
+ }
+ }
+}
+
void AndroidSettingsWidget::antLocationEditingFinished()
{
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->AntLocationLineEdit->text());
diff --git a/src/plugins/android/androidsettingswidget.h b/src/plugins/android/androidsettingswidget.h
index 957d234173..74e7fe6d43 100644
--- a/src/plugins/android/androidsettingswidget.h
+++ b/src/plugins/android/androidsettingswidget.h
@@ -75,6 +75,7 @@ public:
private slots:
void sdkLocationEditingFinished();
void ndkLocationEditingFinished();
+ void searchForAnt(const QString &location);
void antLocationEditingFinished();
void openJDKLocationEditingFinished();
void browseSDKLocation();