4 #include "GDCore/Extensions/Metadata/DependencyMetadata.h"
5 #include "GDCore/Extensions/PlatformExtension.h"
6 #include "GDCore/Project/Project.h"
7 #include "GDCore/Extensions/Platform.h"
20 : dependency(&dependency_), extension(&extension_){};
47 std::set<gd::String> usedExtensions,
49 std::vector<DependencyMetadataAndExtension> dependenciesWithProperType;
50 for (
const gd::String &extensionName : usedExtensions) {
53 extension->GetAllDependencies()) {
54 if (dependency.GetDependencyType() == dependencyType) {
56 dependency, *extension);
57 dependenciesWithProperType.push_back(dependencyMetadataAndExtension);
64 std::vector<DependencyMetadataAndExtension> dependenciesWithFilledSettings;
65 for (
auto dependencyAndExtension : dependenciesWithProperType) {
66 auto &dependency = dependencyAndExtension.GetDependency();
68 project, dependencyAndExtension);
70 bool hasExtraSettings = !extraSettingValues.empty();
71 if (!dependency.IsOnlyIfSomeExtraSettingsNonEmpty() || hasExtraSettings)
72 dependenciesWithFilledSettings.push_back(dependencyAndExtension);
77 std::vector<DependencyMetadataAndExtension> exportedDependencies;
78 for (
auto dependencyAndExtension : dependenciesWithFilledSettings) {
79 auto &dependency = dependencyAndExtension.GetDependency();
80 auto &otherDependencyName =
81 dependency.GetOtherDependencyThatMustBeExported();
82 if (otherDependencyName.empty() ||
84 dependenciesWithFilledSettings.begin(),
85 dependenciesWithFilledSettings.end(),
86 [&otherDependencyName](
88 return otherDependencyAndExtension.GetDependency().GetName() ==
90 }) != dependenciesWithFilledSettings.end()) {
91 exportedDependencies.push_back(dependencyAndExtension);
95 return exportedDependencies;
102 static std::map<gd::String, gd::String>
106 std::map<gd::String, gd::String> values;
107 auto &dependency = dependencyAndExtension.GetDependency();
109 dependencyAndExtension.GetExtension().
GetName();
111 for (
const auto &extraSetting : dependency.GetAllExtraSettings()) {
112 const gd::String &type = extraSetting.second.GetType();
114 type ==
"ExtensionProperty"
116 extensionName, extraSetting.second.GetValue())
117 : extraSetting.second.GetValue();
119 if (!extraSettingValue.
empty())
120 values[extraSetting.first] = extraSettingValue;
Helpers to manipulate dependencies of extensions to be exported along with a game.
Definition: ExportedDependencyResolver.h:34
static std::vector< DependencyMetadataAndExtension > GetDependenciesFor(const gd::Project &project, std::set< gd::String > usedExtensions, const gd::String &dependencyType)
Return the list of dependencies to be exported for the given project, used extensions list and depend...
Definition: ExportedDependencyResolver.h:45
static std::map< gd::String, gd::String > GetExtensionDependencyExtraSettingValues(const gd::Project &project, const gd::DependencyMetadataAndExtension &dependencyAndExtension)
Return the values that were stored in the project for the given dependency.
Definition: ExportedDependencyResolver.h:103
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:50
Platform & GetCurrentPlatform() const
Return a reference to the platform being currently used to edit the project.
Definition: Project.cpp:253
gd::ExtensionProperties & GetExtensionProperties()
Get the properties set by extensions.
Definition: Project.h:464
String represents an UTF8 encoded string.
Definition: String.h:33
bool empty() const
Returns true if the string is empty.
Definition: String.h:157
Definition: CommonTools.h:24