From e716c857fc8de74ea08e35ed33bac4cd981b5b6a Mon Sep 17 00:00:00 2001 From: jyelon Date: Mon, 11 Nov 2024 14:14:52 -0500 Subject: [PATCH] More work on build-everything --- build-everything.py | 88 ++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 53 deletions(-) diff --git a/build-everything.py b/build-everything.py index 3f1d29a0..e991383f 100755 --- a/build-everything.py +++ b/build-everything.py @@ -25,6 +25,25 @@ import sys, os, json, shutil, subprocess from pathlib import Path +# +# These things are operating system specific. +# + +if sys.platform == "windows": + OS = "Windows" + DLL = "dll" + BAT = "bat" + DOT_EXE = ".exe" + USER = "Unknown" + BUILD_BAT = "Build.bat" +else: + OS = "Linux" + DLL = "so" + BAT = "sh" + DOT_EXE = "" + USER = os.environ["USER"] + BUILD_BAT = "Linux/Build.sh" + # # Some handy utility functions # @@ -42,75 +61,38 @@ def shell(dir, cmd): subprocess.run(cmd, shell=True, check=True, cwd=dir) # -# These things are operating system specific. +# Find the two repositories and verify them. # -if sys.platform == "windows": - OS = "Windows" - DLL = "dll" - BAT = "bat" - DOT_EXE = ".exe" - USER = "Unknown" - REPOSITORY_PATH = [ "d:", "e:", "f:" ] - BUILD_BAT = "Build.bat" - UNWRITABLE_DIR = "c:/Windows" -else: - OS = "Linux" - DLL = "so" - BAT = "sh" - DOT_EXE = "" - USER = os.environ["USER"] - REPOSITORY_PATH = [ os.environ["HOME"] ] - BUILD_BAT = "Linux/Build.sh" - UNWRITABLE_DIR = "/" +INTEGRATION=os.path.dirname(os.path.abspath(sys.argv[0])) +UNREALENGINE=os.path.join(os.path.dirname(INTEGRATION), "UnrealEngine") + +if not os.path.isdir(f"{INTEGRATION}/Source/Integration"): + sys.exit(f"Integration repository is not valid: {INTEGRATION}") +if not os.path.isdir(f"{UNREALENGINE}/Engine/Source/Editor"): + sys.exit(f"Integration repository is not valid: {UNREALENGINE}") # -# Find the two repositories. +# Create the Saved/UnrealBuildTool directories. These will hold +# the file BuildConfiguration.xml +# +# Change directory to one of these in order to force ourselves +# to specify all paths explicitly. # -def find_repository(name, path): - result = None - for place in path: - d = place + "/" + name - if os.path.isdir(d): - print("Found repository:",d) - if result is not None: - sys.exit("Found two repositories. Please remove duplicate.") - result = d - if result is None: - sys.exit(f"Could not find repository: {name}") - return result - - -UNREALENGINE=find_repository("UnrealEngine", REPOSITORY_PATH) -INTEGRATION=find_repository("integration", REPOSITORY_PATH) - -# -# Make sure this script is running out of the expected repository. -# - -if os.path.abspath(os.path.dirname(sys.argv[0])) != INTEGRATION: - print(sys.argv[0]) - sys.exit(f"You must run this script out of {INTEGRATION}") - -# -# Change directory to an unwritable unrelated directory. -# This will force us to use explicit paths everywhere. -# - -os.chdir(UNWRITABLE_DIR) +Path(f"{INTEGRATION}/Saved/UnrealBuildTool").mkdir(parents=True, exist_ok=True) +Path(f"{UNREALENGINE}/Engine/Saved/UnrealBuildTool").mkdir(parents=True, exist_ok=True) +os.chdir(f"{INTEGRATION}/Saved/UnrealBuildTool") # # Remove previously-generated files. # -Path(f"{INTEGRATION}/Saved/UnrealBuildTool").mkdir(parents=True, exist_ok=True) Path(f"{INTEGRATION}/Saved/UnrealBuildTool/BuildConfiguration.xml").unlink(missing_ok=True) Path(f"{INTEGRATION}/Integration.uproject").unlink(missing_ok=True) Path(f"{INTEGRATION}/Integration.code-workspace").unlink(missing_ok=True) Path(f"{INTEGRATION}/Makefile").unlink(missing_ok=True) Path(f"{INTEGRATION}/Source/Integration/lpx-paths.hpp").unlink(missing_ok=True) -Path(f"{UNREALENGINE}/Engine/Saved/UnrealBuildTool").mkdir(parents=True, exist_ok=True) Path(f"{UNREALENGINE}/Engine/Saved/UnrealBuildTool/BuildConfiguration.xml").unlink(missing_ok=True) #