Skip to content

Commit

Permalink
Add build-target command
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrehn committed Dec 10, 2020
1 parent 06464ad commit 3d590b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ue4cli/UnrealManagerBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion ue4cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': '<TARGET> [CONFIGURATION]'
},

'run': {
'description': 'Run the editor for the Unreal project',
'action': lambda m, args: m.runEditor(
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 3d590b0

Please sign in to comment.