Ejemplo n.º 1
0
        /// <summary>
        /// Execute commands specified in the command line.
        /// </summary>
        /// <param name="CommandsToExecute"></param>
        /// <param name="Commands"></param>
        private static void Execute(List <CommandInfo> CommandsToExecute, CaselessDictionary <Type> Commands)
        {
            for (int CommandIndex = 0; CommandIndex < CommandsToExecute.Count; ++CommandIndex)
            {
                var CommandInfo = CommandsToExecute[CommandIndex];
                Log.TraceVerbose("Attempting to execute {0}", CommandInfo.ToString());
                Type CommandType;
                if (!Commands.TryGetValue(CommandInfo.CommandName, out CommandType))
                {
                    throw new AutomationException("Failed to find command {0}", CommandInfo.CommandName);
                }
                else
                {
                    BuildCommand Command = (BuildCommand)Activator.CreateInstance(CommandType);
                    Command.Params = CommandInfo.Arguments.ToArray();
                    Command.Execute();
                    // dispose of the class if necessary
                    {
                        var CommandDisposable = Command as IDisposable;
                        if (CommandDisposable != null)
                        {
                            CommandDisposable.Dispose();
                        }
                    }

                    // Make sure there's no directories on the stack.
                    CommandUtils.ClearDirStack();
                }
            }

            Log.TraceInformation("Script execution successful, exiting.");
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Display help for the specified commands (to execute)
 /// </summary>
 /// <param name="CommandsToExecute">List of commands specified in the command line.</param>
 /// <param name="Commands">All discovered command objects.</param>
 private static void DisplayHelp(List <CommandInfo> CommandsToExecute, CaselessDictionary <Type> Commands)
 {
     for (int CommandIndex = 0; CommandIndex < CommandsToExecute.Count; ++CommandIndex)
     {
         var  CommandInfo = CommandsToExecute[CommandIndex];
         Type CommandType;
         if (Commands.TryGetValue(CommandInfo.CommandName, out CommandType) == false)
         {
             Log.TraceError("Help: Failed to find command {0}", CommandInfo.CommandName);
         }
         else
         {
             CommandUtils.Help(CommandType);
         }
     }
 }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Execute commands specified in the command line.
        /// </summary>
        /// <param name="CommandsToExecute"></param>
        /// <param name="Commands"></param>
        private static ExitCode Execute(List <CommandInfo> CommandsToExecute, CaselessDictionary <Type> Commands)
        {
            for (int CommandIndex = 0; CommandIndex < CommandsToExecute.Count; ++CommandIndex)
            {
                var CommandInfo = CommandsToExecute[CommandIndex];
                Log.TraceVerbose("Attempting to execute {0}", CommandInfo.ToString());
                Type CommandType;
                if (!Commands.TryGetValue(CommandInfo.CommandName, out CommandType))
                {
                    throw new AutomationException("Failed to find command {0}", CommandInfo.CommandName);
                }

                BuildCommand Command = (BuildCommand)Activator.CreateInstance(CommandType);
                Command.Params = CommandInfo.Arguments.ToArray();
                try
                {
                    ExitCode Result = Command.Execute();
                    if (Result != ExitCode.Success)
                    {
                        return(Result);
                    }
                    CommandUtils.Log("BUILD SUCCESSFUL");
                }
                finally
                {
                    // dispose of the class if necessary
                    var CommandDisposable = Command as IDisposable;
                    if (CommandDisposable != null)
                    {
                        CommandDisposable.Dispose();
                    }
                }

                // Make sure there's no directories on the stack.
                CommandUtils.ClearDirStack();
            }
            return(ExitCode.Success);
        }