QmakeAndroidSupport: Remove plugin

The remaining dependency is hacked into QmakeProjectManager
by using a compile time-only dependency on androidconstants.h.

Change-Id: Id78125137bc75c145a072bc753276abbf0029647
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
hjk
2018-12-05 13:00:36 +01:00
parent a2d5ebccd2
commit d52af48883
18 changed files with 55 additions and 329 deletions

View File

@@ -76,8 +76,6 @@ Q_LOGGING_CATEGORY(buildapkstepLog, "qtc.android.build.androidbuildapkstep", QtW
namespace Android {
const Core::Id ANDROID_BUILD_APK_ID("QmakeProjectManager.AndroidBuildApkStep");
const QVersionNumber gradleScriptRevokedSdkVersion(25, 3, 0);
const char KeystoreLocationKey[] = "KeystoreLocation";
const char BuildTargetSdkKey[] = "BuildTargetSdk";
@@ -126,7 +124,7 @@ private:
};
AndroidBuildApkStep::AndroidBuildApkStep(BuildStepList *parent)
: AbstractProcessStep(parent, ANDROID_BUILD_APK_ID),
: AbstractProcessStep(parent, Constants::ANDROID_BUILD_APK_ID),
m_buildTargetSdk(AndroidConfig::apiLevelNameFor(AndroidConfigurations::
sdkManager()->latestAndroidSdkPlatform()))
{
@@ -559,7 +557,7 @@ namespace Internal {
AndroidBuildApkStepFactory::AndroidBuildApkStepFactory()
{
registerStep<AndroidBuildApkStep>(ANDROID_BUILD_APK_ID);
registerStep<AndroidBuildApkStep>(Constants::ANDROID_BUILD_APK_ID);
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);

View File

@@ -73,6 +73,7 @@ const char ANDROID_EXTRA_LIBS[] = "AndroidExtraLibs";
const char ANDROID_PACKAGENAME[] = "Android.PackageName";
const char ANDROID_PACKAGE_INSTALLATION_STEP_ID[] = "Qt4ProjectManager.AndroidPackageInstallationStep";
const char ANDROID_BUILD_APK_ID[] = "QmakeProjectManager.AndroidBuildApkStep";
const char AndroidPackageSourceDir[] = "AndroidPackageSourceDir"; // QString
const char AndroidDeploySettingsFile[] = "AndroidDeploySettingsFile"; // QString

View File

@@ -186,7 +186,8 @@ void AndroidDebugSupport::start()
gdbServer.setPort(m_runner->gdbServerPort().number());
setRemoteChannel(gdbServer);
int sdkVersion = qMax(AndroidManager::minimumSDK(target), AndroidManager::minimumNDK(target));
int sdkVersion = qMax(AndroidManager::minimumSDK(target->kit()),
AndroidManager::minimumNDK(target->kit()));
Utils::FileName sysRoot = AndroidConfigurations::currentConfig().ndkLocation()
.appendPath("platforms")
.appendPath(QString("android-%1").arg(sdkVersion))

View File

@@ -247,10 +247,9 @@ int AndroidManager::minimumSDK(const ProjectExplorer::Kit *kit)
return minSDKVersion;
}
int AndroidManager::minimumNDK(ProjectExplorer::Target *target)
int AndroidManager::minimumNDK(const Kit *kit)
{
auto qt = static_cast<Android::Internal::AndroidQtVersion *>(
QtSupport::QtKitInformation::qtVersion(target->kit()));
auto qt = static_cast<AndroidQtVersion *>(QtSupport::QtKitInformation::qtVersion(kit));
return qt->mininmumNDK();
}

View File

@@ -89,7 +89,7 @@ public:
static int minimumSDK(ProjectExplorer::Target *target);
static int minimumSDK(const ProjectExplorer::Kit *kit);
static int minimumNDK(ProjectExplorer::Target *target);
static int minimumNDK(const ProjectExplorer::Kit *kit);
static QString targetArch(ProjectExplorer::Target *target);

View File

@@ -50,8 +50,11 @@
#endif
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtversionmanager.h>
@@ -77,9 +80,37 @@ public:
}
};
class AndroidPluginPrivate
class AndroidPluginPrivate : public QObject
{
public:
AndroidPluginPrivate()
{
connect(SessionManager::instance(), &SessionManager::projectAdded, this, [=](Project *project) {
for (Target *target : project->targets())
handleNewTarget(target);
connect(project, &Project::addedTarget, this, &AndroidPluginPrivate::handleNewTarget);
});
}
void handleNewTarget(Target *target)
{
if (DeviceTypeKitInformation::deviceTypeId(target->kit()) != Android::Constants::ANDROID_DEVICE_TYPE)
return;
for (BuildConfiguration *bc : target->buildConfigurations())
handleNewBuildConfiguration(bc);
connect(target, &Target::addedBuildConfiguration,
this, &AndroidPluginPrivate::handleNewBuildConfiguration);
}
void handleNewBuildConfiguration(BuildConfiguration *bc)
{
connect(bc->target()->project(), &Project::parsingFinished, bc, [bc] {
AndroidManager::updateGradleProperties(bc->target());
});
}
AndroidConfigurations androidConfiguration;
AndroidSettingsPage settingsPage;
AndroidDeployQtStepFactory deployQtStepFactory;

View File

@@ -98,10 +98,12 @@ QList<Abi> AndroidQtVersion::detectQtAbis() const
void AndroidQtVersion::addToEnvironment(const Kit *k, Utils::Environment &env) const
{
Q_UNUSED(k);
const AndroidConfig &config =AndroidConfigurations::currentConfig();
// this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info)
env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::currentConfig().toolchainHost());
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::currentConfig().ndkLocation().toUserOutput());
env.set(QLatin1String("ANDROID_NDK_HOST"), config.toolchainHost());
env.set(QLatin1String("ANDROID_NDK_ROOT"), config.ndkLocation().toUserOutput());
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
config.bestNdkPlatformMatch(qMax(AndroidManager::minimumNDK(k), AndroidManager::minimumSDK(k))));
}
Utils::Environment AndroidQtVersion::qmakeRunEnvironment() const

View File

@@ -51,7 +51,6 @@ SUBDIRS = \
ios \
beautifier \
modeleditor \
qmakeandroidsupport \
winrt \
updateinfo \
scxmleditor \

View File

@@ -51,7 +51,6 @@ Project {
"perfprofiler/perfprofiler.qbs",
"projectexplorer/projectexplorer.qbs",
"qbsprojectmanager/qbsprojectmanager.qbs",
"qmakeandroidsupport",
"pythoneditor/pythoneditor.qbs",
"qmldesigner/qmldesigner.qbs",
"qmljseditor/qmljseditor.qbs",

View File

@@ -1,20 +0,0 @@
{
\"Name\" : \"QmakeAndroidSupport\",
\"Version\" : \"$$QTCREATOR_VERSION\",
\"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
\"HiddenByDefault\" : true,
\"Vendor\" : \"The Qt Company Ltd\",
\"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\",
\"License\" : [ \"Commercial Usage\",
\"\",
\"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\",
\"\",
\"GNU General Public License Usage\",
\"\",
\"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\"
],
\"Category\" : \"Build Systems\",
\"Description\" : \"Android support for qmake project manager.\",
\"Url\" : \"http://www.qt.io\",
$$dependencyList
}

View File

@@ -1,86 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "androidqmakebuildconfigurationfactory.h"
#include <android/androidbuildapkstep.h>
#include <android/androidconfigurations.h>
#include <android/androidconstants.h>
#include <android/androidmanager.h>
#include <android/androidpackageinstallationstep.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
using namespace Android;
using namespace ProjectExplorer;
namespace QmakeAndroidSupport {
namespace Internal {
// AndroidQmakeBuildConfigurationFactory
AndroidQmakeBuildConfigurationFactory::AndroidQmakeBuildConfigurationFactory()
{
registerBuildConfiguration<AndroidQmakeBuildConfiguration>(QmakeProjectManager::Constants::QMAKE_BC_ID);
setSupportedTargetDeviceTypes({Android::Constants::ANDROID_DEVICE_TYPE});
setBasePriority(1);
}
// AndroidQmakeBuildConfiguration
AndroidQmakeBuildConfiguration::AndroidQmakeBuildConfiguration(Target *target, Core::Id id)
: QmakeBuildConfiguration(target, id)
{
updateCacheAndEmitEnvironmentChanged();
connect(target->project(), &Project::parsingFinished, this, [this] {
AndroidManager::updateGradleProperties(BuildConfiguration::target());
});
}
void AndroidQmakeBuildConfiguration::initialize(const BuildInfo *info)
{
QmakeBuildConfiguration::initialize(info);
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
buildSteps->appendStep(new AndroidPackageInstallationStep(buildSteps));
buildSteps->appendStep(new Android::AndroidBuildApkStep(buildSteps));
updateCacheAndEmitEnvironmentChanged();
}
void AndroidQmakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const
{
QString androidNdkPlatform = AndroidConfigurations::currentConfig().bestNdkPlatformMatch(
qMax(AndroidManager::minimumNDK(target()), AndroidManager::minimumSDK(target())));
env.set(QLatin1String("ANDROID_NDK_PLATFORM"), androidNdkPlatform);
}
} // namespace Internal
} // namespace QmakeAndroidSupport

View File

@@ -1,51 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
namespace QmakeAndroidSupport {
namespace Internal {
class AndroidQmakeBuildConfigurationFactory : public QmakeProjectManager::QmakeBuildConfigurationFactory
{
public:
AndroidQmakeBuildConfigurationFactory();
};
class AndroidQmakeBuildConfiguration : public QmakeProjectManager::QmakeBuildConfiguration
{
Q_OBJECT
public:
AndroidQmakeBuildConfiguration(ProjectExplorer::Target *target, Core::Id id);
void initialize(const ProjectExplorer::BuildInfo *info) override;
void addToEnvironment(Utils::Environment &env) const override;
};
} // namespace Internal
} // namespace QmakeAndroidSupport

View File

@@ -1,13 +0,0 @@
QT += network
include(../../qtcreatorplugin.pri)
DEFINES += \
QMAKEANDROID_LIBRARY
HEADERS += \
androidqmakebuildconfigurationfactory.h \
qmakeandroidsupportplugin.h
SOURCES += \
androidqmakebuildconfigurationfactory.cpp \
qmakeandroidsupportplugin.cpp

View File

@@ -1,24 +0,0 @@
import qbs
QtcPlugin {
name: "QmakeAndroidSupport"
Depends { name: "Android" }
Depends { name: "Core" }
Depends { name: "CppTools" }
Depends { name: "ProjectExplorer" }
Depends { name: "QmakeProjectManager" }
Depends { name: "QmlJS" }
Depends { name: "QmlJSTools" }
Depends { name: "QtSupport" }
Depends { name: "ResourceEditor" }
Depends { name: "Utils" }
Depends { name: "Qt.network" }
Depends { name: "Qt.widgets" }
files: [
"androidqmakebuildconfigurationfactory.cpp",
"androidqmakebuildconfigurationfactory.h",
"qmakeandroidsupportplugin.h",
"qmakeandroidsupportplugin.cpp",
]
}

View File

@@ -1,15 +0,0 @@
QTC_PLUGIN_NAME = QmakeAndroidSupport
QTC_LIB_DEPENDS += \
extensionsystem \
qmljs \
utils
QTC_PLUGIN_DEPENDS += \
coreplugin \
projectexplorer \
qtsupport \
texteditor \
cpptools \
qmljstools \
resourceeditor \
android \
qmakeprojectmanager

View File

@@ -1,55 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "qmakeandroidsupportplugin.h"
#include "androidqmakebuildconfigurationfactory.h"
using namespace ProjectExplorer;
namespace QmakeAndroidSupport {
namespace Internal {
class QmakeAndroidSupportPluginPrivate
{
public:
AndroidQmakeBuildConfigurationFactory buildConfigFactory;
};
QmakeAndroidSupportPlugin::~QmakeAndroidSupportPlugin()
{
delete d;
}
bool QmakeAndroidSupportPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
d = new QmakeAndroidSupportPluginPrivate;
return true;
}
} // Internal
} // QmakeAndroidSupport

View File

@@ -1,50 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <extensionsystem/iplugin.h>
namespace QmakeAndroidSupport {
namespace Internal {
class QmakeAndroidSupportPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmakeAndroidSupport.json")
public:
QmakeAndroidSupportPlugin() = default;
~QmakeAndroidSupportPlugin() final;
private:
bool initialize(const QStringList &arguments, QString *errorMessage) final;
void extensionsInitialized() final {}
class QmakeAndroidSupportPluginPrivate *d = nullptr;
};
} // namespace Internal
} // namespace QmakeAndroidSupport

View File

@@ -34,6 +34,9 @@
#include "qmakestep.h"
#include "qmakemakestep.h"
#include "makefileparse.h"
#include "qmakebuildconfiguration.h"
#include <android/androidconstants.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>
@@ -160,6 +163,13 @@ void QmakeBuildConfiguration::initialize(const BuildInfo *info)
}
setBuildDirectory(directory);
if (DeviceTypeKitInformation::deviceTypeId(target()->kit())
== Android::Constants::ANDROID_DEVICE_TYPE) {
buildSteps->appendStep(Android::Constants::ANDROID_PACKAGE_INSTALLATION_STEP_ID);
buildSteps->appendStep(Android::Constants::ANDROID_BUILD_APK_ID);
}
updateCacheAndEmitEnvironmentChanged();
}