// Copyright (C) 2019 Luxoft Sweden AB // Copyright (C) 2018 Pelagicore AG // Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "appmanagerplugin.h" #include "appmanagerconstants.h" #include "appmanagercreatepackagestep.h" #include "appmanagerdeployconfigurationautoswitcher.h" #include "appmanagerdeployconfigurationfactory.h" #include "appmanagerdeploypackagestep.h" #include "appmanagerinstallpackagestep.h" #include "appmanagerremoteinstallpackagestep.h" #include "appmanagermakeinstallstep.h" #include "appmanagercmakepackagestep.h" #include "appmanagerrunconfiguration.h" #include "appmanagerruncontrol.h" #include "appmanagerutilities.h" #include #include #include #include #include using namespace Core; using namespace ProjectExplorer; using namespace QtSupport; namespace AppManager::Internal { const char QdbLinuxOsType[] = "QdbLinuxOsType"; const char QdbLinuxEmulatorOsType[] = "QdbLinuxEmulatorOsType"; void cloneAutodetectedBoot2QtKits() { if (auto kitManager = KitManager::instance()) { QHash boot2QtKits; QHash genericLinuxDeviceKits; for (auto kit : kitManager->kits()) { if (auto qtVersion = QtKitAspect::qtVersion(kit)) { const auto deviceTypeId = DeviceTypeKitAspect::deviceTypeId(kit); if (deviceTypeId == RemoteLinux::Constants::GenericLinuxOsType) { genericLinuxDeviceKits[qtVersion] = kit; } else if (kit->isAutoDetected()) { if (deviceTypeId == QdbLinuxOsType) { boot2QtKits[qtVersion] = kit; } else if (deviceTypeId == QdbLinuxEmulatorOsType) { boot2QtKits[qtVersion] = kit; } } } } for (auto it = boot2QtKits.cbegin(); it != boot2QtKits.cend(); ++it) { if (!genericLinuxDeviceKits.contains(it.key())) { const auto copyIntoKit = [boot2QtKit = *it](Kit *k) { k->copyFrom(boot2QtKit); k->setAutoDetected(false); k->setUnexpandedDisplayName(QString("%1 for Generic Linux Devices").arg(boot2QtKit->unexpandedDisplayName())); DeviceTypeKitAspect::setDeviceTypeId(k, RemoteLinux::Constants::GenericLinuxOsType); }; if (auto genericLinuxDeviceKit = KitManager::instance()->registerKit(copyIntoKit)) { genericLinuxDeviceKit->setup(); } } } } } class AppManagerPluginPrivate { public: AppManagerCMakePackageStepFactory cmakePackageStepFactory; AppManagerMakeInstallStepFactory makeInstallStepFactory; AppManagerCreatePackageStepFactory createPackageStepFactory; AppManagerDeployPackageStepFactory deployPackageStepFactory; AppManagerInstallPackageStepFactory installPackageStepFactory; AppManagerRemoteInstallPackageStepFactory remoteInstallPackageStepFactory; AppManagerDeployConfigurationAutoSwitcher deployConfigurationAutoSwitcher; AppManagerDeployConfigurationFactory deployConfigFactory; AppManagerRunConfigurationFactory runConfigFactory; AppManagerRunWorkerFactory runWorkerFactory; AppManagerDebugWorkerFactory debugWorkerFactory; }; AppManagerPlugin::~AppManagerPlugin() { delete d; } void AppManagerPlugin::initialize() { d = new AppManagerPluginPrivate; d->deployConfigurationAutoSwitcher.initialize(); if (auto kitManager = KitManager::instance()) { connect(kitManager, &KitManager::kitsLoaded, &cloneAutodetectedBoot2QtKits); } } } // AppManager::Internal