Files
UnrealEngineUWP/Engine/Extras/Containers/Dockerfiles/linux/dev/split-components.py
aurel cordonnier 7f517562d5 Merge from Release-Engine-Staging @ 17438845 to Release-Engine-Test
This represents UE4/Main @17430120 and Dev-PerfTest @17437669

[CL 17439044 by aurel cordonnier in ue5-release-engine-test branch]
2021-09-06 12:23:53 -04:00

59 lines
2.0 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)