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: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
Vikas Pachdha
2017-09-08 23:36:13 +02:00
parent f4a8f52b0d
commit 027383814a
16 changed files with 305 additions and 657 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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>

View File

@@ -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();

View File

@@ -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;

View File

@@ -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.

View File

@@ -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());

View File

@@ -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);
};

View File

@@ -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

View File

@@ -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/"));
}
void AndroidSettingsWidget::openAntDownloadUrl()
{
QDesktopServices::openUrl(QUrl::fromUserInput("http://ant.apache.org/bindownload.cgi"));
}
void AndroidSettingsWidget::openOpenJDKDownloadUrl()
{
QDesktopServices::openUrl(QUrl::fromUserInput("http://www.oracle.com/technetwork/java/javase/downloads/"));
@@ -672,11 +591,6 @@ void AndroidSettingsWidget::createKitToggled()
m_androidConfig.setAutomaticKitCreation(m_ui->CreateKitCheckBox->isChecked());
}
void AndroidSettingsWidget::useGradleToggled()
{
m_androidConfig.setUseGradle(m_ui->UseGradleCheckBox->isChecked());
}
void AndroidSettingsWidget::checkGdbFinished()
{
QPair<QStringList, bool> result = m_checkGdbWatcher.future().result();

View File

@@ -75,12 +75,9 @@ public:
private:
void sdkLocationEditingFinished();
void ndkLocationEditingFinished();
void searchForAnt(const Utils::FileName &location);
void antLocationEditingFinished();
void openJDKLocationEditingFinished();
void openSDKDownloadUrl();
void openNDKDownloadUrl();
void openAntDownloadUrl();
void openOpenJDKDownloadUrl();
void addAVD();
void avdAdded();
@@ -90,12 +87,10 @@ private:
void dataPartitionSizeEditingFinished();
void manageAVD();
void createKitToggled();
void useGradleToggled();
void checkGdbFinished();
void showGdbWarningDialog();
void updateAvds();
void updateGradleBuildUi();
private:
enum Mode { Sdk = 1, Ndk = 2, Java = 4, All = Sdk | Ndk | Java };

View File

@@ -14,376 +14,16 @@
<string>Android Configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="OpenJDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>JDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="OpenJDKLocationPathChooser" native="true"/>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="jdkWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="jdkWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="downloadOpenJDKToolButton">
<property name="toolTip">
<string>Download JDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="SDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Android SDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<item row="4" column="1">
<widget class="Utils::PathChooser" name="NDKLocationPathChooser" native="true"/>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="SDKLocationPathChooser" native="true"/>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="downloadSDKToolButton">
<property name="toolTip">
<string>Download Android SDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="OpenJDKLocationPathChooser" native="true"/>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="sdkWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sdkWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="NDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Android NDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Utils::PathChooser" name="NDKLocationPathChooser" native="true"/>
</item>
<item row="4" column="2">
<widget class="QToolButton" name="downloadNDKToolButton">
<property name="toolTip">
<string>Download Android NDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="gdbWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gdbWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;a href=&quot;xx&quot;&gt;The GDB in the NDK appears to have broken python support.&lt;/a&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="ndkWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolchainFoundLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="CreateKitCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Automatically create kits for Android tool chains</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="kitWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="kitWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="10" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>4</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="UseGradleCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Use Gradle instead of Ant (Ant builds are deprecated)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<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>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="11" column="0">
<widget class="QLabel" name="AntLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Ant executable:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="Utils::PathChooser" name="AntLocationPathChooser" native="true"/>
</item>
<item row="11" column="2">
<widget class="QToolButton" name="downloadAntToolButton">
<property name="toolTip">
<string>Download Ant</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="12" column="0" colspan="2">
<item row="10" column="0" colspan="2">
<widget class="QFrame" name="AVDManagerFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@@ -502,6 +142,281 @@
</layout>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="jdkWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="jdkWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="2">
<widget class="QToolButton" name="downloadNDKToolButton">
<property name="toolTip">
<string>Download Android NDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="sdkWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sdkWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="OpenJDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>JDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="ndkWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolchainFoundLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="NDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Android NDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="downloadSDKToolButton">
<property name="toolTip">
<string>Download Android SDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="CreateKitCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Automatically create kits for Android tool chains</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="kitWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="kitWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="gdbWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gdbWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;a href=&quot;xx&quot;&gt;The GDB in the NDK appears to have broken python support.&lt;/a&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="downloadOpenJDKToolButton">
<property name="toolTip">
<string>Download JDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="SDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Android SDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View File

@@ -88,12 +88,8 @@ bool AndroidPackageInstallationStep::init(QList<const BuildStep *> &earlierSteps
m_androidDirsToClean.clear();
// don't remove gradle's cache, it takes ages to rebuild it.
if (!QFile::exists(dirPath + "/build.xml") && Android::AndroidManager::useGradle(target())) {
m_androidDirsToClean << dirPath + "/assets";
m_androidDirsToClean << dirPath + "/libs";
} else {
m_androidDirsToClean << dirPath;
}
m_androidDirsToClean << dirPath + "/assets";
m_androidDirsToClean << dirPath + "/libs";
return AbstractProcessStep::init(earlierSteps);
}

View File

@@ -172,11 +172,7 @@ bool QmakeAndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
if (m_verbose)
arguments << "--verbose";
if (m_useGradle)
arguments << "--gradle";
else
arguments << "--ant" << AndroidConfigurations::currentConfig().antToolPath().toString();
arguments << "--gradle";
QStringList argumentsPasswordConcealed = arguments;