From 893c0acf939b99212661fb81e2890e38e4d1ce38 Mon Sep 17 00:00:00 2001 From: jyelon Date: Wed, 11 Jun 2025 19:10:14 -0400 Subject: [PATCH] Improved build.py --- Integration.code-workspace.tpl.json | 38 +++++++++-------------------- build.py | 4 ++- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/Integration.code-workspace.tpl.json b/Integration.code-workspace.tpl.json index 3778ad03..8b8d7c74 100644 --- a/Integration.code-workspace.tpl.json +++ b/Integration.code-workspace.tpl.json @@ -59,40 +59,26 @@ }, "tasks": { "version": "2.0.0", - "tasks": [ - { - "label": "build.py c++", + "tasks": { + "for-each" : [ + { "CMD" : "python3 build.py c++", "DEFAULT":true }, + { "CMD" : "python3 build.py all", "DEFAULT":false }, + { "CMD" : "python3 build.py clean", "DEFAULT":false } + ], + "body" : { + "label": "[CMD]", "group": { "kind": "build", - "isDefault": true + "isDefault": "[DEFAULT]" }, - "command": "python3 build.py c++", - "presentation": { - "clear": true - }, - "problemMatcher": "$msCompile", - "type": "shell" - }, - { - "label": "build.py all", - "command": "python3 build.py all", - "presentation": { - "clear": true - }, - "problemMatcher": "$msCompile", - "type": "shell" - }, - { - "label": "build.py clean", - "group": "build", - "command": "python3 build.py clean", + "command": "[CMD]", "presentation": { "clear": true }, "problemMatcher": "$msCompile", "type": "shell" } - ] + } }, "launch": { "version": "0.2.0", @@ -105,7 +91,7 @@ "name": "Server=[SERVER]", "request": "launch", "program": "[UNREALENGINE]/Engine/Binaries/Linux/UnrealEditor-Linux-DebugGame", - "preLaunchTask": "Make All", + "preLaunchTask": "python3 build.py c++", "args": [ "[INTEGRATION]/Integration.uproject", "-userdir=User/[USER]", diff --git a/build.py b/build.py index dcbd8ab5..0466869d 100755 --- a/build.py +++ b/build.py @@ -84,7 +84,9 @@ def expand_json(data, vars): elif isinstance(data, list): return [ expand_json(item, vars) for item in data ] elif isinstance(data, str): - return JSON_VAR_REGEX.sub(lambda m: str(vars.get(m.group(1), m.group(0))), data) + full = JSON_VAR_REGEX.fullmatch(data) + if full: return vars.get(full.group(1), data) + else: return JSON_VAR_REGEX.sub(lambda m: str(vars.get(m.group(1), m.group(0))), data) else: return data