Files
Adam Rehn 133aa2c6b0 Re-generate development Dockerfiles with ue4-docker version 0.0.110 and migrate to Ubuntu 22.04 base image.
This migrates the development images to a currently supported version of Ubuntu, and fixes image build errors for Unreal Engine 5.3 and newer.

#rb none

[CL 27703441 by Adam Rehn in ue5-main branch]
2023-09-08 00:24:40 -04:00

61 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
)