Skip to content

Commit fdfe46e

Browse files
committed
precompiling plugins with building them in the empty host project first (UBT with project) then directly the plugin (UBT with uplugin) this ensures all the damn files necessary for precompiled plugins to work as expected. I don't know what Epic is doing with plugins distributed on Fab, but I'm 100% sure they do more magic than UAT BuildPlugin.
1 parent f263397 commit fdfe46e

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

src/Nuke.Unreal/Plugins/UnrealPlugin.cs

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ private bool InjectBinaryPlumbing(PluginDescriptor descriptor, out PluginDescrip
439439

440440
if (!pretend && options.UPluginAssociateEngineVersion)
441441
{
442-
descriptor = descriptor with { EngineVersion = Unreal.Version(build).VersionMinor };
442+
descriptor = descriptor with { EngineVersion = Unreal.Version(build).VersionMinor + ".0" };
443443
Unreal.WriteJson(descriptor, outUPlugin);
444444
}
445445

@@ -607,31 +607,53 @@ public AbsolutePath BuildPlugin(
607607
try
608608
{
609609
UbtConfig Common(UbtConfig _) => _
610-
.Project(shortHostProjectDir / "HostProject.uproject")
611-
// .Plugin(shortPluginDir / PluginPath.Name) // this just breaks plugin distribution
612-
// .NoUBTMakefiles()
613610
.NoHotReload()
614-
.Apply(ubtConfig)
615611
.Apply(build.UbtGlobal)
612+
.Apply(ubtConfig)
613+
;
614+
UbtConfig CommonProject(UbtConfig _) => _
615+
.Project(shortHostProjectDir / "HostProject.uproject")
616+
.Apply(Common)
617+
;
618+
UbtConfig CommonPlugin(UbtConfig _) => _
619+
.Plugin(shortPluginDir / PluginPath.Name)
620+
.Apply(Common)
616621
;
617622

618623
foreach(var platform in platforms)
619624
{
620-
Log.Information("Building UnrealGame binaries for {0} @ {1}", Name, platform);
625+
Log.Information("Building UnrealGame binaries from UProject for {0} @ {1}", Name, platform);
626+
Unreal.BuildTool(build, _ => _
627+
.Target("UnrealGame", platform,
628+
[
629+
UnrealConfig.Development,
630+
UnrealConfig.Shipping
631+
])
632+
.Apply(CommonProject)
633+
)("");
634+
if (platform.IsDevelopment)
635+
{
636+
Log.Information("Building UnrealEditor binaries for UProject {0} @ {1}", Name, platform);
637+
Unreal.BuildTool(build, _ => _
638+
.Target("UnrealEditor", platform, [UnrealConfig.Development])
639+
.Apply(CommonProject)
640+
)("");
641+
}
642+
Log.Information("Building UnrealGame binaries from UPlugin for {0} @ {1}", Name, platform);
621643
Unreal.BuildTool(build, _ => _
622644
.Target("UnrealGame", platform,
623645
[
624646
UnrealConfig.Development,
625647
UnrealConfig.Shipping
626648
])
627-
.Apply(Common)
649+
.Apply(CommonPlugin)
628650
)("");
629651
if (platform.IsDevelopment)
630652
{
631-
Log.Information("Building UnrealEditor binaries for {0} @ {1}", Name, platform);
653+
Log.Information("Building UnrealEditor binaries for UPlugin {0} @ {1}", Name, platform);
632654
Unreal.BuildTool(build, _ => _
633655
.Target("UnrealEditor", platform, [UnrealConfig.Development])
634-
.Apply(Common)
656+
.Apply(CommonPlugin)
635657
)("");
636658
}
637659
}

0 commit comments

Comments
 (0)