4 #include "GDCore/Extensions/Metadata/DependencyMetadata.h"
5 #include "GDCore/Extensions/PlatformExtension.h"
6 #include "GDCore/Project/Project.h"
19 : dependency(&dependency_), extension(&extension_){};
46 std::set<gd::String> usedExtensions,
48 std::vector<DependencyMetadataAndExtension> dependenciesWithProperType;
49 for (
const gd::String &extensionName : usedExtensions) {
52 extension->GetAllDependencies()) {
53 if (dependency.GetDependencyType() == dependencyType) {
55 dependency, *extension);
56 dependenciesWithProperType.push_back(dependencyMetadataAndExtension);
63 std::vector<DependencyMetadataAndExtension> dependenciesWithFilledSettings;
64 for (
auto dependencyAndExtension : dependenciesWithProperType) {
65 auto &dependency = dependencyAndExtension.GetDependency();
67 project, dependencyAndExtension);
69 bool hasExtraSettings = !extraSettingValues.empty();
70 if (!dependency.IsOnlyIfSomeExtraSettingsNonEmpty() || hasExtraSettings)
71 dependenciesWithFilledSettings.push_back(dependencyAndExtension);
76 std::vector<DependencyMetadataAndExtension> exportedDependencies;
77 for (
auto dependencyAndExtension : dependenciesWithFilledSettings) {
78 auto &dependency = dependencyAndExtension.GetDependency();
79 auto &otherDependencyName =
80 dependency.GetOtherDependencyThatMustBeExported();
81 if (otherDependencyName.empty() ||
83 dependenciesWithFilledSettings.begin(),
84 dependenciesWithFilledSettings.end(),
85 [&otherDependencyName](
87 return otherDependencyAndExtension.GetDependency().GetName() ==
89 }) != dependenciesWithFilledSettings.end()) {
90 exportedDependencies.push_back(dependencyAndExtension);
94 return exportedDependencies;
101 static std::map<gd::String, gd::String>
105 std::map<gd::String, gd::String> values;
106 auto &dependency = dependencyAndExtension.GetDependency();
108 dependencyAndExtension.GetExtension().
GetName();
110 for (
const auto &extraSetting : dependency.GetAllExtraSettings()) {
111 const gd::String &type = extraSetting.second.GetType();
113 type ==
"ExtensionProperty"
115 extensionName, extraSetting.second.GetValue())
116 : extraSetting.second.GetValue();
118 if (!extraSettingValue.
empty())
119 values[extraSetting.first] = extraSettingValue;
Helpers to manipulate dependencies of extensions to be exported along with a game.
Definition: ExportedDependencyResolver.h:33
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:44
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:102
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:218
gd::ExtensionProperties & GetExtensionProperties()
Get the properties set by extensions.
Definition: Project.h:464
String represents an UTF8 encoded string.
Definition: String.h:31
bool empty() const
Returns true if the string is empty.
Definition: String.h:155
Definition: CommonTools.h:24