2using System.Collections.Generic;
4using System.Threading.Tasks;
5using Nuke.Common.Tooling;
6using Nuke.Common.Utilities;
20 public abstract string Name {
get; }
34 protected List<UnrealToolArgument> UsingArguments = [];
35 protected readonly Dictionary<string, ToolConfig> UsingSubtools = [];
41 var meta = arg.GetMeta();
42 bool allowMultiple = meta.AllowMultiple || meta.IsRawText;
45 UsingArguments = UsingArguments
46 .Where(a => !a.Name.EqualsOrdinalIgnoreCase(arg.Name))
49 UsingArguments.Add(arg);
57 public virtual void AppendSubtool(ToolConfig subtool)
59 UsingSubtools.TryAdd(subtool.Name, subtool);
69 var compatibleName = ueVersion.SemanticalVersion.Major > 4
70 ?
CliName.Replace(
"UE4",
"Unreal")
73 var subtools = UsingSubtools.Values
75 .Select(v => v.Gather(ueVersion));
77 foreach (var subtool
in UsingSubtools.Values.Where(v => !ueVersion.IsCompatibleWith(v.Compatibility)))
80 "The tool {0} ({1}) is only compatible with {2} therefore it is ignored (current compatibility: {3})",
83 subtool.Compatibility,
84 ueVersion.Compatibility
88 var args = UsingArguments
89 .Where(v => ueVersion.IsCompatibleWith(v.GetMeta().Compatibility))
90 .Select(v => v.Gather(ueVersion));
92 foreach (var arg
in UsingArguments.Where(v => !ueVersion.IsCompatibleWith(v.GetMeta().Compatibility)))
95 "The argument {0} is only compatible with {1} therefore it is ignored (current compatibility: {2})",
97 arg.GetMeta().Compatibility,
98 ueVersion.Compatibility
102 return (compatibleName +
" " +
string.Join(
' ', subtools.Concat(args))).Trim();
117 public static T
If<T>(
this T config,
bool condition, Action<T>? @
true =
null, Action<T>? @
false =
null) where T :
ToolConfig
119 if (condition) @
true?.Invoke(config);
120 else @
false?.Invoke(config);
133 public static T
For<T, I>(
this T config, IEnumerable<I> collection, Action<I, T> body) where T :
ToolConfig
135 foreach (var item
in collection)
137 body?.Invoke(item, config);
151 Append(config, arguments.AsEnumerable());
163 foreach(var arg
in arguments)
165 if (arg ==
null)
continue;
166 config.AppendArgument(arg);
180 AppendRaw(config, arguments.AsEnumerable());
192 foreach(var arg
in arguments)
196 Meta:
new(IsRawText:
true)
High level representation of an Unreal Engine version.
bool IsCompatibleWith(UnrealCompatibility compatibility)
Check if given compatibility mask applies to this version too.
UnrealCompatibility
A flag enum representation for checking the Unreal version compatibility of various features....