public BranchUProject()
 {
     GameName   = "UE4";
     Properties = ProjectUtils.GetProjectProperties(null);
     if (!Properties.Targets.ContainsKey(TargetType.Editor))
     {
         throw new AutomationException("Base UE4 project did not contain an editor target.");
     }
 }
            public BranchUProject(FileReference ProjectFile)
            {
                GameName = ProjectFile.GetFileNameWithoutExtension();

                //not sure what the heck this path is relative to
                FilePath = ProjectFile;

                if (!CommandUtils.FileExists_NoExceptions(FilePath.FullName))
                {
                    throw new AutomationException("Could not resolve relative path corrctly {0} -> {1} which doesn't exist.", ProjectFile, FilePath);
                }

                Properties = ProjectUtils.GetProjectProperties(FilePath);
            }
Пример #3
0
            public BranchUProject(UnrealBuildTool.UProjectInfo InfoEntry)
            {
                GameName = InfoEntry.GameName;

                //not sure what the heck this path is relative to
                FilePath = Path.GetFullPath(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine", "Binaries", InfoEntry.FilePath));

                if (!CommandUtils.FileExists_NoExceptions(FilePath))
                {
                    throw new AutomationException("Could not resolve relative path corrctly {0} -> {1} which doesn't exist.", InfoEntry.FilePath, FilePath);
                }

                Properties = ProjectUtils.GetProjectProperties(Path.GetFullPath(FilePath));
            }
Пример #4
0
            public BranchUProject(UnrealBuildTool.UProjectInfo InfoEntry)
            {
                GameName = InfoEntry.GameName;

                //not sure what the heck this path is relative to
                FilePath = InfoEntry.FilePath;

                if (!CommandUtils.FileExists_NoExceptions(FilePath.FullName))
                {
                    throw new AutomationException("Could not resolve relative path corrctly {0} -> {1} which doesn't exist.", InfoEntry.FilePath, FilePath);
                }

                Properties = ProjectUtils.GetProjectProperties(FilePath);
            }
Пример #5
0
        public string ProjectTargetFromTarget(string InTargetName, FileReference InProjectFile)
        {
            ProjectProperties Properties = InProjectFile != null?ProjectUtils.GetProjectProperties(InProjectFile) : null;

            string ProjectTarget = null;

            if (Properties != null && Properties.bIsCodeBasedProject)
            {
                var AvailableTargets = Properties.Targets.Select(T => T.Rules.Type.ToString());

                // go through the list of targets such as Editor, Client, Server etc and replace them with their real target names
                List <string> ActualTargets = new List <string>();

                // If they asked for ShooterClient etc and that's there, just return that.
                if (Properties.Targets.Any(T => T.TargetName.Equals(InTargetName, StringComparison.OrdinalIgnoreCase)))
                {
                    ProjectTarget = InTargetName;
                }
                else
                {
                    // find targets that match (and there may be multiple...)
                    IEnumerable <string> MatchingTargetTypes = Properties.Targets.Where(T => T.Rules.Type.ToString().Equals(InTargetName, StringComparison.OrdinalIgnoreCase)).Select(T => T.TargetName);

                    if (MatchingTargetTypes.Any())
                    {
                        if (MatchingTargetTypes.Count() == 1)
                        {
                            ProjectTarget = MatchingTargetTypes.First();
                        }
                        else
                        {
                            // if multiple targets, pick the one with our name (FN specific!)
                            ProjectTarget = MatchingTargetTypes.Where(T => string.CompareOrdinal(T, 0, ProjectName, 0, 1) == 0).FirstOrDefault();
                        }
                    }
                }
            }
            else
            {
                // default UE4 targets
                IEnumerable <string> UE4Targets = new[] { "Editor", "Game", "Client", "Server" };

                string ShortTargetName = InTargetName;
                if (ShortTargetName.StartsWith("UE4", StringComparison.OrdinalIgnoreCase))
                {
                    ShortTargetName = ShortTargetName.Substring(3);
                }

                string UE4Target = UE4Targets.Where(S => S.Equals(ShortTargetName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

                // If they asked for editor, client etc then give them the UE version
                if (!string.IsNullOrEmpty(UE4Target))
                {
                    ProjectTarget = "UE4" + UE4Target;
                }
                else
                {
                    // or just build what they want and let later code figure out if that's valid. E.g. "UnrealPak"
                    ProjectTarget = InTargetName;
                }
            }

            if (string.IsNullOrEmpty(ProjectTarget))
            {
                throw new AutomationException("{0} is not a valid target in {1}", InTargetName, InProjectFile);
            }

            return(ProjectTarget);
        }