From 3d590b0f1247c21c1cf6da7f133672e18a83fa74 Mon Sep 17 00:00:00 2001 From: Adam Rehn Date: Fri, 11 Dec 2020 08:00:59 +1000 Subject: [PATCH] Add build-target command --- ue4cli/UnrealManagerBase.py | 8 +++++++- ue4cli/cli.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ue4cli/UnrealManagerBase.py b/ue4cli/UnrealManagerBase.py index d2bcbb5..dcb2754 100644 --- a/ue4cli/UnrealManagerBase.py +++ b/ue4cli/UnrealManagerBase.py @@ -339,7 +339,7 @@ def buildDescriptor(self, dir=os.getcwd(), configuration='Development', target=' # If we're using a source build of the Engine then make sure ShaderCompileWorker is built before building project Editor modules if noTools == False and self.isInstalledBuild() == False and self.isProject(descriptor) and target == 'Editor': Utility.printStderr('Ensuring ShaderCompileWorker is built before building project Editor modules...') - self._runUnrealBuildTool('ShaderCompileWorker', self.getPlatformIdentifier(), 'Development', [], capture=suppressOutput) + self.buildTarget('ShaderCompileWorker', 'Development', [], capture=suppressOutput) # Generate the arguments to pass to UBT target = self.getDescriptorName(descriptor) + target if self.isProject(descriptor) else 'UE4Editor' @@ -348,6 +348,12 @@ def buildDescriptor(self, dir=os.getcwd(), configuration='Development', target=' # Perform the build self._runUnrealBuildTool(target, self.getPlatformIdentifier(), configuration, baseArgs + args, capture=suppressOutput) + def buildTarget(self, target, configuration='Development', args=[], suppressOutput=False): + """ + Builds the specified target using UBT. Primarily useful for building Engine tools and programs. + """ + self._runUnrealBuildTool(target, self.getPlatformIdentifier(), configuration, args, capture=suppressOutput) + def runEditor(self, dir=os.getcwd(), debug=False, args=[]): """ Runs the editor for the Unreal project in the specified directory (or without a project if dir is None) diff --git a/ue4cli/cli.py b/ue4cli/cli.py index eaac445..d5f51e3 100644 --- a/ue4cli/cli.py +++ b/ue4cli/cli.py @@ -49,6 +49,12 @@ 'args': '[EXTRA ARGS]' }, + 'build-target': { + 'description': 'Build the specified target using UBT', + 'action': lambda m, args: m.buildTarget(args.pop(0), args.pop(0) if (len(args) > 0) else 'Development', args), + 'args': ' [CONFIGURATION]' + }, + 'run': { 'description': 'Run the editor for the Unreal project', 'action': lambda m, args: m.runEditor( @@ -148,7 +154,7 @@ { 'name': 'Engine-related commands', 'description': 'These commands relate to the Unreal Engine itself:', - 'commands': ['root', 'version', 'editor'] + 'commands': ['root', 'version', 'editor', 'build-target'] }, { 'name': 'Descriptor-related commands',