Files
UnrealEngineUWP/Engine/Extras/Containers/Dockerfiles/linux/dev/split-components.py
adam rehn 7749f21a95 Update official container image Dockerfiles for UE5
#rb Luke.Bermingham

#ROBOMERGE-AUTHOR: adam.rehn
#ROBOMERGE-SOURCE: CL 18441473 in //UE5/Release-5.0/... via CL 18444772
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)

[CL 18444939 by adam rehn in ue5-release-engine-test branch]
2021-12-13 13:18:32 -05:00

62 lines
2.1 KiB
Python

#!/usr/bin/env python3
import glob, os, shutil, sys
from os.path import basename, dirname, exists, join
# Logs a message to stderr
def log(message):
print(message, file=sys.stderr)
sys.stderr.flush()
# Extracts the files and directories for the specified component and moves them to a separate output directory
def extractComponent(inputDir, outputDir, component, description, items):
# Print progress output
log("\nExtracting {}...".format(description))
# Create the output directory for the component if it doesn't already exist
componentDir = join(outputDir, component)
os.makedirs(outputDir, exist_ok=True)
# Move each file and directory for the component to the output directory
for item in items:
# Verify that the item exists
if not exists(item):
log("Skipping non-existent item: {}".format(item))
continue
# Print progress output
log("Moving: {}".format(item))
# Ensure the parent directory for the item exists in the output directory
parent = dirname(item).replace(inputDir, componentDir)
os.makedirs(parent, exist_ok=True)
# Perform the move
shutil.move(item, join(parent, basename(item)))
# Retrieve the path to the root directory of the Installed Build
rootDir = sys.argv[1]
# Retrieve the path to the root output directory for extracted components and ensure it exists
outputDir = sys.argv[2]
os.makedirs(outputDir, exist_ok=True)
# Extract the DDC
ddc = [join(rootDir, "Engine", "DerivedDataCache", "Compressed.ddp")]
extractComponent(rootDir, outputDir, "DDC", "Derived Data Cache (DDC)", ddc)
# Extract debug symbols
symbolFiles = glob.glob(join(rootDir, "**", "*.debug"), recursive=True) + glob.glob(
join(rootDir, "**", "*.sym"), recursive=True
)
extractComponent(rootDir, outputDir, "DebugSymbols", "debug symbols", symbolFiles)
# Extract template projects and samples
subdirs = [join(rootDir, subdir) for subdir in ["FeaturePacks", "Samples", "Templates"]]
extractComponent(
rootDir, outputDir, "TemplatesAndSamples", "template projects and samples", subdirs
)