5using Newtonsoft.Json.Linq;
7using Nuke.Common.Tooling;
8using System.ComponentModel;
10using System.Text.RegularExpressions;
12using System.Collections.Generic;
17[TypeConverter(typeof(TypeConverter<LibraryType>))]
23 Value = nameof(Header),
24 TemplateSubfolder =
"HeaderLibrary"
29 Value = nameof(CMake),
30 TemplateSubfolder =
"CMakeLibrary"
35 Value = nameof(XRepo),
36 TemplateSubfolder =
"XRepoLibrary",
37 ParseSpec = XRepoLibrary.ParseSpec
40 public required
string TemplateSubfolder { init;
get; }
41 public Func<string, LibrarySpec> ParseSpec {
get;
private set; } = s =>
new LibrarySpec(s, s);
44public record
class LibrarySpec(
47 string? Version =
null,
48 string? Provider =
null,
49 string? Options =
null,
50 string? Features = null
52 public string UnrealName => Name
58public record
class SuffixRecord(string? Text, string? Us, string? Dot)
60 public SuffixRecord(
string? suffix) : this(suffix, suffix.PrependNonEmpty(
"_"), suffix.PrependNonEmpty(
".")) {}
63public record
class LibraryModel(
68) : CommonModelBase(Spec.Name, Copyright);
72 protected LibraryModel? Model;
74 public void Generate(
UnrealBuild build, AbsolutePath templatesPath, AbsolutePath currentFolder,
string fullSpec,
LibraryType libraryType,
string? suffix)
77 var spec = libraryType.ParseSpec(fullSpec);
85 if ((currentFolder / (spec.Name + Model.Suffix.Us)).DirectoryExists())
87 throw new InvalidOperationException($
"The library module folder of {spec.Name} already exists in the current folder.");
90 if(!(templatesPath / libraryType.TemplateSubfolder).DirectoryExists())
91 templatesPath = DefaultTemplateFolder;
93 var templateDir = templatesPath / libraryType.TemplateSubfolder;
95 RenderFolder(templateDir, currentFolder, Model);
bool IsCompatibleWith(UnrealCompatibility compatibility)
Check if given compatibility mask applies to this version too.
The main build class Unreal projects using Nuke.Unreal should inherit from. This class contains all b...
A collection of utilities around basic functions regarding the environment of the Engine we're workin...
static string ReadCopyrightFromProject(AbsolutePath projectFolder)
Read copyright info from the project's DefaultGame.ini
static EngineVersion Version(UnrealBuild build)
Get high-level version of currently used Engine.