Android: Introduce constant "firstQtWithAndroidDeployQt"

Replace a couple of QVersionNumber(5, 4, 0) with it.

Change-Id: Iebc39a534500992c8eb4d72d34d71fe621b8c7c0
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2024-03-21 16:08:42 +01:00
parent a2fa009b8b
commit 43f760cf3f
4 changed files with 8 additions and 5 deletions

View File

@@ -495,7 +495,7 @@ bool AndroidBuildApkStep::init()
return false;
}
if (version->qtVersion() < QVersionNumber(5, 4, 0)) {
if (version->qtVersion() < AndroidManager::firstQtWithAndroidDeployQt) {
const QString error = Tr::tr("The minimum Qt version required for Gradle build to work is %1. "
"It is recommended to install the latest Qt version.")
.arg("5.4.0");

View File

@@ -149,7 +149,7 @@ AndroidDeployQtStep::AndroidDeployQtStep(BuildStepList *parent, Id id)
m_uninstallPreviousPackage.setValue(false);
const QtSupport::QtVersion * const qt = QtSupport::QtKitAspect::qtVersion(kit());
const bool forced = qt && qt->qtVersion() < QVersionNumber(5, 4, 0);
const bool forced = qt && qt->qtVersion() < AndroidManager::firstQtWithAndroidDeployQt;
if (forced) {
m_uninstallPreviousPackage.setValue(true);
m_uninstallPreviousPackage.setEnabled(false);
@@ -277,7 +277,7 @@ bool AndroidDeployQtStep::init()
if (m_uninstallPreviousPackageRun)
m_manifestName = AndroidManager::manifestPath(target());
m_useAndroiddeployqt = version->qtVersion() >= QVersionNumber(5, 4, 0);
m_useAndroiddeployqt = version->qtVersion() >= AndroidManager::firstQtWithAndroidDeployQt;
if (m_useAndroiddeployqt) {
const QString buildKey = target()->activeBuildKey();
const ProjectNode *node = target()->project()->findNodeForBuildKey(buildKey);

View File

@@ -35,6 +35,9 @@ public:
namespace AndroidManager
{
// With Qt 5.4, a couple of android tooling features moved over from Qt Creator to Qt.
constexpr auto firstQtWithAndroidDeployQt = {5, 4, 0};
QString packageName(const ProjectExplorer::Target *target);
QString packageName(const Utils::FilePath &manifestFile);
QString activityName(const ProjectExplorer::Target *target);

View File

@@ -228,7 +228,7 @@ CreateAndroidManifestWizard::CreateAndroidManifestWizard(BuildSystem *buildSyste
const QList<BuildTargetInfo> buildTargets = buildSystem->applicationTargets();
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(buildSystem->kit());
m_copyGradle = version && version->qtVersion() >= QVersionNumber(5, 4, 0);
m_copyGradle = version && version->qtVersion() >= AndroidManager::firstQtWithAndroidDeployQt;
if (buildTargets.isEmpty()) {
// oh uhm can't create anything
@@ -277,7 +277,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(target->kit());
if (!version)
return;
if (version->qtVersion() < QVersionNumber(5, 4, 0)) {
if (version->qtVersion() < AndroidManager::firstQtWithAndroidDeployQt) {
FileUtils::copyRecursively(version->prefix() / "src/android/java/AndroidManifest.xml",
m_directory / "AndroidManifest.xml",
nullptr,