1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
import argparse
import sys
import os
import fileinput
import colorama
import shutil
import vswhere
import subprocess
from peafour import P4
from colorama import Fore, Back, Style
# Jazzy helpers
def jazz_print(tag, detail = ""):
print(f"{Fore.WHITE}{Style.BRIGHT}||> {tag}{Style.RESET_ALL} {detail}")
def jazz_fail(tag, detail = ""):
print(f"{Fore.RED}{Style.BRIGHT}||> {tag}{Style.RESET_ALL} {detail}")
colorama.init()
origcwd = os.getcwd()
# Parse and validate arguments
parser = argparse.ArgumentParser(description='Deploy a zen build to an UE tree')
parser.add_argument("root", help="Path to an UE5 root directory")
args = parser.parse_args()
engineroot = args.root
if not os.path.isfile(os.path.join(engineroot, "RunUAT.bat")):
print(f"{Fore.RED}Not a valid UE5 engine root directory: '{engineroot}'")
print(Style.RESET_ALL)
exit(1)
# Establish root of zen tree
zenroot = __file__
while not os.path.exists(os.path.join(zenroot, "zen.sln")):
zenroot = os.path.dirname(zenroot)
jazz_print("Zen root:", zenroot)
# Build fresh binaries
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")
try:
subprocess.run([devenv_path, "/build", "Release", "zen.sln"], check=True)
except:
jazz_fail("Build failed!")
exit(1)
# Upload symbols etc to Sentry
jazz_print("Uploading symbols", "to Sentry")
subprocess.run(["scripts\sentry-cli.exe", "upload-dif", "--org", "to", "--project", "zen-server", "x64\\Release\\zenserver.exe", "x64\\Release\\zenserver.pdb"])
# Change into root directory to pick up Perforce environment
jazz_print(f"Determining P4 environment", f"for directory '{engineroot}'")
os.chdir(engineroot)
p4info = P4.info().run()
if p4info is None:
jazz_fail("Unable to query P4 info", "do you have source control connectivity?")
exit(1)
if not os.path.samefile(p4info.clientRoot, engineroot):
print(f"{Fore.RED}Could not find P4 client for UE5 engine root directory '{engineroot}'")
print(Style.RESET_ALL)
exit(1)
# check out the binaries
jazz_print("Reverting", "any previous unsubmitted deploy")
try:
P4.revert("Engine/Binaries/Win64/zenserver.*").run()
P4.revert("Engine/Binaries/Win64/crashpad_handler.exe").run()
except Exception as e:
# it's not super important to report failure here, it's likely
# due to the user not actually having the file checked out (yet)
pass
jazz_print("Checking out", "(at head) zenserver executables")
try:
P4.edit("Engine/Binaries/Win64/zenserver.*").run()
P4.edit("Engine/Binaries/Win64/crashpad_handler.exe").run()
except Exception as e:
jazz_fail("edit failed", str(e))
exit(1)
target_bin_dir = os.path.join(engineroot, "Engine\\Binaries\\Win64")
jazz_print("Placing zenserver", f"executables into tree at '{target_bin_dir}'")
crashpadtarget = os.path.join(target_bin_dir, "crashpad_handler.exe")
try:
shutil.copy(os.path.join(zenroot, "x64\Release\zenserver.exe"), os.path.join(target_bin_dir, "zenserver.exe"))
shutil.copy(os.path.join(zenroot, "x64\Release\zenserver.pdb"), os.path.join(target_bin_dir, "zenserver.pdb"))
shutil.copy(os.path.join(zenroot, r'vcpkg_installed\x64-windows-static\x64-windows-static\tools\sentry-native\crashpad_handler.exe'), crashpadtarget)
P4.add(crashpadtarget).run()
except Exception as e:
print(f"Caught exception while copying: {e.args}")
exit(1)
jazz_print("SUCCESS", "binaries ready for check-in")
|