diff --git a/EnginePatches/code-workspace b/EnginePatches/code-workspace new file mode 100644 index 00000000..55fa8ed9 --- /dev/null +++ b/EnginePatches/code-workspace @@ -0,0 +1,119 @@ +{ + "folders": [ + { + "name": "Integration", + "path": "." + }, + { + "name": "UE5", + "path": "ENGINEPATH" + } + ], + "settings": { + "typescript.tsc.autoDetect": "off", + "npm.autoDetect": "off" + }, + "extensions": { + "recommendations": [ + "ms-vscode.cpptools", + "ms-dotnettools.csharp", + "vadimcn.vscode-lldb", + "ms-vscode.mono-debug", + "dfarley1.file-picker" + ] + }, + "tasks": { + "version": "2.0.0", + "tasks": [ + { + "label": "IntegrationEditor Linux DebugGame Build", + "group": { + "kind": "build", + "isDefault": "true" + }, + "command": "Engine/Build/BatchFiles/Linux/Build.sh", + "args": [ + "IntegrationEditor", + "Linux", + "DebugGame", + "INTEGRATIONPATH/Integration.uproject", + "-waitmutex" + ], + "problemMatcher": "$msCompile", + "type": "shell", + "options": { + "cwd": "ENGINEPATH" + } + }, + { + "label": "IntegrationEditor Linux DebugGame Rebuild", + "group": "build", + "command": "Engine/Build/BatchFiles/Linux/Build.sh", + "args": [ + "IntegrationEditor", + "Linux", + "DebugGame", + "INTEGRATIONPATH/Integration.uproject", + "-waitmutex" + ], + "problemMatcher": "$msCompile", + "dependsOn": [ + "IntegrationEditor Linux DebugGame Clean" + ], + "type": "shell", + "options": { + "cwd": "ENGINEPATH" + } + }, + { + "label": "IntegrationEditor Linux DebugGame Clean", + "group": "build", + "command": "Engine/Build/BatchFiles/Linux/Build.sh", + "args": [ + "IntegrationEditor", + "Linux", + "DebugGame", + "INTEGRATIONPATH/Integration.uproject", + "-waitmutex", + "-clean" + ], + "problemMatcher": "$msCompile", + "type": "shell", + "options": { + "cwd": "ENGINEPATH" + } + }, + { + "label": "Build Luprex", + "group": "build", + "command": "make", + "problemMatcher": "$msCompile", + "type": "shell", + "options": { + "cwd": "INTEGRATIONPATH/luprex" + } + } + ] + }, + "launch": { + "version": "0.2.0", + "configurations": [ + { + "name": "Launch IntegrationEditor (DebugGame)", + "request": "launch", + "program": "ENGINEPATH/Engine/Binaries/Linux/UnrealEditor-Linux-DebugGame", + "preLaunchTask": "IntegrationEditor Linux DebugGame Build", + "args": [ + "INTEGRATIONPATH/Integration.uproject", + "-userdir=User/USERNAME" + ], + "cwd": "ENGINEPATH", + "type": "lldb", + "initCommands": [ + "command script import ENGINEPATH/Engine/Extras/LLDBDataFormatters/UEDataFormatters_2ByteChars.py", + "target stop-hook add --one-liner \"p ::UngrabAllInputImpl()\"" + ] + } + ] + } +} \ No newline at end of file diff --git a/EnginePatches/uproject b/EnginePatches/uproject new file mode 100644 index 00000000..9acc62ad --- /dev/null +++ b/EnginePatches/uproject @@ -0,0 +1,27 @@ + +{ + "FileVersion": 3, + "EngineAssociation": "5.3", + "Category": "", + "Description": "", + "Modules": [ + { + "Name": "Integration", + "Type": "Runtime", + "LoadingPhase": "Default", + "AdditionalDependencies": [ + "Engine", + "CoreUObject" + ] + } + ], + "Plugins": [ + { + "Name": "ModelingToolsEditorMode", + "Enabled": true, + "TargetAllowList": [ + "Editor" + ] + } + ] +} diff --git a/patch-integration.py b/patch-integration.py index 40a0610d..142938a8 100755 --- a/patch-integration.py +++ b/patch-integration.py @@ -39,13 +39,6 @@ # be checked into git because it contains many hardwired # paths. # -# The UnrealBuildTool which is included with the UnrealEngine can -# generate a rough draft of Integration.code-workspace. However, the -# file it generates is not well-configured for our luprex-related -# needs. This python script uses UnrealBuildTool to generate the rough -# draft, then it loads Integration.code-workspace into RAM, edits it -# in RAM, and writes a new, improved version back out. -# # We don't really need a Makefile, since Unreal games are build using # UnrealBuildTool, not make. But, having a one-liner makefile can at # least make it obvious what command you're supposed to type to build @@ -117,111 +110,21 @@ writefile("Source/Integration/lpx-paths.hpp", f""" # Write Integration.uproject. # -writefile("Integration.uproject", """ -{ - "FileVersion": 3, - "EngineAssociation": "5.3", - "Category": "", - "Description": "", - "Modules": [ - { - "Name": "Integration", - "Type": "Runtime", - "LoadingPhase": "Default", - "AdditionalDependencies": [ - "Engine", - "CoreUObject" - ] - } - ], - "Plugins": [ - { - "Name": "ModelingToolsEditorMode", - "Enabled": true, - "TargetAllowList": [ - "Editor" - ] - } - ] -} -""") - - +UPROJECTTEMPLATE=readfile("EnginePatches/uproject") +UPROJECT=json.loads(UPROJECTTEMPLATE) +with open("Integration.uproject", "w") as rewritten: + json.dump(UPROJECT, rewritten, indent=4) # -# Use UnrealBuildTool to generate a rough draft of Integration.code-workspace. -# - -BUILDPROJECTFILES = f'dotnet {UNREALBUILDTOOL} -projectfiles -project="{INTEGRATION}/Integration.uproject" -game' -print(BUILDPROJECTFILES) -os.system(BUILDPROJECTFILES) - -# -# Load the rough Integration.code-workspace into RAM, then delete the rough draft. -# - -with open("Integration.code-workspace") as original: - WORKSPACE=json.load(original) -os.remove("Integration.code-workspace") - -# -# Configure the correct build task as the default task. -# - -for task in WORKSPACE["tasks"]["tasks"]: - if task["label"] == "IntegrationEditor Linux DebugGame Build": - task["group"] = { "kind": "build", "isDefault": "true" } - -# -# Delete all build tasks that aren't relevant. -# - -def goodtask(task): - return task["label"].startswith("IntegrationEditor Linux DebugGame") - -WORKSPACE["tasks"]["tasks"] = [x for x in WORKSPACE["tasks"]["tasks"] if goodtask(x)] - -# -# Add a build task for Luprex -# - -LUPREXBUILDTASK={} -WORKSPACE["tasks"]["tasks"].append(LUPREXBUILDTASK) -LUPREXBUILDTASK["label"] = "Build Luprex" -LUPREXBUILDTASK["group"] = "build" -LUPREXBUILDTASK["command"] = "make" -LUPREXBUILDTASK["problemMatcher"] = "$msCompile" -LUPREXBUILDTASK["type"] = "shell" -LUPREXBUILDTASK["options"] = {} -LUPREXBUILDTASK["options"]["cwd"] = f"{INTEGRATION}/luprex" - -# -# Convert all launch configurations to lldb. -# - -for config in WORKSPACE["launch"]["configurations"]: - config["type"] = "lldb" - config["initCommands"] = [ - f"command script import {UNREALENGINE}/Engine/Extras/LLDBDataFormatters/UEDataFormatters_2ByteChars.py", - f'target stop-hook add --one-liner "p ::UngrabAllInputImpl()"' - ] - config["args"] = [ f"{INTEGRATION}/Integration.uproject", f"-userdir=User/{USER}" ] - config.pop("visualizerFile", None) - config.pop("showDisplayString", None) - -# -# Delete all but the relevant launch configuration. -# - -def goodconf(config): - return config["name"] == "Launch IntegrationEditor (DebugGame)" - -WORKSPACE["launch"]["configurations"] = [x for x in WORKSPACE["launch"]["configurations"] if goodconf(x)] - -# -# Write Integration.code-workspace. +# Using the template in EnginePatches/code-workspace, generate a +# updated version of Integration.code-workspace # +WORKSPACETEMPLATE=readfile("EnginePatches/code-workspace") +WORKSPACETEMPLATE=WORKSPACETEMPLATE.replace("ENGINEPATH", UNREALENGINE) +WORKSPACETEMPLATE=WORKSPACETEMPLATE.replace("INTEGRATIONPATH", INTEGRATION) +WORKSPACETEMPLATE=WORKSPACETEMPLATE.replace("USERNAME", USER) +WORKSPACE=json.loads(WORKSPACETEMPLATE) with open("Integration.code-workspace", "w") as rewritten: json.dump(WORKSPACE, rewritten, indent=4)