aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/deploybuild.py15
-rw-r--r--scripts/formatcode.py84
-rw-r--r--scripts/generateprojects.bat1
-rw-r--r--scripts/upload_syms.bat3
4 files changed, 80 insertions, 23 deletions
diff --git a/scripts/deploybuild.py b/scripts/deploybuild.py
index 4327d14f7..37518fd0c 100644
--- a/scripts/deploybuild.py
+++ b/scripts/deploybuild.py
@@ -30,12 +30,10 @@ origcwd = os.getcwd()
parser = argparse.ArgumentParser(description='Deploy a zen build to an UE tree')
parser.add_argument("root", help="Path to an UE5 root directory")
parser.add_argument("--sentry", action="store_true", help="Whether to upload symobls to Sentry")
-parser.add_argument("--xmake", action="store_true", help="Build with XMake")
args = parser.parse_args()
engineroot = args.root
upload_symbols = args.sentry
-use_xmake = args.xmake
if not os.path.isfile(os.path.join(engineroot, "RunUAT.bat")):
print(f"{Fore.RED}Not a valid UE5 engine root directory: '{engineroot}'")
@@ -53,16 +51,9 @@ jazz_print("Zen root:", zenroot)
# Build fresh binaries
try:
- if use_xmake:
- subprocess.run(["xmake.exe", "config", "-p", "windows", "-a", "x64", "-m", "release"], check=True)
- build_cmd = ["xmake.exe", "build", "--rebuild", "zenserver"]
- build_output_dir = r'build\windows\x64\release'
- else:
- vs_path = vswhere.get_latest_path() # can also specify prerelease=True
- jazz_print("BUILDING CODE", f"using VS root: {vs_path}")
- devenv_path = os.path.join(vs_path, "Common7\\IDE\\devenv.com")
- build_cmd = [devenv_path, "/build", "Release", "vsxmake2019\\zen.sln"]
- build_output_dir = r'x64\Release'
+ subprocess.run(["xmake.exe", "config", "-p", "windows", "-a", "x64", "-m", "release"], check=True)
+ build_cmd = ["xmake.exe", "build", "--rebuild", "zenserver"]
+ build_output_dir = r'build\windows\x64\release'
subprocess.run(build_cmd, check=True)
except:
diff --git a/scripts/formatcode.py b/scripts/formatcode.py
index 1a214380d..423d2b4e7 100644
--- a/scripts/formatcode.py
+++ b/scripts/formatcode.py
@@ -1,5 +1,12 @@
+import argparse
import os
import fileinput
+import pathlib
+import re
+
+match_expressions = []
+valid_extensions = []
+root_dir = ''
def is_header_missing(f):
with open(f) as reader:
@@ -20,9 +27,11 @@ def scan_tree(root):
for entry in dirs:
if entry.is_dir():
scan_tree(os.path.join(root, entry.name))
- elif entry.name.endswith(".cpp") or entry.name.endswith(".h"):
- print("... formatting: %s"%(entry.name))
- full_path = os.path.join(root, entry.name)
+ continue
+ full_path = os.path.join(root, entry.name)
+ relative_root_path = os.path.relpath(full_path, start=root_dir)
+ if is_matching_filename(relative_root_path):
+ print("... formatting: {}".format(relative_root_path))
files.append(full_path)
if is_header_missing(full_path):
header_files.append(full_path)
@@ -38,12 +47,65 @@ def scan_zen(root):
if entry.is_dir() and entry.name.startswith("zen"):
scan_tree(os.path.join(root, entry.name))
-while True:
- if (os.path.isfile(".clang-format")):
- scan_zen(".")
- quit()
- else:
- cwd = os.getcwd()
- if os.path.dirname(cwd) == cwd:
+def is_matching_filename(relative_root_path):
+ global match_expressions
+ global root_dir
+ global valid_extensions
+
+ if os.path.splitext(relative_root_path)[1].lower() not in valid_extensions:
+ return False
+ if not match_expressions:
+ return True
+ relative_root_path = relative_root_path.replace('\\', '/')
+ for regex in match_expressions:
+ if regex.fullmatch(relative_root_path):
+ return True
+ return False
+
+def parse_match_expressions(wildcards, matches):
+ global match_expressions
+ global valid_extensions
+
+ valid_extensions = ['.cpp', '.h']
+
+ for wildcard in wildcards:
+ regex = wildcard.replace('*', '%FORMAT_STAR%').replace('\\', '/')
+ regex = re.escape(regex)
+ regex = '.*' + regex.replace('%FORMAT_STAR%', '.*') + '.*'
+ try:
+ match_expressions.append(re.compile(regex, re.IGNORECASE))
+ except Exception as ex:
+ print('Could not parse input filename expression \'{}\': {}'.format(wildcard, str(ex)))
+ quit()
+ for regex in matches:
+ try:
+ match_expressions.append(re.compile(regex, re.IGNORECASE))
+ except Exception as ex:
+ print('Could not parse input --match expression \'{}\': {}'.format(regex, str(ex)))
quit()
- os.chdir("..")
+
+def _main():
+ global root_dir
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('filenames', nargs='*', help="Match text for filenames. If fullpath contains text it is a match, " +\
+ "* is a wildcard. Directory separators are matched by either / or \\. Case insensitive.")
+ parser.add_argument('--match', action='append', default=[], help="Match regular expression for filenames. " +\
+ "Relative path from the root zen directory must be a complete match. Directory separators are matched only by /. Case insensitive.")
+ options = parser.parse_args()
+ parse_match_expressions(options.filenames, options.match)
+ root_dir = pathlib.Path(__file__).parent.parent.resolve()
+
+ while True:
+ if (os.path.isfile(".clang-format")):
+ scan_zen(".")
+ quit()
+ else:
+ cwd = os.getcwd()
+ if os.path.dirname(cwd) == cwd:
+ quit()
+ os.chdir("..")
+
+
+if __name__ == '__main__':
+ _main() \ No newline at end of file
diff --git a/scripts/generateprojects.bat b/scripts/generateprojects.bat
new file mode 100644
index 000000000..cc6732aaa
--- /dev/null
+++ b/scripts/generateprojects.bat
@@ -0,0 +1 @@
+xmake project -k vsxmake2022 -y
diff --git a/scripts/upload_syms.bat b/scripts/upload_syms.bat
new file mode 100644
index 000000000..663d64e06
--- /dev/null
+++ b/scripts/upload_syms.bat
@@ -0,0 +1,3 @@
+rem This is a temporary hack until everyone has access to Sentry
+
+scripts\sentry-cli upload-dif --org to --project zen-server \ue5-main\Engine\Binaries\Win64\zenserver.exe \ue5-main\engine\Binaries\Win64\zenserver.pdb