diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2021-05-16 17:52:17 +0200 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2021-05-19 14:10:37 +0000 |
commit | 0bbefbd5dc0ed597b8d1442594a9ab04fadaba60 (patch) | |
tree | af3ca87a51f25fa7f8d1d34b165efda905aaf922 /src/lib/corelib/language/moduleloader.h | |
parent | c7a1ec06313f85a9cf45b44f5940a952348d66d2 (diff) |
Move module providers code to the separate class
ModuleLoader is too big and more logic will be added to module
providers, so it make sense to extract some code to a separate class.
Unfortunately, it is hard to break the dependency between types
completely - it is tempting to pass ModuleLoader::ProductContext into
new class functions. Alternative would be to pass all necessary data via
function parameters which will make the code less readable.
Change-Id: Ida61192348ef7db89b21f0d58f05e61969e2d01c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib/language/moduleloader.h')
-rw-r--r-- | src/lib/corelib/language/moduleloader.h | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/lib/corelib/language/moduleloader.h b/src/lib/corelib/language/moduleloader.h index a4cadd4fa..6d0943708 100644 --- a/src/lib/corelib/language/moduleloader.h +++ b/src/lib/corelib/language/moduleloader.h @@ -73,6 +73,7 @@ namespace Internal { class Evaluator; class Item; class ItemReader; +class ModuleProviderLoader; class ProgressObserver; class QualifiedId; @@ -137,6 +138,7 @@ public: ModuleLoaderResult load(const SetupProjectParameters ¶meters); private: + friend class ModuleProviderLoader; class ProductSortByDependencies; class ContextBase @@ -343,19 +345,6 @@ private: QStringList findExistingModulePaths( const QStringList &searchPaths, const QualifiedId &moduleName); - enum class ModuleProviderLookup { Regular, Fallback }; - struct ModuleProviderResult - { - ModuleProviderResult() = default; - ModuleProviderResult(bool ran, bool added) - : providerFound(ran), providerAddedSearchPaths(added) {} - bool providerFound = false; - bool providerAddedSearchPaths = false; - }; - ModuleProviderResult findModuleProvider(const QualifiedId &name, ProductContext &product, - ModuleProviderLookup lookupType, const CodeLocation &dependsItemLocation); - QVariantMap moduleProviderConfig(ProductContext &product); - static void setScopeForDescendants(Item *item, Item *scope); void overrideItemProperties(Item *item, const QString &buildConfigKey, const QVariantMap &buildConfig); @@ -413,6 +402,7 @@ private: ProgressObserver *m_progressObserver; const std::unique_ptr<ItemReader> m_reader; Evaluator *m_evaluator; + const std::unique_ptr<ModuleProviderLoader> m_moduleProviderLoader; QMap<QString, QStringList> m_moduleDirListCache; QHash<std::pair<QString, QualifiedId>, std::optional<QString>> m_existingModulePathCache; @@ -453,9 +443,6 @@ private: std::unordered_map<ProductContext *, Set<DeferredDependsContext>> m_productsWithDeferredDependsItems; Set<Item *> m_exportsWithDeferredDependsItems; - ModuleProviderInfoList m_moduleProviderInfo; - Set<QString> m_tempQbsFiles; - SetupProjectParameters m_parameters; std::unique_ptr<Settings> m_settings; Version m_qbsVersion; |