Пример #1
0
        public bool CanSupportRole(UnrealSessionRole Role, ref List <string> Reasons)
        {
            if (Role.RoleType.UsesEditor() && UnrealPath == null)
            {
                Reasons.Add(string.Format("Role {0} wants editor but no path to Unreal exists", Role));
                return(false);
            }

            // null platform. Need a better way of specifying this
            if (Role.IsNullRole())
            {
                return(true);
            }

            // Query our build list
            if (Role.Platform != null)
            {
                var MatchingBuilds = GetMatchingBuilds(Role.RoleType, Role.Platform.Value, Role.Configuration, Role.RequiredBuildFlags);

                if (MatchingBuilds.Count() > 0)
                {
                    return(true);
                }
            }

            Reasons.Add(string.Format("No build at {0} that matches {1}", string.Join(",", BuildPaths), Role.ToString()));

            return(false);
        }
Пример #2
0
        virtual public UnrealAppConfig CreateConfiguration(UnrealSessionRole Role, IEnumerable <UnrealSessionRole> OtherRoles)
        {
            List <string> Issues = new List <string>();

            Log.Verbose("Creating configuration Role {0}", Role);
            if (!CanSupportRole(Role, ref Issues))
            {
                Issues.ForEach(S => Log.Error(S));
                return(null);
            }

            UnrealAppConfig Config = new UnrealAppConfig();

            Config.Name          = this.BuildName;
            Config.ProjectName   = ProjectName;
            Config.ProcessType   = Role.RoleType;
            Config.Platform      = Role.Platform;
            Config.Configuration = Role.Configuration;
            Config.CommandLine   = "";
            Config.FilesToCopy   = new List <UnrealFileToCopy>();

            // new system of retrieving and encapsulating the info needed to install/launch. Android & Mac
            Config.Build = GetMatchingBuilds(Role.RoleType, Role.Platform, Role.Configuration, Role.RequiredBuildFlags).FirstOrDefault();

            if (Config.Build == null && Role.IsNullRole() == false)
            {
                var SupportedBuilds = String.Join("\n", DiscoveredBuilds.Select(B => B.ToString()));

                Log.Info("Available builds:\n{0}", SupportedBuilds);
                throw new AutomationException("No build found that can support a role of {0}.", Role);
            }

            if (Role.Options != null)
            {
                UnrealTestConfiguration ConfigOptions = Role.Options as UnrealTestConfiguration;
                ConfigOptions.ApplyToConfig(Config, Role, OtherRoles);
            }

            if (string.IsNullOrEmpty(Role.CommandLine) == false)
            {
                Config.CommandLine += " " + Role.CommandLine;
            }

            // Cleanup the commandline
            Config.CommandLine = GenerateProcessedCommandLine(Config.CommandLine);

            // Now add the project (the above code doesn't handle arguments without a leading - so do this last
            bool IsContentOnlyProject = (Config.Build.Flags & BuildFlags.ContentOnlyProject) == BuildFlags.ContentOnlyProject;

            // Add in editor - TODO, should this be in the editor build?
            if (Role.RoleType.UsesEditor() || IsContentOnlyProject)
            {
                // add in -game or -server
                if (Role.RoleType.IsClient())
                {
                    Config.CommandLine = "-game " + Config.CommandLine;
                }
                else if (Role.RoleType.IsServer())
                {
                    Config.CommandLine = "-server " + Config.CommandLine;
                }

                string ProjectParam = ProjectPath.FullName;

                // if content only we need to provide a relative path to the uproject.
                if (IsContentOnlyProject && !Role.RoleType.UsesEditor())
                {
                    ProjectParam = string.Format("../../../{0}/{0}.uproject", ProjectName);
                }

                // project must be first
                Config.CommandLine = String.Format("\"{0}\"", ProjectParam) + " " + Config.CommandLine;
            }

            if (Role.FilesToCopy != null)
            {
                Config.FilesToCopy = Role.FilesToCopy;
            }

            return(Config);
        }