Commit 02738381 authored by Vikas Pachdha's avatar Vikas Pachdha

Android: Remove Ant and make gradle as the default java build tool

All GUI options to choose between  ant and gradle are removed.
Gradle is the only java build tool used now.

Change-Id: I309ff66256c5d40920a5d77a8331c5917c53c185
Reviewed-by: default avatarBogDan Vatra <bogdan@kdab.com>
parent f4a8f52b
......@@ -65,8 +65,6 @@ const char DeployActionKey[] = "Qt4ProjectManager.AndroidDeployQtStep.DeployQtAc
const char KeystoreLocationKey[] = "KeystoreLocation";
const char BuildTargetSdkKey[] = "BuildTargetSdk";
const char VerboseOutputKey[] = "VerboseOutput";
const char UseGradleKey[] = "UseGradle";
class PasswordInputDialog : public QDialog {
public:
......@@ -96,9 +94,6 @@ AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent,
: ProjectExplorer::AbstractProcessStep(parent, id),
m_buildTargetSdk(AndroidConfig::apiLevelNameFor(AndroidConfigurations::currentConfig().highestAndroidSdk()))
{
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
if (version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0))
m_useGradle = AndroidConfigurations::currentConfig().useGrandle();
//: AndroidBuildApkStep default display name
setDefaultDisplayName(tr("Build Android APK"));
}
......@@ -109,14 +104,10 @@ AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent,
m_deployAction(other->deployAction()),
m_signPackage(other->signPackage()),
m_verbose(other->m_verbose),
m_useGradle(other->m_useGradle),
m_openPackageLocation(other->m_openPackageLocation),
// leave m_openPackageLocationForRun at false
m_buildTargetSdk(other->m_buildTargetSdk)
{
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
if (m_useGradle && version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0))
m_useGradle = false;
}
bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
......@@ -138,11 +129,18 @@ bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
return false;
const QVersionNumber sdkToolsVersion = AndroidConfigurations::currentConfig().sdkToolsVersion();
if (sdkToolsVersion >= gradleScriptRevokedSdkVersion &&
!version->sourcePath().appendPath("src/3rdparty/gradle").exists()) {
emit addOutput(tr("The installed SDK tools version (%1) does not include Gradle scripts. The "
"minimum Qt version required for Gradle build to work is %2.")
.arg(sdkToolsVersion.toString()).arg("5.9.0/5.6.3"), OutputFormat::Stderr);
if (sdkToolsVersion >= gradleScriptRevokedSdkVersion) {
if (!version->sourcePath().appendPath("src/3rdparty/gradle").exists()) {
emit addOutput(tr("The installed SDK tools version (%1) does not include Gradle "
"scripts. The minimum Qt version required for Gradle build to work "
"is %2").arg(sdkToolsVersion.toString()).arg("5.9.0/5.6.3"),
OutputFormat::Stderr);
return false;
}
} else if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
emit addOutput(tr("The minimum Qt version required for Gradle build to work is %2. "
"It is recommended to install the latest Qt version.")
.arg("5.4.0"), OutputFormat::Stderr);
return false;
}
......@@ -241,7 +239,6 @@ bool AndroidBuildApkStep::fromMap(const QVariantMap &map)
if (m_buildTargetSdk.isEmpty())
m_buildTargetSdk = AndroidConfig::apiLevelNameFor(AndroidConfigurations::currentConfig().highestAndroidSdk());
m_verbose = map.value(VerboseOutputKey).toBool();
m_useGradle = map.value(UseGradleKey).toBool();
return ProjectExplorer::BuildStep::fromMap(map);
}
......@@ -252,7 +249,6 @@ QVariantMap AndroidBuildApkStep::toMap() const
map.insert(KeystoreLocationKey, m_keystorePath.toString());
map.insert(BuildTargetSdkKey, m_buildTargetSdk);
map.insert(VerboseOutputKey, m_verbose);
map.insert(UseGradleKey, m_useGradle);
return map;
}
......@@ -269,8 +265,7 @@ QString AndroidBuildApkStep::buildTargetSdk() const
void AndroidBuildApkStep::setBuildTargetSdk(const QString &sdk)
{
m_buildTargetSdk = sdk;
if (m_useGradle)
AndroidManager::updateGradleProperties(target());
AndroidManager::updateGradleProperties(target());
}
AndroidBuildApkStep::AndroidDeployAction AndroidBuildApkStep::deployAction() const
......@@ -330,21 +325,6 @@ void AndroidBuildApkStep::setVerboseOutput(bool verbose)
m_verbose = verbose;
}
bool AndroidBuildApkStep::useGradle() const
{
return m_useGradle;
}
void AndroidBuildApkStep::setUseGradle(bool b)
{
if (m_useGradle != b) {
m_useGradle = b;
if (m_useGradle)
AndroidManager::updateGradleProperties(target());
emit useGradleChanged();
}
}
bool AndroidBuildApkStep::addDebugger() const
{
return m_addDebugger;
......
......@@ -69,9 +69,6 @@ public:
bool verboseOutput() const;
void setVerboseOutput(bool verbose);
bool useGradle() const;
void setUseGradle(bool b);
bool addDebugger() const;
void setAddDebugger(bool debug);
......@@ -81,9 +78,6 @@ public:
virtual Utils::FileName androidPackageSourceDir() const = 0;
void setDeployAction(AndroidDeployAction deploy);
signals:
void useGradleChanged();
protected:
Q_INVOKABLE void showInGraphicalShell();
......@@ -101,7 +95,6 @@ protected:
AndroidDeployAction m_deployAction = BundleLibrariesDeployment;
bool m_signPackage = false;
bool m_verbose = false;
bool m_useGradle = true; // Ant builds are deprecated.
bool m_openPackageLocation = false;
bool m_openPackageLocationForRun = false;
bool m_addDebugger = true;
......
......@@ -54,8 +54,6 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
{
m_ui->setupUi(this);
m_ui->deprecatedInfoIconLabel->setPixmap(Utils::Icons::INFO.pixmap());
// Target sdk combobox
int minApiLevel = 9;
const AndroidConfig &config = AndroidConfigurations::currentConfig();
......@@ -90,9 +88,6 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
m_ui->signingDebugWarningLabel->hide();
signPackageCheckBoxToggled(m_step->signPackage());
m_ui->useGradleCheckBox->setEnabled(config.antScriptsAvailable());
m_ui->useGradleCheckBox->setChecked(!config.antScriptsAvailable() ||
m_step->useGradle());
m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput());
m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation());
m_ui->addDebuggerCheckBox->setChecked(m_step->addDebugger());
......@@ -108,8 +103,6 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
connect(m_ui->bundleQtOption, &QAbstractButton::clicked,
this, &AndroidBuildApkWidget::setBundleQtLibs);
connect(m_ui->useGradleCheckBox, &QAbstractButton::toggled,
this, &AndroidBuildApkWidget::useGradleCheckBoxToggled);
connect(m_ui->openPackageLocationCheckBox, &QAbstractButton::toggled,
this, &AndroidBuildApkWidget::openPackageLocationCheckBoxToggled);
connect(m_ui->verboseOutputCheckBox, &QAbstractButton::toggled,
......@@ -135,9 +128,6 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
this, &AndroidBuildApkWidget::updateSigningWarning);
updateSigningWarning();
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(step->target()->kit());
bool qt54 = qt->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
m_ui->useGradleCheckBox->setVisible(qt54);
}
AndroidBuildApkWidget::~AndroidBuildApkWidget()
......@@ -247,8 +237,3 @@ void AndroidBuildApkWidget::updateSigningWarning()
m_ui->signingDebugWarningLabel->setVisible(false);
}
}
void AndroidBuildApkWidget::useGradleCheckBoxToggled(bool checked)
{
m_step->setUseGradle(checked);
}
......@@ -57,7 +57,6 @@ private:
void certificatesAliasComboBoxCurrentIndexChanged(const QString &alias);
void certificatesAliasComboBoxActivated(const QString &alias);
void updateSigningWarning();
void useGradleCheckBoxToggled(bool checked);
void openPackageLocationCheckBoxToggled(bool checked);
void verboseOutputCheckBoxToggled(bool checked);
void updateKeyStorePath(const QString &path);
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>819</width>
<height>478</height>
<width>641</width>
<height>331</height>
</rect>
</property>
<property name="windowTitle">
......@@ -145,66 +145,21 @@
<string>Advanced Actions</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="useGradleCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Use Gradle (Ant builds are deprecated)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="deprecatedInfoIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Gradle builds are forced from Android SDK tools version 25.3.0 onwards as Ant scripts are no longer available.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="openPackageLocationCheckBox">
<property name="text">
<string>Open package location after build</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="verboseOutputCheckBox">
<property name="text">
<string>Verbose output</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="addDebuggerCheckBox">
<property name="enabled">
<bool>false</bool>
......
......@@ -84,16 +84,13 @@ using namespace Internal;
namespace {
const char jdkSettingsPath[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit";
const QVersionNumber sdkToolsAntMissingVersion(25, 3, 0);
const QLatin1String SettingsGroup("AndroidConfigurations");
const QLatin1String SDKLocationKey("SDKLocation");
const QLatin1String NDKLocationKey("NDKLocation");
const QLatin1String AntLocationKey("AntLocation");
const QLatin1String OpenJDKLocationKey("OpenJDKLocation");
const QLatin1String KeystoreLocationKey("KeystoreLocation");
const QLatin1String AutomaticKitCreationKey("AutomatiKitCreation");
const QLatin1String UseGradleKey("UseGradle");
const QLatin1String MakeExtraSearchDirectory("MakeExtraSearchDirectory");
const QLatin1String PartitionSizeKey("PartitionSize");
const QLatin1String ToolchainHostKey("ToolchainHost");
......@@ -250,8 +247,6 @@ void AndroidConfig::load(const QSettings &settings)
m_partitionSize = settings.value(PartitionSizeKey, 1024).toInt();
m_sdkLocation = FileName::fromString(settings.value(SDKLocationKey).toString());
m_ndkLocation = FileName::fromString(settings.value(NDKLocationKey).toString());
m_antLocation = FileName::fromString(settings.value(AntLocationKey).toString());
m_useGradle = settings.value(UseGradleKey, false).toBool();
m_openJDKLocation = FileName::fromString(settings.value(OpenJDKLocationKey).toString());
m_keystoreLocation = FileName::fromString(settings.value(KeystoreLocationKey).toString());
m_toolchainHost = settings.value(ToolchainHostKey).toString();
......@@ -267,7 +262,6 @@ void AndroidConfig::load(const QSettings &settings)
// persisten settings
m_sdkLocation = FileName::fromString(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString());
m_ndkLocation = FileName::fromString(reader.restoreValue(NDKLocationKey, m_ndkLocation.toString()).toString());
m_antLocation = FileName::fromString(reader.restoreValue(AntLocationKey, m_antLocation.toString()).toString());
m_openJDKLocation = FileName::fromString(reader.restoreValue(OpenJDKLocationKey, m_openJDKLocation.toString()).toString());
m_keystoreLocation = FileName::fromString(reader.restoreValue(KeystoreLocationKey, m_keystoreLocation.toString()).toString());
m_toolchainHost = reader.restoreValue(ToolchainHostKey, m_toolchainHost).toString();
......@@ -291,8 +285,6 @@ void AndroidConfig::save(QSettings &settings) const
// user settings
settings.setValue(SDKLocationKey, m_sdkLocation.toString());
settings.setValue(NDKLocationKey, m_ndkLocation.toString());
settings.setValue(AntLocationKey, m_antLocation.toString());
settings.setValue(UseGradleKey, m_useGradle);
settings.setValue(OpenJDKLocationKey, m_openJDKLocation.toString());
settings.setValue(KeystoreLocationKey, m_keystoreLocation.toString());
settings.setValue(PartitionSizeKey, m_partitionSize);
......@@ -400,14 +392,6 @@ FileName AndroidConfig::androidToolPath() const
}
}
FileName AndroidConfig::antToolPath() const
{
if (!m_antLocation.isEmpty())
return m_antLocation;
else
return FileName::fromLatin1("ant");
}
FileName AndroidConfig::emulatorToolPath() const
{
FileName path = m_sdkLocation;
......@@ -844,16 +828,6 @@ void AndroidConfig::setNdkLocation(const FileName &ndkLocation)
m_NdkInformationUpToDate = false;
}
FileName AndroidConfig::antLocation() const
{
return m_antLocation;
}
void AndroidConfig::setAntLocation(const FileName &antLocation)
{
m_antLocation = antLocation;
}
FileName AndroidConfig::openJDKLocation() const
{
return m_openJDKLocation;
......@@ -906,25 +880,6 @@ void AndroidConfig::setAutomaticKitCreation(bool b)
m_automaticKitCreation = b;
}
bool AndroidConfig::antScriptsAvailable() const
{
return sdkToolsVersion() < sdkToolsAntMissingVersion;
}
bool AndroidConfig::useGrandle() const
{
if (antScriptsAvailable()) {
return m_useGradle;
}
// Force gradle builds.
return true;
}
void AndroidConfig::setUseGradle(bool b)
{
m_useGradle = b;
}
///////////////////////////////////
// AndroidConfigurations
///////////////////////////////////
......@@ -1225,16 +1180,6 @@ void AndroidConfigurations::load()
settings->beginGroup(SettingsGroup);
m_config.load(*settings);
if (m_config.antLocation().isEmpty()) {
Environment env = Environment::systemEnvironment();
FileName location = env.searchInPath(QLatin1String("ant"));
QFileInfo fi = location.toFileInfo();
if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
m_config.setAntLocation(location);
saveSettings = true;
}
}
if (m_config.openJDKLocation().isEmpty()) {
if (HostOsInfo::isLinuxHost()) {
Environment env = Environment::systemEnvironment();
......
......@@ -119,9 +119,6 @@ public:
QVersionNumber ndkVersion() const;
void setNdkLocation(const Utils::FileName &ndkLocation);
Utils::FileName antLocation() const;
void setAntLocation(const Utils::FileName &antLocation);
Utils::FileName openJDKLocation() const;
void setOpenJDKLocation(const Utils::FileName &openJDKLocation);
......@@ -137,14 +134,8 @@ public:
bool automaticKitCreation() const;
void setAutomaticKitCreation(bool b);
bool antScriptsAvailable() const;
bool useGrandle() const;
void setUseGradle(bool b);
Utils::FileName adbToolPath() const;
Utils::FileName androidToolPath() const;
Utils::FileName antToolPath() const;
Utils::FileName emulatorToolPath() const;
Utils::FileName sdkManagerToolPath() const;
Utils::FileName avdManagerToolPath() const;
......@@ -203,13 +194,11 @@ private:
Utils::FileName m_sdkLocation;
Utils::FileName m_ndkLocation;
Utils::FileName m_antLocation;
Utils::FileName m_openJDKLocation;
Utils::FileName m_keystoreLocation;
QStringList m_makeExtraSearchDirectories;
unsigned m_partitionSize = 1024;
bool m_automaticKitCreation = true;
bool m_useGradle = true; // Ant builds are deprecated.
//caches
mutable bool m_availableSdkPlatformsUpToDate = false;
......
......@@ -233,8 +233,8 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("bundled"));
break;
}
if (androidBuildApkStep->useGradle())
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("--gradle"));
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("--gradle"));
if (androidBuildApkStep->signPackage()) {
// The androiddeployqt tool is not really written to do stand-alone installations.
......
......@@ -463,15 +463,6 @@ AndroidQtSupport *AndroidManager::androidQtSupport(ProjectExplorer::Target *targ
return 0;
}
bool AndroidManager::useGradle(ProjectExplorer::Target *target)
{
if (!target)
return false;
AndroidBuildApkStep *buildApkStep
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
return buildApkStep && buildApkStep->useGradle();
}
typedef QMap<QByteArray, QByteArray> GradleProperties;
static GradleProperties readGradleProperties(const QString &path)
......@@ -543,7 +534,7 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
AndroidBuildApkStep *buildApkStep
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
if (!buildApkStep || !buildApkStep->useGradle() || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).exists())
if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).exists())
return false;
Utils::FileName wrapperProps(buildApkStep->androidPackageSourceDir());
......
......@@ -87,7 +87,6 @@ public:
const QString &alias);
static bool checkForQt51Files(Utils::FileName fileName);
static AndroidQtSupport *androidQtSupport(ProjectExplorer::Target *target);
static bool useGradle(ProjectExplorer::Target *target);
static bool updateGradleProperties(ProjectExplorer::Target *target);
static int findApiLevel(const Utils::FileName &platformPath);
};
......
......@@ -41,11 +41,7 @@ Utils::FileName Android::AndroidQtSupport::apkPath(ProjectExplorer::Target *targ
if (!buildApkStep)
return Utils::FileName();
QString apkPath;
if (buildApkStep->useGradle())
apkPath = QLatin1String("build/outputs/apk/android-build-");
else
apkPath = QLatin1String("bin/QtApp-");
QString apkPath("build/outputs/apk/android-build-");
if (buildApkStep->signPackage())
apkPath += QLatin1String("release.apk");
else
......
......@@ -134,8 +134,6 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
{
m_ui->setupUi(this);
m_ui->deprecatedInfoIconLabel->setPixmap(Utils::Icons::INFO.pixmap());
connect(&m_checkGdbWatcher, &QFutureWatcherBase::finished,
this, &AndroidSettingsWidget::checkGdbFinished);
......@@ -144,27 +142,6 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
m_ui->NDKLocationPathChooser->setFileName(m_androidConfig.ndkLocation());
m_ui->NDKLocationPathChooser->setPromptDialogTitle(tr("Select Android NDK folder"));
QString dir;
QString filter;
if (Utils::HostOsInfo::isWindowsHost()) {
dir = QDir::homePath() + QLatin1String("/ant.bat");
filter = QLatin1String("ant (ant.bat)");
} else if (Utils::HostOsInfo::isMacHost()) {
// work around QTBUG-7739 that prohibits filters that don't start with *
dir = QLatin1String("/usr/bin/ant");
filter = QLatin1String("ant (*ant)");
} else {
dir = QLatin1String("/usr/bin/ant");
filter = QLatin1String("ant (ant)");
}
m_ui->AntLocationPathChooser->setFileName(m_androidConfig.antLocation());
m_ui->AntLocationPathChooser->setExpectedKind(Utils::PathChooser::Command);
m_ui->AntLocationPathChooser->setPromptDialogTitle(tr("Select ant Script"));
m_ui->AntLocationPathChooser->setInitialBrowsePathBackup(dir);
m_ui->AntLocationPathChooser->setPromptDialogFilter(filter);
updateGradleBuildUi();
m_ui->OpenJDKLocationPathChooser->setFileName(m_androidConfig.openJDKLocation());
m_ui->OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path"));
m_ui->DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize());
......@@ -173,7 +150,6 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
m_ui->AVDTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
m_ui->AVDTableView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
m_ui->downloadAntToolButton->setVisible(!Utils::HostOsInfo::isLinuxHost());
m_ui->downloadOpenJDKToolButton->setVisible(!Utils::HostOsInfo::isLinuxHost());
const QPixmap warningPixmap = Utils::Icons::WARNING.pixmap();
......@@ -201,8 +177,6 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
this, &AndroidSettingsWidget::ndkLocationEditingFinished);
connect(m_ui->SDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
this, &AndroidSettingsWidget::sdkLocationEditingFinished);
connect(m_ui->AntLocationPathChooser, &Utils::PathChooser::rawPathChanged,
this, &AndroidSettingsWidget::antLocationEditingFinished);
connect(m_ui->OpenJDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
this, &AndroidSettingsWidget::openJDKLocationEditingFinished);
connect(m_ui->AVDAddPushButton, &QAbstractButton::clicked,
......@@ -225,13 +199,8 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
this, &AndroidSettingsWidget::openSDKDownloadUrl);
connect(m_ui->downloadNDKToolButton, &QAbstractButton::clicked,
this, &AndroidSettingsWidget::openNDKDownloadUrl);
connect(m_ui->downloadAntToolButton, &QAbstractButton::clicked,
this, &AndroidSettingsWidget::openAntDownloadUrl);
connect(m_ui->downloadOpenJDKToolButton, &QAbstractButton::clicked,
this, &AndroidSettingsWidget::openOpenJDKDownloadUrl);
connect(m_ui->UseGradleCheckBox, &QAbstractButton::toggled,
this, &AndroidSettingsWidget::useGradleToggled);
}
AndroidSettingsWidget::~AndroidSettingsWidget()
......@@ -473,13 +442,6 @@ void AndroidSettingsWidget::updateAvds()
enableAvdControls();
}
void AndroidSettingsWidget::updateGradleBuildUi()
{
m_ui->UseGradleCheckBox->setEnabled(m_androidConfig.antScriptsAvailable());
m_ui->UseGradleCheckBox->setChecked(!m_androidConfig.antScriptsAvailable() ||
m_androidConfig.useGrandle());
}
bool AndroidSettingsWidget::verifySdkInstallation(QString *errorDetails) const
{
if (m_androidConfig.sdkLocation().isEmpty()) {
......@@ -522,7 +484,6 @@ void AndroidSettingsWidget::saveSettings()
{
sdkLocationEditingFinished();
ndkLocationEditingFinished();
antLocationEditingFinished();
openJDKLocationEditingFinished();
dataPartitionSizeEditingFinished();
AndroidConfigurations::setConfig(m_androidConfig);
......@@ -531,13 +492,8 @@ void AndroidSettingsWidget::saveSettings()
void AndroidSettingsWidget::sdkLocationEditingFinished()
{
m_androidConfig.setSdkLocation(Utils::FileName::fromUserInput(m_ui->SDKLocationPathChooser->rawPath()));
updateGradleBuildUi();
check(Sdk);
if (m_sdkState == Okay)
searchForAnt(m_androidConfig.sdkLocation());
applyToUi(Sdk);
}
......@@ -546,41 +502,9 @@ void AndroidSettingsWidget::ndkLocationEditingFinished()
m_androidConfig.setNdkLocation(Utils::FileName::fromUserInput(m_ui->NDKLocationPathChooser->rawPath()));
check(Ndk);
if (m_ndkState == Okay)
searchForAnt(m_androidConfig.ndkLocation());
applyToUi(Ndk);
}
void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location)
{
if (!m_androidConfig.antLocation().isEmpty())
return;
if (location.isEmpty())
return;
QDir parentFolder = location.toFileInfo().absoluteDir();
foreach (const QString &file, parentFolder.entryList()) {
if (file.startsWith(QLatin1String("apache-ant"))) {
Utils::FileName ant = Utils::FileName::fromString(parentFolder.absolutePath());
ant.appendPath(file).appendPath(QLatin1String("bin"));
if (Utils::HostOsInfo::isWindowsHost())
ant.appendPath(QLatin1String("ant.bat"));
else
ant.appendPath(QLatin1String("ant"));
if (ant.exists()) {
m_androidConfig.setAntLocation(ant);
m_ui->AntLocationPathChooser->setFileName(ant);
}
}
}
}
void AndroidSettingsWidget::antLocationEditingFinished()
{
m_androidConfig.setAntLocation(Utils::FileName::fromUserInput(m_ui->AntLocationPathChooser->rawPath()));
}
void AndroidSettingsWidget::openJDKLocationEditingFinished()
{
m_androidConfig.setOpenJDKLocation(Utils::FileName::fromUserInput(m_ui->OpenJDKLocationPathChooser->rawPath()));
......@@ -599,11 +523,6 @@ void AndroidSettingsWidget::openNDKDownloadUrl()
QDesktopServices::openUrl(QUrl::fromUserInput("https://developer.android.com/ndk/downloads/"));