forked from qt-creator/qt-creator
Android: Automatically download SDK tools and essential packages
Automatically download Android SDK Tools to default path used by Android Studio, then essential packages will be installed using the sdkmanager tool. Automatic installation can also be triggered by an added button in the settings page. Essentials packages include NDK Bundle and other NDK versions required by previous Qt versions. An sdk_definitions.json file holds download paths for SDK Tools, and other (Qt version <-> essential packages) combinations. [ChangeLog][Android] Automatically download SDK Tools, NDKs and all essential packages for Android builds. Task-number: QTCREATORBUG-23285 Change-Id: I90e7aafecd017d2bdc959e403711d9d440a6bbb2 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -46,6 +46,10 @@
|
||||
# include "androidqbspropertyprovider.h"
|
||||
#endif
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
@@ -60,6 +64,8 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Constants;
|
||||
|
||||
const char kSetupAndroidSetting[] = "ConfigureAndroid";
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
@@ -153,6 +159,10 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
|
||||
|
||||
d = new AndroidPluginPrivate;
|
||||
|
||||
if (!AndroidConfigurations::currentConfig().sdkFullyConfigured()) {
|
||||
connect(Core::ICore::instance(), &Core::ICore::coreOpened, this,
|
||||
&AndroidPlugin::askUserAboutAndroidSetup, Qt::QueuedConnection);
|
||||
}
|
||||
connect(KitManager::instance(), &KitManager::kitsLoaded,
|
||||
this, &AndroidPlugin::kitsRestored);
|
||||
|
||||
@@ -168,5 +178,25 @@ void AndroidPlugin::kitsRestored()
|
||||
this, &AndroidPlugin::kitsRestored);
|
||||
}
|
||||
|
||||
void AndroidPlugin::askUserAboutAndroidSetup()
|
||||
{
|
||||
if (!Utils::CheckableMessageBox::shouldAskAgain(Core::ICore::settings(), kSetupAndroidSetting)
|
||||
|| !Core::ICore::infoBar()->canInfoBeAdded(kSetupAndroidSetting))
|
||||
return;
|
||||
|
||||
Core::InfoBarEntry info(
|
||||
kSetupAndroidSetting,
|
||||
tr("Would you like to configure Android options? This will ensure "
|
||||
"Android kits can be usable and all essential packages are installed. "
|
||||
"To do it later, select Options > Devices > Android."),
|
||||
Core::InfoBarEntry::GlobalSuppression::Enabled);
|
||||
info.setCustomButtonInfo(tr("Configure Android"), [this] {
|
||||
Core::ICore::infoBar()->removeInfo(kSetupAndroidSetting);
|
||||
Core::ICore::infoBar()->globallySuppressInfo(kSetupAndroidSetting);
|
||||
QTimer::singleShot(0, this, [this]() { d->potentialKit.executeFromMenu(); });
|
||||
});
|
||||
Core::ICore::infoBar()->addInfo(info);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
Reference in New Issue
Block a user