Android: Allow adding OpenSSL libs directly from project settings

This serves as a convenience addition to allow users to directly
include OpenSSL prebuilt libs for Android. The path of the OpenSSL
would be defined once in the Android options page, and always used
to include the libs when needed by the user.

How this works:
1- A download button is provided, it first tries to automatically
git clone the OpenSSL repo to the defined path. If the cloning fails,
the repo URL is opened externally for maunual download.

2- If SDK tools auto download is used (like for first time setup),
the OpenSSL download will start after SDK eseentials are installed.

3- Once the libs path is set, it can be used by AndroidBuildApkWidget
to include() function to the project (qmake/cmake). It also, should
detect if the include() part already exists in the project file.

Task-number: QTBUG-80625
Change-Id: I338e916f03f4ff55db25a118f1ea08f1da5dd103
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Assam Boudjelthia
2020-02-28 19:27:03 +02:00
parent 810538c281
commit be8cdeafd6
6 changed files with 255 additions and 8 deletions

View File

@@ -104,6 +104,7 @@ namespace {
const QLatin1String SdkFullyConfiguredKey("AllEssentialsInstalled");
const QLatin1String SDKManagerToolArgsKey("SDKManagerToolArgs");
const QLatin1String OpenJDKLocationKey("OpenJDKLocation");
const QLatin1String OpenSslPriLocationKey("OpenSSLPriLocation");
const QLatin1String KeystoreLocationKey("KeystoreLocation");
const QLatin1String AutomaticKitCreationKey("AutomatiKitCreation");
const QLatin1String PartitionSizeKey("PartitionSize");
@@ -239,6 +240,7 @@ void AndroidConfig::load(const QSettings &settings)
m_customNdkList = settings.value(CustomNdkLocationsKey).toStringList();
m_sdkManagerToolArgs = settings.value(SDKManagerToolArgsKey).toStringList();
m_openJDKLocation = FilePath::fromString(settings.value(OpenJDKLocationKey).toString());
m_openSslLocation = FilePath::fromString(settings.value(OpenSslPriLocationKey).toString());
m_keystoreLocation = FilePath::fromString(settings.value(KeystoreLocationKey).toString());
m_automaticKitCreation = settings.value(AutomaticKitCreationKey, true).toBool();
m_sdkFullyConfigured = settings.value(SdkFullyConfiguredKey, false).toBool();
@@ -251,6 +253,7 @@ void AndroidConfig::load(const QSettings &settings)
m_customNdkList = reader.restoreValue(CustomNdkLocationsKey).toStringList();
m_sdkManagerToolArgs = reader.restoreValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs).toStringList();
m_openJDKLocation = FilePath::fromString(reader.restoreValue(OpenJDKLocationKey, m_openJDKLocation.toString()).toString());
m_openSslLocation = FilePath::fromString(reader.restoreValue(OpenSslPriLocationKey, m_openSslLocation.toString()).toString());
m_automaticKitCreation = reader.restoreValue(AutomaticKitCreationKey, m_automaticKitCreation).toBool();
m_sdkFullyConfigured = reader.restoreValue(SdkFullyConfiguredKey, m_sdkFullyConfigured).toBool();
// persistent settings
@@ -271,6 +274,7 @@ void AndroidConfig::save(QSettings &settings) const
settings.setValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs);
settings.setValue(OpenJDKLocationKey, m_openJDKLocation.toString());
settings.setValue(KeystoreLocationKey, m_keystoreLocation.toString());
settings.setValue(OpenSslPriLocationKey, m_openSslLocation.toString());
settings.setValue(PartitionSizeKey, m_partitionSize);
settings.setValue(AutomaticKitCreationKey, m_automaticKitCreation);
settings.setValue(SdkFullyConfiguredKey, m_sdkFullyConfigured);
@@ -374,6 +378,16 @@ void AndroidConfig::removeCustomNdk(const QString &customNdk)
m_customNdkList.removeAll(customNdk);
}
Utils::FilePath AndroidConfig::openSslLocation() const
{
return m_openSslLocation;
}
void AndroidConfig::setOpenSslLocation(const Utils::FilePath &openSslLocation)
{
m_openSslLocation = openSslLocation;
}
QStringList AndroidConfig::apiLevelNamesFor(const SdkPlatformList &platforms)
{
return Utils::transform(platforms, AndroidConfig::apiLevelNameFor);