/// <summary> /// Finds and/or compiles all script files and assemblies. /// </summary> /// <param name="ScriptsForProjectFileName">Path to the current project. May be null, in which case we compile scripts for all projects.</param> /// <param name="AdditionalScriptsFolders">Additional script fodlers to look for source files in.</param> public void FindAndCompileAllScripts(string ScriptsForProjectFileName, List <string> AdditionalScriptsFolders) { bool DoCompile = false; if (GlobalCommandLine.Compile) { DoCompile = true; } // Change to Engine\Source (if exists) to properly discover all UBT classes var OldCWD = Environment.CurrentDirectory; var UnrealBuildToolCWD = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine", "Source"); if (Directory.Exists(UnrealBuildToolCWD)) { Environment.CurrentDirectory = UnrealBuildToolCWD; } // Register all the classes inside UBT Log.TraceVerbose("Registering UBT Classes."); UnrealBuildTool.UnrealBuildTool.RegisterAllUBTClasses(); Environment.CurrentDirectory = OldCWD; // Compile only if not disallowed. if (DoCompile && !String.IsNullOrEmpty(CommandUtils.CmdEnv.MsBuildExe)) { CleanupScriptsAssemblies(); FindAndCompileScriptModules(ScriptsForProjectFileName, AdditionalScriptsFolders); } var ScriptAssemblies = new List <Assembly>(); LoadPreCompiledScriptAssemblies(ScriptAssemblies); // Setup platforms Platform.InitializePlatforms(ScriptAssemblies.ToArray()); // Instantiate all the automation classes for interrogation Log.TraceVerbose("Creating commands."); ScriptCommands = new CaselessDictionary <Type>(); foreach (var CompiledScripts in ScriptAssemblies) { foreach (var ClassType in CompiledScripts.GetTypes()) { if (ClassType.IsSubclassOf(typeof(BuildCommand)) && ClassType.IsAbstract == false) { if (ScriptCommands.ContainsKey(ClassType.Name) == false) { ScriptCommands.Add(ClassType.Name, ClassType); } else { Log.TraceWarning("Unable to add command {0} twice. Previous: {1}, Current: {2}", ClassType.Name, ClassType.AssemblyQualifiedName, ScriptCommands[ClassType.Name].AssemblyQualifiedName); } } } } }
/// <summary> /// Gets project properties. /// </summary> /// <param name="RawProjectPath">Full project path.</param> /// <returns>Properties of the project.</returns> public static ProjectProperties GetProjectProperties(FileReference RawProjectPath, List <UnrealTargetPlatform> ClientTargetPlatforms = null, bool AssetNativizationRequested = false) { string ProjectKey = "UE4"; if (RawProjectPath != null) { ProjectKey = CommandUtils.ConvertSeparators(PathSeparator.Slash, RawProjectPath.FullName); } ProjectProperties Properties; if (PropertiesCache.TryGetValue(ProjectKey, out Properties) == false) { Properties = DetectProjectProperties(RawProjectPath, ClientTargetPlatforms, AssetNativizationRequested); PropertiesCache.Add(ProjectKey, Properties); } return(Properties); }
/// <summary> /// Gets project properties. /// </summary> /// <param name="RawProjectPath">Full project path.</param> /// <returns>Properties of the project.</returns> public static ProjectProperties GetProjectProperties(string RawProjectPath, List <UnrealTargetPlatform> ClientTargetPlatforms = null) { string ProjectKey = "UE4"; if (!String.IsNullOrEmpty(RawProjectPath)) { ProjectKey = CommandUtils.ConvertSeparators(PathSeparator.Slash, Path.GetFullPath(RawProjectPath)); } ProjectProperties Properties; if (PropertiesCache.TryGetValue(ProjectKey, out Properties) == false) { Properties = DetectProjectProperties(RawProjectPath, ClientTargetPlatforms); PropertiesCache.Add(ProjectKey, Properties); } return(Properties); }