(self, platformIdentifier, configuration)
return thirdparty
Runs UnrealBuildTool in JSON export mode and extracts the list of third-party libraries
Runs UnrealBuildTool in JSON export mode and extracts the list of third-party libraries
Runs UnrealBuildTool in JSON export mode and extracts the list of third - party libraries
def _getThirdPartyLibs(self, platformIdentifier, configuration):
		"""
		Runs UnrealBuildTool in JSON export mode and extracts the list of third-party libraries
		"""
		
		# If we have previously cached the library list for the current engine version, use the cached data
		cachedList = CachedDataManager.getCachedDataKey(self.engineVersionHash, 'ThirdPartyLibraries')
		if cachedList != None:
			return cachedList
		
		# Create a temp directory to hold the JSON file
		tempDir = tempfile.mkdtemp()
		jsonFile = os.path.join(tempDir, 'ubt_output.json')
		
		# Installed Builds of the Engine only contain a small handful of third-party libraries, rather than the full set
		# included in a source build of the Engine. However, if the ThirdParty directory from a source build is copied
		# into an Installed Build and the `InstalledBuild.txt` sentinel file is temporarily renamed, we can get the best
		# of both worlds and utilise the full set of third-party libraries. Enable this sentinel renaming behaviour only
		# if you have copied the ThirdParty directory from a source build into your Installed Build, or else the UBT
		# command will fail trying to rebuild UnrealHeaderTool.
		sentinelFile = os.path.join(self.engineRoot, 'Engine', 'Build', 'InstalledBuild.txt')
		sentinelBackup = sentinelFile + '.bak'
		renameSentinel = os.path.exists(sentinelFile) and os.environ.get('UE4CLI_SENTINEL_RENAME', '0') == '1'
		if renameSentinel == True:
			shutil.move(sentinelFile, sentinelBackup)
		
		# Invoke UnrealBuildTool in JSON export mode (make sure we specify gathering mode, since this is a prerequisite of JSON export)
		# (Ensure we always perform sentinel file cleanup even when errors occur)
		try:
			args = ['-Mode=JsonExport', '-OutputFile=' +jsonFile ] if self.engineVersion['MinorVersion'] >= 22 else ['-gather', '-jsonexport=' + jsonFile, '-SkipBuild']
			self.runUBTFunc('UE4Editor', platformIdentifier, configuration, args)
		finally:
			if renameSentinel == True:
				shutil.move(sentinelBackup, sentinelFile)
		
		# Parse the JSON output
		result = json.loads(Utility.readFile(jsonFile))
		
		# Extract the list of third-party library modules
		# (Note that since UE4.21, modules no longer have a "Type" field, so we must
		# rely on the "Directory" field filter below to identify third-party libraries)
		modules = [result['Modules'][key] for key in result['Modules']]
		
		# Filter out any modules from outside the Engine/Source/ThirdParty directory
		thirdPartyRoot = os.path.join(self.engineRoot, 'Engine', 'Source', 'ThirdParty')
		thirdparty = list([m for m in modules if thirdPartyRoot in m['Directory']])
		
		# Remove the temp directory
		try:
			shutil.rmtree(tempDir)
		except:
			pass
		
		# Cache the list of libraries for use by subsequent runs
		CachedDataManager.setCachedDataKey(self.engineVersionHash, 'ThirdPartyLibraries', thirdparty)
		
		return thirdparty
def _getThirdPartyLibs ( self , platformIdentifier , configuration ) : # If we have previously cached the library list for the current engine version, use the cached data cachedList = CachedDataManager . getCachedDataKey ( self . engineVersionHash , 'ThirdPartyLibraries' ) if cachedList != None : return cachedList # Create a temp directory to hold the JSON file tempDir = tempfile . mkdtemp ( ) jsonFile = os . path . join ( tempDir , 'ubt_output.json' ) # Installed Builds of the Engine only contain a small handful of third-party libraries, rather than the full set # included in a source build of the Engine. However, if the ThirdParty directory from a source build is copied # into an Installed Build and the `InstalledBuild.txt` sentinel file is temporarily renamed, we can get the best # of both worlds and utilise the full set of third-party libraries. Enable this sentinel renaming behaviour only # if you have copied the ThirdParty directory from a source build into your Installed Build, or else the UBT # command will fail trying to rebuild UnrealHeaderTool. sentinelFile = os . path . join ( self . engineRoot , 'Engine' , 'Build' , 'InstalledBuild.txt' ) sentinelBackup = sentinelFile + '.bak' renameSentinel = os . path . exists ( sentinelFile ) and os . environ . get ( 'UE4CLI_SENTINEL_RENAME' , '0' ) == '1' if renameSentinel == True : shutil . move ( sentinelFile , sentinelBackup ) # Invoke UnrealBuildTool in JSON export mode (make sure we specify gathering mode, since this is a prerequisite of JSON export) # (Ensure we always perform sentinel file cleanup even when errors occur) try : args = [ '-Mode=JsonExport' , '-OutputFile=' + jsonFile ] if self . engineVersion [ 'MinorVersion' ] >= 22 else [ '-gather' , '-jsonexport=' + jsonFile , '-SkipBuild' ] self . runUBTFunc ( 'UE4Editor' , platformIdentifier , configuration , args ) finally : if renameSentinel == True : shutil . move ( sentinelBackup , sentinelFile ) # Parse the JSON output result = json . loads ( Utility . readFile ( jsonFile ) ) # Extract the list of third-party library modules # (Note that since UE4.21, modules no longer have a "Type" field, so we must # rely on the "Directory" field filter below to identify third-party libraries) modules = [ result [ 'Modules' ] [ key ] for key in result [ 'Modules' ] ] # Filter out any modules from outside the Engine/Source/ThirdParty directory thirdPartyRoot = os . path . join ( self . engineRoot , 'Engine' , 'Source' , 'ThirdParty' ) thirdparty = list ( [ m for m in modules if thirdPartyRoot in m [ 'Directory' ] ] ) # Remove the temp directory try : shutil . rmtree ( tempDir ) except : pass # Cache the list of libraries for use by subsequent runs CachedDataManager . setCachedDataKey ( self . engineVersionHash , 'ThirdPartyLibraries' , thirdparty ) return thirdparty