Combine 'checkout branch' with 'apply patch'
This commit is contained in:
37
build.py
37
build.py
@@ -210,11 +210,21 @@ def store_system_config_in_globals(config):
|
|||||||
# The actual build steps.
|
# The actual build steps.
|
||||||
#
|
#
|
||||||
|
|
||||||
def checkout_correct_unreal_engine_branch():
|
def checkout_correct_unreal_engine_branch_and_apply_patch():
|
||||||
"""
|
"""
|
||||||
This is the version of Unreal Engine that we're currently using.
|
Check out the correct branch, then apply a patch to the UnrealEngine
|
||||||
|
source code. Patch application consists of two steps: first, checkout clean,
|
||||||
|
unpatched versions of the files from git. Then, apply the patch to the clean code.
|
||||||
|
Note: don't git-commit the patch in UnrealEngine. Instead,
|
||||||
|
just let this script reapply this patch as necessary.
|
||||||
"""
|
"""
|
||||||
shell(UNREALENGINE, "git checkout 5.3.1-release")
|
patch = Path(f"{INTEGRATION}/EnginePatches/EnginePatch")
|
||||||
|
patch_lines = patch.read_text().splitlines()
|
||||||
|
patched_files = [line[6:] for line in patch_lines if line.startswith("--- a/")]
|
||||||
|
for file in patched_files:
|
||||||
|
shell(UNREALENGINE, f"git show HEAD:{file} > {file}")
|
||||||
|
shell(UNREALENGINE, f"git checkout 5.3.1-release")
|
||||||
|
shell(UNREALENGINE, f"git apply {INTEGRATION}/EnginePatches/EnginePatch")
|
||||||
|
|
||||||
|
|
||||||
def generate_buildconfiguration_xml():
|
def generate_buildconfiguration_xml():
|
||||||
@@ -251,24 +261,6 @@ def generate_lpx_paths():
|
|||||||
target.write_text(code)
|
target.write_text(code)
|
||||||
|
|
||||||
|
|
||||||
def patch_unrealengine_source_code():
|
|
||||||
"""
|
|
||||||
Apply a patch to the UnrealEngine source code.
|
|
||||||
I tried to avoid patching Unreal engine, but it turns out there are a
|
|
||||||
few things that I just couldn't avoid having to fix.
|
|
||||||
Patch application consists of two steps: first, checkout clean, unpatched
|
|
||||||
versions of the files from git. Then, apply the patch to the clean code.
|
|
||||||
Note: don't git-commit the patch in UnrealEngine. Instead,
|
|
||||||
just let this script reapply this patch as necessary.
|
|
||||||
"""
|
|
||||||
patch = Path(f"{INTEGRATION}/EnginePatches/EnginePatch")
|
|
||||||
patch_lines = patch.read_text().splitlines()
|
|
||||||
patched_files = [line[6:] for line in patch_lines if line.startswith("--- a/")]
|
|
||||||
for file in patched_files:
|
|
||||||
shell(UNREALENGINE, f"git show HEAD:{file} > {file}")
|
|
||||||
shell(UNREALENGINE, f"git apply {INTEGRATION}/EnginePatches/EnginePatch")
|
|
||||||
|
|
||||||
|
|
||||||
def generate_integration_uproject():
|
def generate_integration_uproject():
|
||||||
"""
|
"""
|
||||||
Generate integration.uproject
|
Generate integration.uproject
|
||||||
@@ -379,10 +371,9 @@ store_system_config_in_globals(CONFIG)
|
|||||||
os.chdir(f"{INTEGRATION}/EnginePatches")
|
os.chdir(f"{INTEGRATION}/EnginePatches")
|
||||||
|
|
||||||
if MODE == "all":
|
if MODE == "all":
|
||||||
checkout_correct_unreal_engine_branch()
|
checkout_correct_unreal_engine_branch_and_apply_patch()
|
||||||
generate_buildconfiguration_xml()
|
generate_buildconfiguration_xml()
|
||||||
generate_lpx_paths()
|
generate_lpx_paths()
|
||||||
patch_unrealengine_source_code()
|
|
||||||
generate_integration_uproject()
|
generate_integration_uproject()
|
||||||
run_unrealengine_setup_bat()
|
run_unrealengine_setup_bat()
|
||||||
build_unrealbuildtool()
|
build_unrealbuildtool()
|
||||||
|
|||||||
Reference in New Issue
Block a user