forked from qt-creator/qt-creator
Android: Force Gradle build post SDK tools version 25.3.0
Task-number: QTCREATORBUG-18013 Change-Id: Ic912427783d079f5f6bf06e3bf9a44657d24a96f Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
@@ -60,6 +60,8 @@
|
|||||||
namespace Android {
|
namespace Android {
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
|
const QVersionNumber gradleScriptRevokedSdkVersion(25, 3, 0);
|
||||||
|
const QVersionNumber gradleScriptsContainedQtVersion(5, 9, 0);
|
||||||
const QLatin1String DeployActionKey("Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction");
|
const QLatin1String DeployActionKey("Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction");
|
||||||
const QLatin1String KeystoreLocationKey("KeystoreLocation");
|
const QLatin1String KeystoreLocationKey("KeystoreLocation");
|
||||||
const QLatin1String BuildTargetSdkKey("BuildTargetSdk");
|
const QLatin1String BuildTargetSdkKey("BuildTargetSdk");
|
||||||
@@ -140,6 +142,15 @@ bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
if (!version)
|
if (!version)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (AndroidConfigurations::currentConfig().sdkToolsVersion() >= gradleScriptRevokedSdkVersion &&
|
||||||
|
QVersionNumber::fromString(version->qtVersionString()) < gradleScriptsContainedQtVersion) {
|
||||||
|
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(gradleScriptRevokedSdkVersion.toString())
|
||||||
|
.arg(gradleScriptsContainedQtVersion.toString()), OutputFormat::Stderr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int minSDKForKit = AndroidManager::minimumSDK(target()->kit());
|
int minSDKForKit = AndroidManager::minimumSDK(target()->kit());
|
||||||
if (AndroidManager::minimumSDK(target()) < minSDKForKit) {
|
if (AndroidManager::minimumSDK(target()) < minSDKForKit) {
|
||||||
emit addOutput(tr("The API level set for the APK is less than the minimum required by the kit."
|
emit addOutput(tr("The API level set for the APK is less than the minimum required by the kit."
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ protected:
|
|||||||
AndroidDeployAction m_deployAction = BundleLibrariesDeployment;
|
AndroidDeployAction m_deployAction = BundleLibrariesDeployment;
|
||||||
bool m_signPackage = false;
|
bool m_signPackage = false;
|
||||||
bool m_verbose = false;
|
bool m_verbose = false;
|
||||||
bool m_useGradle = false;
|
bool m_useGradle = true; // Ant builds are deprecated.
|
||||||
bool m_openPackageLocation = false;
|
bool m_openPackageLocation = false;
|
||||||
bool m_openPackageLocationForRun = false;
|
bool m_openPackageLocationForRun = false;
|
||||||
bool m_addDebugger = true;
|
bool m_addDebugger = true;
|
||||||
|
|||||||
@@ -54,9 +54,12 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
m_ui->deprecatedInfoIconLabel->setPixmap(Utils::Icons::INFO.pixmap());
|
||||||
|
|
||||||
// Target sdk combobox
|
// Target sdk combobox
|
||||||
int minApiLevel = 9;
|
int minApiLevel = 9;
|
||||||
QStringList targets = AndroidConfig::apiLevelNamesFor(AndroidConfigurations::currentConfig().sdkTargets(minApiLevel));
|
const AndroidConfig &config = AndroidConfigurations::currentConfig();
|
||||||
|
QStringList targets = AndroidConfig::apiLevelNamesFor(config.sdkTargets(minApiLevel));
|
||||||
targets.removeDuplicates();
|
targets.removeDuplicates();
|
||||||
m_ui->targetSDKComboBox->addItems(targets);
|
m_ui->targetSDKComboBox->addItems(targets);
|
||||||
m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(AndroidManager::buildTargetSDK(step->target())));
|
m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(AndroidManager::buildTargetSDK(step->target())));
|
||||||
@@ -91,7 +94,9 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
|
|||||||
m_ui->signingDebugDeployErrorIcon->setPixmap(Utils::Icons::CRITICAL.pixmap());
|
m_ui->signingDebugDeployErrorIcon->setPixmap(Utils::Icons::CRITICAL.pixmap());
|
||||||
signPackageCheckBoxToggled(m_step->signPackage());
|
signPackageCheckBoxToggled(m_step->signPackage());
|
||||||
|
|
||||||
m_ui->useGradleCheckBox->setChecked(m_step->useGradle());
|
m_ui->useGradleCheckBox->setEnabled(config.antScriptsAvailable());
|
||||||
|
m_ui->useGradleCheckBox->setChecked(!config.antScriptsAvailable() ||
|
||||||
|
m_step->useGradle());
|
||||||
m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput());
|
m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput());
|
||||||
m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation());
|
m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation());
|
||||||
m_ui->addDebuggerCheckBox->setChecked(m_step->addDebugger());
|
m_ui->addDebuggerCheckBox->setChecked(m_step->addDebugger());
|
||||||
|
|||||||
@@ -176,28 +176,66 @@ Deploying local Qt libraries is incompatible with Android 5.</string>
|
|||||||
<string>Advanced Actions</string>
|
<string>Advanced Actions</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="2" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="verboseOutputCheckBox">
|
<widget class="QCheckBox" name="useGradleCheckBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Verbose output</string>
|
<string>Use Gradle (Ant builds are deprecated)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<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">
|
||||||
<widget class="QCheckBox" name="openPackageLocationCheckBox">
|
<widget class="QCheckBox" name="openPackageLocationCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Open package location after build</string>
|
<string>Open package location after build</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="2" column="0" colspan="3">
|
||||||
<widget class="QCheckBox" name="useGradleCheckBox">
|
<widget class="QCheckBox" name="verboseOutputCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use Gradle</string>
|
<string>Verbose output</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0" colspan="3">
|
||||||
<widget class="QCheckBox" name="addDebuggerCheckBox">
|
<widget class="QCheckBox" name="addDebuggerCheckBox">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ namespace Android {
|
|||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
const QVersionNumber sdkToolsAntMissingVersion(25, 3, 0);
|
||||||
|
|
||||||
const QLatin1String SettingsGroup("AndroidConfigurations");
|
const QLatin1String SettingsGroup("AndroidConfigurations");
|
||||||
const QLatin1String SDKLocationKey("SDKLocation");
|
const QLatin1String SDKLocationKey("SDKLocation");
|
||||||
const QLatin1String NDKLocationKey("NDKLocation");
|
const QLatin1String NDKLocationKey("NDKLocation");
|
||||||
@@ -823,10 +826,19 @@ void AndroidConfig::setAutomaticKitCreation(bool b)
|
|||||||
m_automaticKitCreation = b;
|
m_automaticKitCreation = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AndroidConfig::antScriptsAvailable() const
|
||||||
|
{
|
||||||
|
return sdkToolsVersion() < sdkToolsAntMissingVersion;
|
||||||
|
}
|
||||||
|
|
||||||
bool AndroidConfig::useGrandle() const
|
bool AndroidConfig::useGrandle() const
|
||||||
{
|
{
|
||||||
|
if (antScriptsAvailable()) {
|
||||||
return m_useGradle;
|
return m_useGradle;
|
||||||
}
|
}
|
||||||
|
// Force gradle builds.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void AndroidConfig::setUseGradle(bool b)
|
void AndroidConfig::setUseGradle(bool b)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ public:
|
|||||||
bool automaticKitCreation() const;
|
bool automaticKitCreation() const;
|
||||||
void setAutomaticKitCreation(bool b);
|
void setAutomaticKitCreation(bool b);
|
||||||
|
|
||||||
|
bool antScriptsAvailable() const;
|
||||||
|
|
||||||
bool useGrandle() const;
|
bool useGrandle() const;
|
||||||
void setUseGradle(bool b);
|
void setUseGradle(bool b);
|
||||||
|
|
||||||
@@ -205,7 +207,7 @@ private:
|
|||||||
QStringList m_makeExtraSearchDirectories;
|
QStringList m_makeExtraSearchDirectories;
|
||||||
unsigned m_partitionSize = 1024;
|
unsigned m_partitionSize = 1024;
|
||||||
bool m_automaticKitCreation = true;
|
bool m_automaticKitCreation = true;
|
||||||
bool m_useGradle = false;
|
bool m_useGradle = true; // Ant builds are deprecated.
|
||||||
|
|
||||||
//caches
|
//caches
|
||||||
mutable bool m_availableSdkPlatformsUpToDate = false;
|
mutable bool m_availableSdkPlatformsUpToDate = false;
|
||||||
|
|||||||
@@ -134,6 +134,8 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
m_ui->deprecatedInfoIconLabel->setPixmap(Utils::Icons::INFO.pixmap());
|
||||||
|
|
||||||
connect(&m_checkGdbWatcher, &QFutureWatcherBase::finished,
|
connect(&m_checkGdbWatcher, &QFutureWatcherBase::finished,
|
||||||
this, &AndroidSettingsWidget::checkGdbFinished);
|
this, &AndroidSettingsWidget::checkGdbFinished);
|
||||||
|
|
||||||
@@ -160,7 +162,8 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
|
|||||||
m_ui->AntLocationPathChooser->setPromptDialogTitle(tr("Select ant Script"));
|
m_ui->AntLocationPathChooser->setPromptDialogTitle(tr("Select ant Script"));
|
||||||
m_ui->AntLocationPathChooser->setInitialBrowsePathBackup(dir);
|
m_ui->AntLocationPathChooser->setInitialBrowsePathBackup(dir);
|
||||||
m_ui->AntLocationPathChooser->setPromptDialogFilter(filter);
|
m_ui->AntLocationPathChooser->setPromptDialogFilter(filter);
|
||||||
m_ui->UseGradleCheckBox->setChecked(m_androidConfig.useGrandle());
|
|
||||||
|
updateGradleBuildUi();
|
||||||
|
|
||||||
m_ui->OpenJDKLocationPathChooser->setFileName(m_androidConfig.openJDKLocation());
|
m_ui->OpenJDKLocationPathChooser->setFileName(m_androidConfig.openJDKLocation());
|
||||||
m_ui->OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path"));
|
m_ui->OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path"));
|
||||||
@@ -478,6 +481,13 @@ void AndroidSettingsWidget::updateAvds()
|
|||||||
enableAvdControls();
|
enableAvdControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AndroidSettingsWidget::updateGradleBuildUi()
|
||||||
|
{
|
||||||
|
m_ui->UseGradleCheckBox->setEnabled(m_androidConfig.antScriptsAvailable());
|
||||||
|
m_ui->UseGradleCheckBox->setChecked(!m_androidConfig.antScriptsAvailable() ||
|
||||||
|
m_androidConfig.useGrandle());
|
||||||
|
}
|
||||||
|
|
||||||
bool AndroidSettingsWidget::sdkLocationIsValid() const
|
bool AndroidSettingsWidget::sdkLocationIsValid() const
|
||||||
{
|
{
|
||||||
Utils::FileName androidExe = m_androidConfig.sdkLocation();
|
Utils::FileName androidExe = m_androidConfig.sdkLocation();
|
||||||
@@ -507,6 +517,7 @@ void AndroidSettingsWidget::saveSettings()
|
|||||||
void AndroidSettingsWidget::sdkLocationEditingFinished()
|
void AndroidSettingsWidget::sdkLocationEditingFinished()
|
||||||
{
|
{
|
||||||
m_androidConfig.setSdkLocation(Utils::FileName::fromUserInput(m_ui->SDKLocationPathChooser->rawPath()));
|
m_androidConfig.setSdkLocation(Utils::FileName::fromUserInput(m_ui->SDKLocationPathChooser->rawPath()));
|
||||||
|
updateGradleBuildUi();
|
||||||
|
|
||||||
check(Sdk);
|
check(Sdk);
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ private:
|
|||||||
void checkGdbFinished();
|
void checkGdbFinished();
|
||||||
void showGdbWarningDialog();
|
void showGdbWarningDialog();
|
||||||
void updateAvds();
|
void updateAvds();
|
||||||
|
void updateGradleBuildUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Mode { Sdk = 1, Ndk = 2, Java = 4, All = Sdk | Ndk | Java };
|
enum Mode { Sdk = 1, Ndk = 2, Java = 4, All = Sdk | Ndk | Java };
|
||||||
|
|||||||
@@ -237,6 +237,14 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<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">
|
<widget class="QCheckBox" name="CreateKitCheckBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
@@ -252,6 +260,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="9" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@@ -289,18 +299,60 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<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">
|
<widget class="QCheckBox" name="UseGradleCheckBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use Gradle instead of Ant</string>
|
<string>Use Gradle instead of Ant (Ant builds are deprecated)</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="11" column="0">
|
||||||
<widget class="QLabel" name="AntLocationLabel">
|
<widget class="QLabel" name="AntLocationLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|||||||
Reference in New Issue
Block a user