More work on getting a truly clean build
This commit is contained in:
43
build.py
43
build.py
@@ -13,6 +13,10 @@ import itertools, hashlib, zipfile, fnmatch
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
#
|
||||
# Suppress an error in some of Unreal's scripts:
|
||||
#
|
||||
os.environ["GIT_DIR"] = ".git"
|
||||
|
||||
#
|
||||
# Utility subroutines
|
||||
@@ -113,34 +117,6 @@ def cpp_files_included_by(module):
|
||||
return result
|
||||
|
||||
|
||||
#
|
||||
# Applying patches to files with DOS line endings.
|
||||
#
|
||||
# We want to apply a patch to the UnrealEngine source, and some but not all
|
||||
# of the files we want to patch have DOS line endings. Unfortunately, the
|
||||
# unix patch utility can't handle a codebase with mixed line endings.
|
||||
# To make it work, we convert all files to UNIX line endings, apply the
|
||||
# patch, and then convert the appropriate files back.
|
||||
#
|
||||
|
||||
def dos2unix(fn):
|
||||
before = Path(fn).read_bytes()
|
||||
after = before.replace(b"\r\n", b"\n")
|
||||
if before != after:
|
||||
print("dos2unix ", fn)
|
||||
Path(fn).write_bytes(after)
|
||||
|
||||
def unix2dos(fn):
|
||||
before = Path(fn).read_bytes()
|
||||
after = before.replace(b"\n", b"\r\n")
|
||||
if before != after:
|
||||
print("unix2dos ", fn)
|
||||
Path(fn).write_bytes(after)
|
||||
|
||||
#
|
||||
# Given a patch file, generate a list of the files being modified.
|
||||
#
|
||||
|
||||
#
|
||||
# Determining the build configuration.
|
||||
#
|
||||
@@ -221,13 +197,10 @@ def unzip_unreal_engine_and_apply_patch():
|
||||
unrealversion = os.path.join(INTEGRATION, version)
|
||||
shutil.rmtree(UNREALENGINE, ignore_errors=True)
|
||||
shutil.rmtree(unrealversion, ignore_errors=True)
|
||||
shell(INTEGRATION, "unzip UnrealEngine.zip")
|
||||
print("Unzipping UnrealEngine.zip...")
|
||||
shell(INTEGRATION, "unzip -q UnrealEngine.zip")
|
||||
patchfile = f"{INTEGRATION}/EnginePatches/EnginePatch"
|
||||
dosfiles = Path(f"{INTEGRATION}/EnginePatches/PatchedDosFiles").read_text().splitlines()
|
||||
dos2unix(patchfile)
|
||||
for file in dosfiles: dos2unix(f"{unrealversion}/{file}")
|
||||
shell(unrealversion, f"patch -p1 < {patchfile}")
|
||||
for file in dosfiles: unix2dos(f"{unrealversion}/{file}")
|
||||
Path(unrealversion).rename(UNREALENGINE)
|
||||
|
||||
|
||||
@@ -282,13 +255,15 @@ def run_unrealengine_setup_bat_replacement():
|
||||
prompt in the middle of a build. Yuk. So we've written
|
||||
our own script that replaces Setup.bat/Setup.sh.
|
||||
"""
|
||||
if not Path(f"{UNREALENGINE}/Engine/Content").is_dir():
|
||||
touch = Path(f"{UNREALENGINE}/Engine/Build/HaveGitDependencies")
|
||||
if not touch.is_file():
|
||||
if sys.platform == "windows":
|
||||
shell(UNREALENGINE, "Engine/Binaries/DotNET/GitDependencies/win-x64/GitDependencies.exe")
|
||||
shell(UNREALENGINE, "Engine/Extras/Redist/en-us/UEPrereqSetup_x64.exe /quiet /norestart")
|
||||
else:
|
||||
shell(UNREALENGINE, "Engine/Build/BatchFiles/Linux/GitDependencies.sh")
|
||||
shell(f"{UNREALENGINE}/Engine/Build/BatchFiles/Linux", "./Setup.sh")
|
||||
touch.write_text("Downloaded")
|
||||
|
||||
|
||||
def build_unrealbuildtool():
|
||||
|
||||
Reference in New Issue
Block a user