24 (?:(?<PROVIDER>\w+)\:\:)?
30 (?<VERSION>[0-9\.x#]+)
33 (?:\s(?<OPTIONS>[\w=,']+))?
36 RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace
38 private static partial Regex SpecRegex();
45 var matches = spec.Parse(SpecRegex(), forceNullOnWhitespce:
true);
56 internal static IEnumerable<XRepoLibraryRecord> InstallXRepoLibrary(
UnrealBuild self, LibrarySpec spec,
string options, AbsolutePath targetPath,
bool debug,
string runtime =
"MD")
58 var libraryFiles = targetPath /
"LibraryFiles";
59 options = options.AppendNonEmpty(
",") + $
"runtimes='{runtime}'";
60 var xrepoPlatArch =
self.Platform.GetXRepoPlatformArch();
64 -p {xrepoPlatArch.Platform}
65 -a {xrepoPlatArch.Arch}
66 -m {(debug ? "debug
" : "release
")}
71 XRepoTasks.Install(spec.Spec, options, extraArgs)(
"");
73 string[] ProcessPaths(
string? paths, AbsolutePath dstDir)
75 if (paths ==
null)
return [];
77 return paths!.Split(
" ")
80 var currPath = (AbsolutePath) i;
81 var dstPath = dstDir / currPath.Name;
82 if (currPath.FileExists() || currPath.DirectoryExists())
83 currPath.Copy(dstPath, ExistsPolicy.MergeAndOverwrite);
86 Log.Warning(
"A library is referring to a non-existing file or folder: {0}", currPath);
91 .Where(p => !
string.IsNullOrWhiteSpace(p))
95 return XRepoTasks.Info(spec.Spec, options, extraArgs)(
"").ParseXRepoInfo()
96 .Where(i => i[
"fetchinfo"] !=
null)
97 .Where(i => !i[
"fetchinfo"]!.Any(i => i.Key?.ContainsOrdinalIgnoreCase(
"program") ??
false))
98 .Where(i => !i[
"fetchinfo"]![
"kind"]?.Value?.EqualsOrdinalIgnoreCase(
"binary") ??
true)
101 Log.Information(
"Parsing library (dependency) {0}", i.Key);
103 Version = i[
"version"]!.Value!
105 Log.Information(
" Name: {0}", currSpec.Name);
106 Log.Information(
" Version: {0}", currSpec.Version);
107 Log.Information(
" Provider: {0}", currSpec.Provider ??
"xrepo");
108 Log.Information(
" Features: {0}", currSpec.Features);
110 return new XRepoLibraryRecord(
112 Description: i[
"description"]?.Value,
113 Options: i[
"requires"]![
"configs"]
114 !.Select(c => c.Key.AppendNonEmpty(
": ") + c.Value)
116 OptionsHelp: i[
"configs"]
117 ?.Select(c => c.Key.AppendNonEmpty(
": ") + c.Value)
120 IncludePaths: ProcessPaths(
121 i[
"fetchinfo"]![
"includedirs"]?.Value,
122 libraryFiles / currSpec.Name /
"Includes"
124 SysIncludePaths: ProcessPaths(
125 i[
"fetchinfo"]![
"sysincludedirs"]?.Value,
126 libraryFiles / currSpec.Name /
"SysIncludes"
128 LibFiles: ProcessPaths(
129 i[
"fetchinfo"]![
"libfiles"]?.Value,
130 libraryFiles / currSpec.Name /
"Libs" /
self.Platform / (debug ?
"Debug" :
"Release")
132 SysLibs: i[
"fetchinfo"]![
"syslinks"]?.Value
134 ?.Select(l =>
self.Platform.IsWindows && !l.EndsWith(
".lib") ? l +
".lib" : l)
136 Defines: i[
"fetchinfo"]![
"defines"]?.Value?.Split(
" ") ?? []
152 public static void InstallXRepoLibrary(
this UnrealBuild self,
string specIn,
string options, AbsolutePath targetPath,
string? suffix =
null,
string releaseRuntime =
"MD",
string debugRuntime =
"MD")
154 Log.Information(
"Installing library {0} via xrepo", specIn);
155 var spec =
ParseSpec(specIn) with { Options = options };
156 Log.Information(
" Name: {0}", spec.Name);
157 Log.Information(
" Version: {0}", spec.Version);
158 Log.Information(
" Provider: {0}", spec.Provider ??
"xrepo");
159 Log.Information(
" Options: {0}", spec.Options);
160 Log.Information(
" Features: {0}", spec.Features);
162 Log.Information(
"Installing debug build");
163 var debugLibs = InstallXRepoLibrary(
self, spec, options, targetPath,
true, debugRuntime);
165 Log.Information(
"Installing release build (metadata will be used from release build)");
166 var releaseLibs = InstallXRepoLibrary(
self, spec, options, targetPath,
false, releaseRuntime);
168 Log.Information(
"Generating partial module rule class for {0}",
self.Platform);